linux/drivers/staging/rtl8723bs/include/ieee80211.h

/* SPDX-License-Identifier: GPL-2.0 */
/******************************************************************************
 *
 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
 *
 ******************************************************************************/
#ifndef __IEEE80211_H
#define __IEEE80211_H

#include <linux/ieee80211.h>

#define MGMT_QUEUE_NUM

#define ETH_ALEN
#define ETH_TYPE_LEN
#define PAYLOAD_TYPE_LEN

#define RTL_IOCTL_HOSTAPD

/* RTL871X_IOCTL_HOSTAPD ioctl() cmd: */
enum {};

/* STA flags */
#define WLAN_STA_AUTH
#define WLAN_STA_ASSOC
#define WLAN_STA_PS
#define WLAN_STA_TIM
#define WLAN_STA_PERM
#define WLAN_STA_AUTHORIZED
#define WLAN_STA_PENDING_POLL
#define WLAN_STA_SHORT_PREAMBLE
#define WLAN_STA_PREAUTH
#define WLAN_STA_WME
#define WLAN_STA_MFP
#define WLAN_STA_HT
#define WLAN_STA_WPS
#define WLAN_STA_MAYBE_WPS
#define WLAN_STA_NONERP

#define IEEE_CMD_SET_WPA_PARAM
#define IEEE_CMD_SET_WPA_IE
#define IEEE_CMD_SET_ENCRYPTION
#define IEEE_CMD_MLME

#define IEEE_PARAM_WPA_ENABLED
#define IEEE_PARAM_TKIP_COUNTERMEASURES
#define IEEE_PARAM_DROP_UNENCRYPTED
#define IEEE_PARAM_PRIVACY_INVOKED
#define IEEE_PARAM_AUTH_ALGS
#define IEEE_PARAM_IEEE_802_1X
#define IEEE_PARAM_WPAX_SELECT

#define IEEE_MLME_STA_DEAUTH
#define IEEE_MLME_STA_DISASSOC

#define IEEE_CRYPT_ERR_UNKNOWN_ALG
#define IEEE_CRYPT_ERR_UNKNOWN_ADDR
#define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED
#define IEEE_CRYPT_ERR_KEY_SET_FAILED
#define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED
#define IEEE_CRYPT_ERR_CARD_CONF_FAILED


#define IEEE_CRYPT_ALG_NAME_LEN

#define WPA_CIPHER_NONE
#define WPA_CIPHER_WEP40
#define WPA_CIPHER_WEP104
#define WPA_CIPHER_TKIP
#define WPA_CIPHER_CCMP



#define WPA_SELECTOR_LEN
extern u8 RTW_WPA_OUI_TYPE[];
extern u16 RTW_WPA_VERSION;
extern u8 WPA_AUTH_KEY_MGMT_NONE[];
extern u8 WPA_AUTH_KEY_MGMT_UNSPEC_802_1X[];
extern u8 WPA_AUTH_KEY_MGMT_PSK_OVER_802_1X[];
extern u8 WPA_CIPHER_SUITE_NONE[];
extern u8 WPA_CIPHER_SUITE_WEP40[];
extern u8 WPA_CIPHER_SUITE_TKIP[];
extern u8 WPA_CIPHER_SUITE_WRAP[];
extern u8 WPA_CIPHER_SUITE_CCMP[];
extern u8 WPA_CIPHER_SUITE_WEP104[];


#define RSN_HEADER_LEN
#define RSN_SELECTOR_LEN

extern u16 RSN_VERSION_BSD;
extern u8 RSN_AUTH_KEY_MGMT_UNSPEC_802_1X[];
extern u8 RSN_AUTH_KEY_MGMT_PSK_OVER_802_1X[];
extern u8 RSN_CIPHER_SUITE_NONE[];
extern u8 RSN_CIPHER_SUITE_WEP40[];
extern u8 RSN_CIPHER_SUITE_TKIP[];
extern u8 RSN_CIPHER_SUITE_WRAP[];
extern u8 RSN_CIPHER_SUITE_CCMP[];
extern u8 RSN_CIPHER_SUITE_WEP104[];


enum {};

enum network_type {};

#define SUPPORTED_24G_NETTYPE_MSK

#define is_legacy_only(net_type)

#define is_supported_24g(net_type)

#define is_supported_tx_cck(net_type)
#define is_supported_ht(net_type)

struct ieee_param {};

struct ieee_param_ex {};

struct sta_data {};

