1#ifndef _IPXE_IEEE80211_H
2#define _IPXE_IEEE80211_H
28#define IEEE80211_MAX_DATA_LEN 2304
31#define IEEE80211_LLC_HEADER_LEN 8
34#define IEEE80211_MAX_CRYPTO_HEADER 8
45#define IEEE80211_MAX_CRYPTO_TRAILER 8
48#define IEEE80211_MAX_CRYPTO_OVERHEAD 16
51#define IEEE80211_MAX_FRAME_DATA 2296
60#define IEEE80211_TYP_FRAME_HEADER_LEN 24
67#define IEEE80211_MAX_FRAME_HEADER_LEN 32
74#define IEEE80211_MAX_FRAME_LEN 2352
77#define IEEE80211_MAX_SSID_LEN 32
90#define IEEE80211_FC_VERSION 0x0003
93#define IEEE80211_THIS_VERSION 0x0000
97#define IEEE80211_FC_TYPE 0x000C
100#define IEEE80211_TYPE_MGMT 0x0000
103#define IEEE80211_TYPE_CTRL 0x0004
106#define IEEE80211_TYPE_DATA 0x0008
110#define IEEE80211_FC_SUBTYPE 0x00F0
118#define IEEE80211_STYPE_ASSOC_REQ 0x0000
125#define IEEE80211_STYPE_ASSOC_RESP 0x0010
133#define IEEE80211_STYPE_REASSOC_REQ 0x0020
141#define IEEE80211_STYPE_REASSOC_RESP 0x0030
150#define IEEE80211_STYPE_PROBE_REQ 0x0040
157#define IEEE80211_STYPE_PROBE_RESP 0x0050
168#define IEEE80211_STYPE_BEACON 0x0080
178#define IEEE80211_STYPE_DISASSOC 0x00A0
188#define IEEE80211_STYPE_AUTH 0x00B0
198#define IEEE80211_STYPE_DEAUTH 0x00C0
205#define IEEE80211_STYPE_ACTION 0x00D0
209#define IEEE80211_STYPE_RTS 0x00B0
212#define IEEE80211_STYPE_CTS 0x00C0
215#define IEEE80211_STYPE_ACK 0x00D0
219#define IEEE80211_STYPE_DATA 0x0000
222#define IEEE80211_STYPE_NODATA 0x0040
229#define IEEE80211_FC_TODS 0x0100
237#define IEEE80211_FC_FROMDS 0x0200
240#define IEEE80211_FC_MORE_FRAG 0x0400
243#define IEEE80211_FC_RETRY 0x0800
251#define IEEE80211_FC_PWR_MGMT 0x1000
258#define IEEE80211_FC_MORE_DATA 0x2000
264#define IEEE80211_FC_PROTECTED 0x4000
267#define IEEE80211_FC_ORDER 0x8000
280#define IEEE80211_SEQNR( seq ) ( ( seq ) >> 4 )
283#define IEEE80211_FRAG( seq ) ( ( seq ) & 0x000F )
286#define IEEE80211_MAKESEQ( seqnr, frag ) \
287 ( ( ( ( seqnr ) & 0xFFF ) << 4 ) | ( ( frag ) & 0xF ) )
337#define IEEE80211_LLC_DSAP 0xAA
340#define IEEE80211_LLC_SSAP 0xAA
346#define IEEE80211_LLC_CTRL 0x03
359#define IEEE80211_RTS_LEN 16
369#define ieee80211_cts ieee80211_cts_or_ack
370#define ieee80211_ack ieee80211_cts_or_ack
373#define IEEE80211_CTS_LEN 10
376#define IEEE80211_ACK_LEN 10
389#define IEEE80211_CAPAB_MANAGED 0x0001
392#define IEEE80211_CAPAB_ADHOC 0x0002
395#define IEEE80211_CAPAB_CFPOLL 0x0004
398#define IEEE80211_CAPAB_CFPR 0x0008
401#define IEEE80211_CAPAB_PRIVACY 0x0010
404#define IEEE80211_CAPAB_SHORT_PMBL 0x0020
407#define IEEE80211_CAPAB_PBCC 0x0040
410#define IEEE80211_CAPAB_CHAN_AGILITY 0x0080
413#define IEEE80211_CAPAB_SPECTRUM_MGMT 0x0100
416#define IEEE80211_CAPAB_QOS 0x0200
419#define IEEE80211_CAPAB_SHORT_SLOT 0x0400
422#define IEEE80211_CAPAB_APSD 0x0800
425#define IEEE80211_CAPAB_DSSS_OFDM 0x2000
428#define IEEE80211_CAPAB_DELAYED_BACK 0x4000
431#define IEEE80211_CAPAB_IMMED_BACK 0x8000
452#define IEEE80211_STATUS_SUCCESS 0
453#define IEEE80211_STATUS_FAILURE 1
454#define IEEE80211_STATUS_CAPAB_UNSUPP 10
455#define IEEE80211_STATUS_REASSOC_INVALID 11
456#define IEEE80211_STATUS_ASSOC_DENIED 12
457#define IEEE80211_STATUS_AUTH_ALGO_UNSUPP 13
458#define IEEE80211_STATUS_AUTH_SEQ_INVALID 14
459#define IEEE80211_STATUS_AUTH_CHALL_INVALID 15
460#define IEEE80211_STATUS_AUTH_TIMEOUT 16
461#define IEEE80211_STATUS_ASSOC_NO_ROOM 17
462#define IEEE80211_STATUS_ASSOC_NEED_RATE 18
463#define IEEE80211_STATUS_ASSOC_NEED_SHORT_PMBL 19
464#define IEEE80211_STATUS_ASSOC_NEED_PBCC 20
465#define IEEE80211_STATUS_ASSOC_NEED_CHAN_AGILITY 21
466#define IEEE80211_STATUS_ASSOC_NEED_SPECTRUM_MGMT 22
467#define IEEE80211_STATUS_ASSOC_BAD_POWER 23
468#define IEEE80211_STATUS_ASSOC_BAD_CHANNELS 24
469#define IEEE80211_STATUS_ASSOC_NEED_SHORT_SLOT 25
470#define IEEE80211_STATUS_ASSOC_NEED_DSSS_OFDM 26
471#define IEEE80211_STATUS_QOS_FAILURE 32
472#define IEEE80211_STATUS_QOS_NO_ROOM 33
473#define IEEE80211_STATUS_LINK_IS_HORRIBLE 34
474#define IEEE80211_STATUS_ASSOC_NEED_QOS 35
475#define IEEE80211_STATUS_REQUEST_DECLINED 37
476#define IEEE80211_STATUS_REQUEST_INVALID 38
477#define IEEE80211_STATUS_TS_NOT_CREATED_AGAIN 39
478#define IEEE80211_STATUS_INVALID_IE 40
479#define IEEE80211_STATUS_GROUP_CIPHER_INVALID 41
480#define IEEE80211_STATUS_PAIR_CIPHER_INVALID 42
481#define IEEE80211_STATUS_AKMP_INVALID 43
482#define IEEE80211_STATUS_RSN_VERSION_UNSUPP 44
483#define IEEE80211_STATUS_RSN_CAPAB_INVALID 45
484#define IEEE80211_STATUS_CIPHER_REJECTED 46
485#define IEEE80211_STATUS_TS_NOT_CREATED_WAIT 47
486#define IEEE80211_STATUS_DIRECT_LINK_FORBIDDEN 48
487#define IEEE80211_STATUS_DEST_NOT_PRESENT 49
488#define IEEE80211_STATUS_DEST_NOT_QOS 50
489#define IEEE80211_STATUS_ASSOC_LISTEN_TOO_HIGH 51
511#define IEEE80211_REASON_NONE 0
512#define IEEE80211_REASON_UNSPECIFIED 1
513#define IEEE80211_REASON_AUTH_NO_LONGER_VALID 2
514#define IEEE80211_REASON_LEAVING 3
515#define IEEE80211_REASON_INACTIVITY 4
516#define IEEE80211_REASON_OUT_OF_RESOURCES 5
517#define IEEE80211_REASON_NEED_AUTH 6
518#define IEEE80211_REASON_NEED_ASSOC 7
519#define IEEE80211_REASON_LEAVING_TO_ROAM 8
520#define IEEE80211_REASON_REASSOC_INVALID 9
521#define IEEE80211_REASON_BAD_POWER 10
522#define IEEE80211_REASON_BAD_CHANNELS 11
523#define IEEE80211_REASON_INVALID_IE 13
524#define IEEE80211_REASON_MIC_FAILURE 14
525#define IEEE80211_REASON_4WAY_TIMEOUT 15
526#define IEEE80211_REASON_GROUPKEY_TIMEOUT 16
527#define IEEE80211_REASON_4WAY_INVALID 17
528#define IEEE80211_REASON_GROUP_CIPHER_INVALID 18
529#define IEEE80211_REASON_PAIR_CIPHER_INVALID 19
530#define IEEE80211_REASON_AKMP_INVALID 20
531#define IEEE80211_REASON_RSN_VERSION_INVALID 21
532#define IEEE80211_REASON_RSN_CAPAB_INVALID 22
533#define IEEE80211_REASON_8021X_FAILURE 23
534#define IEEE80211_REASON_CIPHER_REJECTED 24
535#define IEEE80211_REASON_QOS_UNSPECIFIED 32
536#define IEEE80211_REASON_QOS_OUT_OF_RESOURCES 33
537#define IEEE80211_REASON_LINK_IS_HORRIBLE 34
538#define IEEE80211_REASON_INVALID_TXOP 35
539#define IEEE80211_REASON_REQUESTED_LEAVING 36
540#define IEEE80211_REASON_REQUESTED_NO_USE 37
541#define IEEE80211_REASON_REQUESTED_NEED_SETUP 38
542#define IEEE80211_REASON_REQUESTED_TIMEOUT 39
543#define IEEE80211_REASON_CIPHER_UNSUPPORTED 45
582#define IEEE80211_IE_SSID 0
600#define IEEE80211_IE_RATES 1
603#define IEEE80211_IE_EXT_RATES 50
620#define IEEE80211_IE_DS_PARAM 3
668#define IEEE80211_IE_COUNTRY 7
683#define IEEE80211_IE_REQUEST 10
698#define IEEE80211_IE_CHALLENGE_TEXT 16
713#define IEEE80211_IE_POWER_CONSTRAINT 52
730#define IEEE80211_IE_POWER_CAPAB 33
754#define IEEE80211_IE_CHANNELS 36
768#define IEEE80211_IE_ERP_INFO 42
771#define IEEE80211_ERP_NONERP_PRESENT 0x01
774#define IEEE80211_ERP_USE_PROTECTION 0x02
777#define IEEE80211_ERP_BARKER_LONG 0x04
834#define IEEE80211_IE_RSN 48
846 return 16 + 4 * ( npair + nauth ) + 16 * npmkid - 4 * ! rsn_ie;
850#if __BYTE_ORDER == __BIG_ENDIAN
851#define _MKOUI( a, b, c, t ) \
852 ( ( ( a ) << 24 ) | ( ( b ) << 16 ) | ( ( c ) << 8 ) | ( d ) )
853#define OUI_ORG_MASK 0xFFFFFF00
854#define OUI_TYPE_MASK 0x000000FF
856#define _MKOUI( a, b, c, t ) \
857 ( ( ( t ) << 24 ) | ( ( c ) << 16 ) | ( ( b ) << 8 ) | ( a ) )
858#define OUI_ORG_MASK 0x00FFFFFF
859#define OUI_TYPE_MASK 0xFF000000
863#define IEEE80211_RSN_OUI _MKOUI ( 0x00, 0x0F, 0xAC, 0 )
866#define IEEE80211_WPA_OUI _MKOUI ( 0x00, 0x50, 0xF2, 0 )
869#define IEEE80211_WPA_OUI_VEN _MKOUI ( 0x00, 0x50, 0xF2, 0x01 )
873#define IEEE80211_RSN_VERSION 1
876#define IEEE80211_RSN_CTYPE_WEP40 _MKOUI ( 0, 0, 0, 0x01 )
879#define IEEE80211_RSN_CTYPE_WEP104 _MKOUI ( 0, 0, 0, 0x05 )
882#define IEEE80211_RSN_CTYPE_TKIP _MKOUI ( 0, 0, 0, 0x02 )
885#define IEEE80211_RSN_CTYPE_CCMP _MKOUI ( 0, 0, 0, 0x04 )
892#define IEEE80211_RSN_CTYPE_USEGROUP _MKOUI ( 0, 0, 0, 0x00 )
895#define IEEE80211_RSN_ATYPE_8021X _MKOUI ( 0, 0, 0, 0x01 )
898#define IEEE80211_RSN_ATYPE_PSK _MKOUI ( 0, 0, 0, 0x02 )
901#define IEEE80211_RSN_CAPAB_PREAUTH 0x001
908#define IEEE80211_RSN_CAPAB_NO_PAIRWISE 0x002
915#define IEEE80211_RSN_CAPAB_PTKSA_REPLAY 0x00C
922#define IEEE80211_RSN_CAPAB_GTKSA_REPLAY 0x030
925#define IEEE80211_RSN_CAPAB_PEERKEY 0x200
934#define IEEE80211_RSN_1_CTR 0x000
937#define IEEE80211_RSN_2_CTR 0x014
940#define IEEE80211_RSN_4_CTR 0x028
943#define IEEE80211_RSN_16_CTR 0x03C
960#define IEEE80211_IE_VENDOR 221
1015 return ( iep + 2 <=
end && iep + 2 + ie->
len <=
end );
1031 void *next_ie_byte = (
void * ) ie + ie->
len + 2;
1069#define ieee80211_beacon ieee80211_beacon_or_probe_resp
1070#define ieee80211_probe_resp ieee80211_beacon_or_probe_resp
1079#define ieee80211_disassoc ieee80211_disassoc_or_deauth
1080#define ieee80211_deauth ieee80211_disassoc_or_deauth
1111#define ieee80211_assoc_resp ieee80211_assoc_or_reassoc_resp
1112#define ieee80211_reassoc_resp ieee80211_assoc_or_reassoc_resp
1154#define IEEE80211_AUTH_OPEN_SYSTEM 0
1157#define IEEE80211_AUTH_SHARED_KEY 1
#define NULL
NULL pointer (VOID *)
static size_t ieee80211_rsn_size(int npair, int nauth, int npmkid, int rsn_ie)
Calculate necessary size of RSN information element.
static int ieee80211_ie_bound(union ieee80211_ie *ie, void *end)
Check that 802.11 information element is bounded by buffer.
union ieee80211_ie_country_triplet __attribute__
static union ieee80211_ie * ieee80211_next_ie(union ieee80211_ie *ie, void *end)
Advance to next 802.11 information element.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
uint32_t end
Ending offset.
Association or reassociation response frame data.
u16 capability
Capability flags.
union ieee80211_ie info_element[0]
List of information elements.
Association request frame data.
union ieee80211_ie info_element[0]
List of information elements.
u16 capability
Capability flags.
u16 listen_interval
Interval at which we wake up, in units of the beacon interval.
Authentication frame data.
union ieee80211_ie info_element[0]
List of information elements.
u16 algorithm
Authentication algorithm (Open System or Shared Key)
u16 tx_seq
Sequence number of this frame; first from client to AP is 1.
Beacon or probe response frame data.
u16 capability
Capability flags.
u16 beacon_interval
Interval at which beacons are sent, in units of 1024 us.
union ieee80211_ie info_element[0]
List of information elements.
u64 timestamp
802.11 TSFT value at frame send
10-byte CTS or ACK frame format, with abbreviated header
u16 fc
802.11 Frame Control field
u16 duration
Microseconds to reserve link.
u8 addr1[ETH_ALEN]
Address 1 (immediate receiver)
Disassociation or deauthentication frame data.
An 802.11 data or management frame without QoS or WDS header fields.
u8 addr2[ETH_ALEN]
Address 2 (immediate sender)
u16 seq
802.11 Sequence Control field
u8 addr3[ETH_ALEN]
Address 3 (often "forward to")
u16 fc
802.11 Frame Control field
u8 addr1[ETH_ALEN]
Address 1 (immediate receiver)
u8 data[0]
Beginning of frame data.
u16 duration
Microseconds to reserve link.
802.11 Challenge Text information element
u8 id
Challenge Text ID: 16.
u8 challenge_text[0]
Challenge Text data.
u8 len
Challenge Text length: usually 128.
802.11 Channels information element channel band tuple
u8 first_channel
Channel number of first channel in band.
u8 nr_channels
Number of channels in band.
802.11 Channels information element
struct ieee80211_ie_channels_channel_band channels[0]
List of (start, length) channel bands we can use.
u8 len
Channels length: 2.
802.11 Country information element regulatory band triplet
u8 max_txpower
Maximum TX power in dBm.
u8 first_channel
Channel number for first channel in band.
u8 nr_channels
Number of contiguous channels in band.
802.11 Country information element regulatory extension triplet
u8 reg_ext_id
Regulatory extension ID.
u8 reg_class_id
Regulatory class ID.
u8 coverage_class
Coverage class.
802.11 Country information element
u8 id
Country information ID: 7.
u8 len
Country information length: varies.
union ieee80211_ie_country_triplet triplet[0]
List of regulatory triplets.
char in_out
'I' for indoor, 'O' for outdoor
char name[2]
ISO Alpha2 country code.
802.11 Direct Spectrum parameter information element
u8 current_channel
Current channel number, 1-14.
u8 len
DS parameter length: 1.
802.11 ERP Information information element
u8 len
ERP Information length: 1.
u8 id
ERP Information ID: 42.
802.11 Power Capability information element
u8 max_txpower
Maximum possible TX power, dBm.
u8 id
Power Capability ID: 33.
u8 len
Power Capability length: 2.
u8 min_txpower
Minimum possible TX power, dBm.
802.11 Power Constraint information element
u8 power_constraint
Decrease in allowed TX power, dBm.
u8 id
Power Constraint ID: 52.
u8 len
Power Constraint length: 1.
802.11 rates information element
u8 rates[0]
Rates data, one rate per byte.
802.11 Request information element
u8 request[0]
List of IEs requested.
u8 len
Number of IEs requested.
802.11 Robust Security Network ("WPA") information element
u8 id
Information element ID.
u16 akm_count
Number of authentication types supported.
u16 pairwise_count
Number of unicast ciphers supported.
u32 akm_list[1]
List of authentication type IDs for supported types.
u32 pairwise_cipher[1]
List of cipher IDs for supported unicast frame ciphers.
u8 pmkid_list[0]
List of PMKIDs included, each a 16-byte SHA1 hash.
u16 rsn_capab
Security capabilities field (RSN only)
u32 group_cipher
Cipher ID for the cipher used in multicast/broadcast frames.
u16 pmkid_count
Number of PMKIDs included (present only in association frames)
u8 len
Information element length.
u16 version
RSN information element version.
802.11 SSID information element
char ssid[0]
SSID data, not NUL-terminated.
802.11 Vendor Specific information element
u8 len
Vendor-specific length: variable.
u8 data[0]
Vendor-specific data.
u32 oui
OUI and vendor-specific type byte.
u8 id
Vendor-specific ID: 221.
Probe request frame data.
union ieee80211_ie info_element[0]
List of information elements.
Reassociation request frame data.
u16 listen_interval
Interval at which we wake up, in units of the beacon interval.
u16 capability
Capability flags.
u8 current_addr[ETH_ALEN]
MAC address of current Access Point.
union ieee80211_ie info_element[0]
List of information elements.
16-byte RTS frame format, with abbreviated header
u16 duration
Microseconds to reserve link.
u16 fc
802.11 Frame Control field
u8 addr2[ETH_ALEN]
Address 2 (immediate sender)
u8 addr1[ETH_ALEN]
Address 1 (immediate receiver)
802.11 Country information element regulatory triplet
struct ieee80211_ie_country_ext_triplet ext
Regulatory extension information.
u8 first
Differentiator between band and ext triplets.
struct ieee80211_ie_country_band_triplet band
Information about a band of channels.
Any 802.11 information element.
struct ieee80211_ie_rsn rsn
Security information.
u8 challenge_text[0]
Challenge text data.
u8 request[0]
Request list.
u8 power_constraint
Power constraint, dBm.
struct ieee80211_ie_power_capab power_capab
Power capability.
u8 len
Information element data length.
struct ieee80211_ie_ds_param ds_param
DS parameter set.
struct ieee80211_ie_channels_channel_band channels[0]
List of channels.
struct ieee80211_ie_vendor vendor
Vendor-specific.
u8 erp_info
ERP information flags.
struct ieee80211_ie_country country
Country information.
u8 id
Information element ID.