/* this is stolen from ipw2200 driver */
#define IEEE_IBSS_MAC_HASH_SIZE

struct eapol {} __attribute__ ((packed));

#define IEEE80211_FCS_LEN

#define MIN_FRAG_THRESHOLD
#define MAX_FRAG_THRESHOLD

/* sequence control field */
#define RTW_IEEE80211_SCTL_FRAG
#define RTW_IEEE80211_SCTL_SEQ


#define RTW_ERP_INFO_NON_ERP_PRESENT
#define RTW_ERP_INFO_USE_PROTECTION
#define RTW_ERP_INFO_BARKER_PREAMBLE_MODE

/* QoS, QOS */
#define NORMAL_ACK
#define NO_ACK
#define NON_EXPLICIT_ACK
#define BLOCK_ACK

#ifndef ETH_P_PAE
#define ETH_P_PAE
#endif /* ETH_P_PAE */

#define ETH_P_PREAUTH

#define ETH_P_ECONET

#ifndef ETH_P_80211_RAW
#define ETH_P_80211_RAW
#endif

/* IEEE 802.11 defines */

#define P80211_OUI_LEN

struct ieee80211_snap_hdr {} __attribute__ ((packed));

#define SNAP_SIZE

#define WLAN_FC_GET_TYPE(fc)
#define WLAN_FC_GET_STYPE(fc)

#define WLAN_QC_GET_TID(qc)

#define WLAN_GET_SEQ_FRAG(seq)
#define WLAN_GET_SEQ_SEQ(seq)

/* Reason codes */
#define WLAN_REASON_ACTIVE_ROAM
#define WLAN_REASON_JOIN_WRONG_CHANNEL
#define WLAN_REASON_EXPIRATION_CHK

#define IEEE80211_MGMT_HDR_LEN
#define IEEE80211_DATA_HDR3_LEN
#define IEEE80211_DATA_HDR4_LEN


#define IEEE80211_STATMASK_SIGNAL
#define IEEE80211_STATMASK_RSSI
#define IEEE80211_STATMASK_NOISE
#define IEEE80211_STATMASK_RATE
#define IEEE80211_STATMASK_WEMASK


#define IEEE80211_CCK_MODULATION
#define IEEE80211_OFDM_MODULATION

#define IEEE80211_24GHZ_BAND
#define IEEE80211_52GHZ_BAND

#define IEEE80211_CCK_RATE_LEN
#define IEEE80211_NUM_OFDM_RATESLEN


#define IEEE80211_CCK_RATE_1MB
#define IEEE80211_CCK_RATE_2MB
#define IEEE80211_CCK_RATE_5MB
#define IEEE80211_CCK_RATE_11MB
#define IEEE80211_OFDM_RATE_LEN
#define IEEE80211_OFDM_RATE_6MB
#define IEEE80211_OFDM_RATE_9MB
#define IEEE80211_OFDM_RATE_12MB
#define IEEE80211_OFDM_RATE_18MB
#define IEEE80211_OFDM_RATE_24MB
#define IEEE80211_OFDM_RATE_36MB
#define IEEE80211_OFDM_RATE_48MB
#define IEEE80211_OFDM_RATE_54MB
#define IEEE80211_BASIC_RATE_MASK

#define IEEE80211_CCK_RATE_1MB_MASK
#define IEEE80211_CCK_RATE_2MB_MASK
#define IEEE80211_CCK_RATE_5MB_MASK
#define IEEE80211_CCK_RATE_11MB_MASK
#define IEEE80211_OFDM_RATE_6MB_MASK
#define IEEE80211_OFDM_RATE_9MB_MASK
#define IEEE80211_OFDM_RATE_12MB_MASK
#define IEEE80211_OFDM_RATE_18MB_MASK
#define IEEE80211_OFDM_RATE_24MB_MASK
#define IEEE80211_OFDM_RATE_36MB_MASK
#define IEEE80211_OFDM_RATE_48MB_MASK
#define IEEE80211_OFDM_RATE_54MB_MASK

#define IEEE80211_CCK_RATES_MASK
#define IEEE80211_CCK_BASIC_RATES_MASK
#define IEEE80211_CCK_DEFAULT_RATES_MASK

#define IEEE80211_OFDM_RATES_MASK
#define IEEE80211_OFDM_BASIC_RATES_MASK
#define IEEE80211_OFDM_DEFAULT_RATES_MASK
#define IEEE80211_DEFAULT_RATES_MASK

#define IEEE80211_NUM_OFDM_RATES
#define IEEE80211_NUM_CCK_RATES
#define IEEE80211_OFDM_SHIFT_MASK_A


enum {};

#define IS_HT_RATE(_rate)
#define IS_CCK_RATE(_rate)
#define IS_OFDM_RATE(_rate)


/* NOTE: This data is for statistical purposes; not all hardware provides this
 *       information for frames received.  Not setting these will not cause
 *       any adverse affects. */

/* IEEE 802.11 requires that STA supports concurrent reception of at least
 * three fragmented frames. This define can be increased to support more
 * concurrent frames, but it should be noted that each entry can consume about
 * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
#define IEEE80211_FRAG_CACHE_LEN

#define SEC_KEY_1
#define SEC_KEY_2
#define SEC_KEY_3
#define SEC_KEY_4
#define SEC_ACTIVE_KEY
#define SEC_AUTH_MODE
#define SEC_UNICAST_GROUP
#define SEC_LEVEL
#define SEC_ENABLED

#define SEC_LEVEL_0
#define SEC_LEVEL_1
#define SEC_LEVEL_2
#define SEC_LEVEL_2_CKIP
#define SEC_LEVEL_3

#define WEP_KEYS
#define WEP_KEY_LEN

#define BIP_MAX_KEYID
#define BIP_AAD_SIZE

/*

 802.11 data frame from AP

      ,-------------------------------------------------------------------.
Bytes |  2   |  2   |    6    |    6    |    6    |  2   | 0..2312 |   4  |
      |------|------|---------|---------|---------|------|---------|------|
Desc. | ctrl | dura |  DA/RA  |   TA    |    SA   | Sequ |  frame  |  fcs |
      |      | tion | (BSSID) |         |         | ence |  data   |      |
      `-------------------------------------------------------------------'

Total: 28-2340 bytes

*/

#define BEACON_PROBE_SSID_ID_POSITION

/* Management Frame Information Element Types */
#define MFIE_TYPE_SSID
#define MFIE_TYPE_RATES
#define MFIE_TYPE_FH_SET
#define MFIE_TYPE_DS_SET
#define MFIE_TYPE_CF_SET
#define MFIE_TYPE_TIM
#define MFIE_TYPE_IBSS_SET
#define MFIE_TYPE_CHALLENGE
#define MFIE_TYPE_ERP
#define MFIE_TYPE_RSN
#define MFIE_TYPE_RATES_EX
#define MFIE_TYPE_GENERIC

/* SWEEP TABLE ENTRIES NUMBER*/
#define MAX_SWEEP_TAB_ENTRIES
#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET
/* MAX_RATES_LENGTH needs to be 12.  The spec says 8, and many APs
 * only use 8, and then use extended rates for the remaining supported
 * rates.  Other APs, however, stick all of their supported rates on the
 * main rates information element... */
#define MAX_RATES_LENGTH
#define MAX_RATES_EX_LENGTH
#define MAX_NETWORK_COUNT
#define MAX_CHANNEL_NUMBER
#define IEEE80211_SOFTMAC_SCAN_TIME
/* HZ / 2) */
#define IEEE80211_SOFTMAC_ASSOC_RETRY_TIME

#define CRC_LENGTH

#define MAX_WPA_IE_LEN
#define MAX_WPS_IE_LEN
#define MAX_P2P_IE_LEN
#define MAX_WFD_IE_LEN

#define NETWORK_EMPTY_ESSID
#define NETWORK_HAS_OFDM
#define NETWORK_HAS_CCK

#define IEEE80211_DTIM_MBCAST
#define IEEE80211_DTIM_UCAST
#define IEEE80211_DTIM_VALID
#define IEEE80211_DTIM_INVALID

#define IEEE80211_PS_DISABLED
#define IEEE80211_PS_UNICAST
#define IEEE80211_PS_MBCAST
#define IW_ESSID_MAX_SIZE
/*
join_res:
-1: authentication fail
-2: association fail
> 0: TID
*/

#define DEFAULT_MAX_SCAN_AGE
#define DEFAULT_FTS
#define MAC_ARG(x)
#define IP_ARG(x)

static inline int is_multicast_mac_addr(const u8 *addr)
{}

static inline int is_broadcast_mac_addr(const u8 *addr)
{}

static inline int is_zero_mac_addr(const u8 *addr)
{}

#define CFG_IEEE80211_RESERVE_FCS
#define CFG_IEEE80211_COMPUTE_FCS

#define MAXTID

#define IEEE_A
#define IEEE_B
#define IEEE_G
#define IEEE_MODE_MASK

/* Action category code */
enum {};

enum {};

#define OUI_MICROSOFT
#define WME_OUI_TYPE
#define WME_OUI_SUBTYPE_INFORMATION_ELEMENT
#define WME_OUI_SUBTYPE_PARAMETER_ELEMENT
#define WME_OUI_SUBTYPE_TSPEC_ELEMENT
#define WME_VERSION

#define WME_ACTION_CODE_SETUP_REQUEST
#define WME_ACTION_CODE_SETUP_RESPONSE
#define WME_ACTION_CODE_TEARDOWN

#define WME_SETUP_RESPONSE_STATUS_ADMISSION_ACCEPTED
#define WME_SETUP_RESPONSE_STATUS_INVALID_PARAMETERS
#define WME_SETUP_RESPONSE_STATUS_REFUSED

#define WME_TSPEC_DIRECTION_UPLINK
#define WME_TSPEC_DIRECTION_DOWNLINK
#define WME_TSPEC_DIRECTION_BI_DIRECTIONAL


#define OUI_BROADCOM

#define VENDOR_HT_CAPAB_OUI_TYPE

/**
 * enum rtw_ieee80211_channel_flags - channel flags
 *
 * Channel flags set by the regulatory control code.
 *
 * @RTW_IEEE80211_CHAN_DISABLED: This channel is disabled.
 * @RTW_IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
 *      on this channel.
 * @RTW_IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
 * @RTW_IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
 * @RTW_IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
 *      is not permitted.
 * @RTW_IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
 *      is not permitted.
 */
enum rtw_ieee80211_channel_flags {};

#define RTW_IEEE80211_CHAN_NO_HT40

/* Represent channel details, subset of ieee80211_channel */
struct rtw_ieee80211_channel {};

#define CHAN_FMT

#define CHAN_ARG(channel) \

/* Parsed Information Elements */
struct rtw_ieee802_11_elems {};

enum ParseRes {};

enum ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
				struct rtw_ieee802_11_elems *elems,
				int show_errors);

u8 *rtw_set_fixed_ie(unsigned char *pbuf, unsigned int len, unsigned char *source, unsigned int *frlen);
u8 *rtw_set_ie(u8 *pbuf, signed int index, uint len, u8 *source, uint *frlen);

u8 *rtw_get_ie(u8 *pbuf, signed int index, signed int *len, signed int limit);
u8 *rtw_get_ie_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, u8 oui_len, u8 *ie, uint *ielen);
int rtw_ies_remove_ie(u8 *ies, uint *ies_len, uint offset, u8 eid, u8 *oui, u8 oui_len);

void rtw_set_supported_rate(u8 *SupportedRates, uint mode);

unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit);
unsigned char *rtw_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len, int limit);
int rtw_get_wpa_cipher_suite(u8 *s);
int rtw_get_wpa2_cipher_suite(u8 *s);
int rtw_get_wapi_ie(u8 *in_ie, uint in_len, u8 *wapi_ie, u16 *wapi_len);
int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwise_cipher, int *is_8021x);
int rtw_parse_wpa2_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwise_cipher, int *is_8021x);

void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 *wpa_ie, u16 *wpa_len);

u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen);
u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id, u8 *buf_attr, u32 *len_attr);
u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, u16 target_attr_id, u8 *buf_content, uint *len_content);

/**
 * for_each_ie - iterate over continuous IEs
 * @ie:
 * @buf:
 * @buf_len:
 */
#define for_each_ie(ie, buf, buf_len)

uint	rtw_get_rateset_len(u8 *rateset);

struct registry_priv;
int rtw_generate_ie(struct registry_priv *pregistrypriv);


int rtw_get_bit_value_from_ieee_value(u8 val);

bool rtw_is_cckrates_included(u8 *rate);

bool rtw_is_cckratesonly_included(u8 *rate);

int rtw_check_network_type(unsigned char *rate, int ratelen, int channel);

void rtw_get_bcn_info(struct wlan_network *pnetwork);

void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr);

u16 rtw_mcs_rate(u8 bw_40MHz, u8 short_GI, unsigned char *MCS_rate);

int rtw_action_frame_parse(const u8 *frame, u32 frame_len, u8 *category, u8 *action);
const char *action_public_str(u8 action);

#endif /* IEEE80211_H */