iPXE
Data Structures | Defines | Typedefs | Functions
p80211hdr.h File Reference
#include <wlan/wlan_compat.h>

Go to the source code of this file.

Data Structures

struct  p80211_hdr_a3
struct  p80211_hdr_a4
union  p80211_hdr

Defines

#define _P80211HDR_H
#define WLAN_ADDR_LEN   6
#define WLAN_CRC_LEN   4
#define WLAN_BSSID_LEN   6
#define WLAN_BSS_TS_LEN   8
#define WLAN_HDR_A3_LEN   24
#define WLAN_HDR_A4_LEN   30
#define WLAN_SSID_MAXLEN   32
#define WLAN_DATA_MAXLEN   2312
#define WLAN_A3FR_MAXLEN   (WLAN_HDR_A3_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN)
#define WLAN_A4FR_MAXLEN   (WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN)
#define WLAN_BEACON_FR_MAXLEN   (WLAN_HDR_A3_LEN + 334)
#define WLAN_ATIM_FR_MAXLEN   (WLAN_HDR_A3_LEN + 0)
#define WLAN_DISASSOC_FR_MAXLEN   (WLAN_HDR_A3_LEN + 2)
#define WLAN_ASSOCREQ_FR_MAXLEN   (WLAN_HDR_A3_LEN + 48)
#define WLAN_ASSOCRESP_FR_MAXLEN   (WLAN_HDR_A3_LEN + 16)
#define WLAN_REASSOCREQ_FR_MAXLEN   (WLAN_HDR_A3_LEN + 54)
#define WLAN_REASSOCRESP_FR_MAXLEN   (WLAN_HDR_A3_LEN + 16)
#define WLAN_PROBEREQ_FR_MAXLEN   (WLAN_HDR_A3_LEN + 44)
#define WLAN_PROBERESP_FR_MAXLEN   (WLAN_HDR_A3_LEN + 78)
#define WLAN_AUTHEN_FR_MAXLEN   (WLAN_HDR_A3_LEN + 261)
#define WLAN_DEAUTHEN_FR_MAXLEN   (WLAN_HDR_A3_LEN + 2)
#define WLAN_WEP_NKEYS   4
#define WLAN_WEP_MAXKEYLEN   13
#define WLAN_CHALLENGE_IE_LEN   130
#define WLAN_CHALLENGE_LEN   128
#define WLAN_WEP_IV_LEN   4
#define WLAN_WEP_ICV_LEN   4
#define WLAN_FTYPE_MGMT   0x00
#define WLAN_FTYPE_CTL   0x01
#define WLAN_FTYPE_DATA   0x02
#define WLAN_FSTYPE_ASSOCREQ   0x00
#define WLAN_FSTYPE_ASSOCRESP   0x01
#define WLAN_FSTYPE_REASSOCREQ   0x02
#define WLAN_FSTYPE_REASSOCRESP   0x03
#define WLAN_FSTYPE_PROBEREQ   0x04
#define WLAN_FSTYPE_PROBERESP   0x05
#define WLAN_FSTYPE_BEACON   0x08
#define WLAN_FSTYPE_ATIM   0x09
#define WLAN_FSTYPE_DISASSOC   0x0a
#define WLAN_FSTYPE_AUTHEN   0x0b
#define WLAN_FSTYPE_DEAUTHEN   0x0c
#define WLAN_FSTYPE_BLOCKACKREQ   0x8
#define WLAN_FSTYPE_BLOCKACK   0x9
#define WLAN_FSTYPE_PSPOLL   0x0a
#define WLAN_FSTYPE_RTS   0x0b
#define WLAN_FSTYPE_CTS   0x0c
#define WLAN_FSTYPE_ACK   0x0d
#define WLAN_FSTYPE_CFEND   0x0e
#define WLAN_FSTYPE_CFENDCFACK   0x0f
#define WLAN_FSTYPE_DATAONLY   0x00
#define WLAN_FSTYPE_DATA_CFACK   0x01
#define WLAN_FSTYPE_DATA_CFPOLL   0x02
#define WLAN_FSTYPE_DATA_CFACK_CFPOLL   0x03
#define WLAN_FSTYPE_NULL   0x04
#define WLAN_FSTYPE_CFACK   0x05
#define WLAN_FSTYPE_CFPOLL   0x06
#define WLAN_FSTYPE_CFACK_CFPOLL   0x07
#define WLAN_GET_FC_PVER(n)   (((uint16_t)(n)) & (BIT0 | BIT1))
#define WLAN_GET_FC_FTYPE(n)   ((((uint16_t)(n)) & (BIT2 | BIT3)) >> 2)
#define WLAN_GET_FC_FSTYPE(n)   ((((uint16_t)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4)
#define WLAN_GET_FC_TODS(n)   ((((uint16_t)(n)) & (BIT8)) >> 8)
#define WLAN_GET_FC_FROMDS(n)   ((((uint16_t)(n)) & (BIT9)) >> 9)
#define WLAN_GET_FC_MOREFRAG(n)   ((((uint16_t)(n)) & (BIT10)) >> 10)
#define WLAN_GET_FC_RETRY(n)   ((((uint16_t)(n)) & (BIT11)) >> 11)
#define WLAN_GET_FC_PWRMGT(n)   ((((uint16_t)(n)) & (BIT12)) >> 12)
#define WLAN_GET_FC_MOREDATA(n)   ((((uint16_t)(n)) & (BIT13)) >> 13)
#define WLAN_GET_FC_ISWEP(n)   ((((uint16_t)(n)) & (BIT14)) >> 14)
#define WLAN_GET_FC_ORDER(n)   ((((uint16_t)(n)) & (BIT15)) >> 15)
#define WLAN_SET_FC_PVER(n)   ((uint16_t)(n))
#define WLAN_SET_FC_FTYPE(n)   (((uint16_t)(n)) << 2)
#define WLAN_SET_FC_FSTYPE(n)   (((uint16_t)(n)) << 4)
#define WLAN_SET_FC_TODS(n)   (((uint16_t)(n)) << 8)
#define WLAN_SET_FC_FROMDS(n)   (((uint16_t)(n)) << 9)
#define WLAN_SET_FC_MOREFRAG(n)   (((uint16_t)(n)) << 10)
#define WLAN_SET_FC_RETRY(n)   (((uint16_t)(n)) << 11)
#define WLAN_SET_FC_PWRMGT(n)   (((uint16_t)(n)) << 12)
#define WLAN_SET_FC_MOREDATA(n)   (((uint16_t)(n)) << 13)
#define WLAN_SET_FC_ISWEP(n)   (((uint16_t)(n)) << 14)
#define WLAN_SET_FC_ORDER(n)   (((uint16_t)(n)) << 15)
#define WLAN_GET_SEQ_FRGNUM(n)   (((uint16_t)(n)) & (BIT0|BIT1|BIT2|BIT3))
#define WLAN_GET_SEQ_SEQNUM(n)   ((((uint16_t)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4)
#define WLAN_HDR_A3_DATAP(p)   (((uint8_t*)(p)) + WLAN_HDR_A3_LEN)
#define WLAN_HDR_A4_DATAP(p)   (((uint8_t*)(p)) + WLAN_HDR_A4_LEN)
#define DOT11_RATE5_ISBASIC_GET(r)   (((uint8_t)(r)) & BIT7)
#define WLAN_CTL_FRAMELEN(fstype)
#define WLAN_FCS_LEN   4

Typedefs

typedef uint8_t wlan_bss_ts_t [WLAN_BSS_TS_LEN]
typedef struct p80211_hdr_a3 p80211_hdr_a3_t
typedef struct p80211_hdr_a4 p80211_hdr_a4_t
typedef union p80211_hdr p80211_hdr_t

Functions

 FILE_LICENCE (GPL2_ONLY)
static uint16_t p80211_headerlen (uint16_t fctl)

Define Documentation

#define _P80211HDR_H

Definition at line 63 of file p80211hdr.h.

#define WLAN_ADDR_LEN   6

Definition at line 80 of file p80211hdr.h.

Referenced by p80211_headerlen(), and prism2_transmit().

#define WLAN_CRC_LEN   4

Definition at line 81 of file p80211hdr.h.

#define WLAN_BSSID_LEN   6

Definition at line 82 of file p80211hdr.h.

Referenced by prism2_probe().

#define WLAN_BSS_TS_LEN   8

Definition at line 83 of file p80211hdr.h.

#define WLAN_HDR_A3_LEN   24

Definition at line 84 of file p80211hdr.h.

Referenced by p80211_headerlen().

#define WLAN_HDR_A4_LEN   30

Definition at line 85 of file p80211hdr.h.

#define WLAN_SSID_MAXLEN   32

Definition at line 86 of file p80211hdr.h.

#define WLAN_DATA_MAXLEN   2312

Definition at line 87 of file p80211hdr.h.

Referenced by prism2_probe().

Definition at line 88 of file p80211hdr.h.

Definition at line 89 of file p80211hdr.h.

#define WLAN_BEACON_FR_MAXLEN   (WLAN_HDR_A3_LEN + 334)

Definition at line 90 of file p80211hdr.h.

Definition at line 91 of file p80211hdr.h.

Definition at line 92 of file p80211hdr.h.

Definition at line 93 of file p80211hdr.h.

Definition at line 94 of file p80211hdr.h.

Definition at line 95 of file p80211hdr.h.

Definition at line 96 of file p80211hdr.h.

Definition at line 97 of file p80211hdr.h.

Definition at line 98 of file p80211hdr.h.

#define WLAN_AUTHEN_FR_MAXLEN   (WLAN_HDR_A3_LEN + 261)

Definition at line 99 of file p80211hdr.h.

Definition at line 100 of file p80211hdr.h.

#define WLAN_WEP_NKEYS   4

Definition at line 101 of file p80211hdr.h.

#define WLAN_WEP_MAXKEYLEN   13

Definition at line 102 of file p80211hdr.h.

#define WLAN_CHALLENGE_IE_LEN   130

Definition at line 103 of file p80211hdr.h.

#define WLAN_CHALLENGE_LEN   128

Definition at line 104 of file p80211hdr.h.

#define WLAN_WEP_IV_LEN   4

Definition at line 105 of file p80211hdr.h.

#define WLAN_WEP_ICV_LEN   4

Definition at line 106 of file p80211hdr.h.

#define WLAN_FTYPE_MGMT   0x00

Definition at line 110 of file p80211hdr.h.

Referenced by p80211_headerlen().

#define WLAN_FTYPE_CTL   0x01

Definition at line 111 of file p80211hdr.h.

Referenced by p80211_headerlen().

#define WLAN_FTYPE_DATA   0x02

Definition at line 112 of file p80211hdr.h.

Referenced by p80211_headerlen(), and prism2_transmit().

#define WLAN_FSTYPE_ASSOCREQ   0x00

Definition at line 116 of file p80211hdr.h.

#define WLAN_FSTYPE_ASSOCRESP   0x01

Definition at line 117 of file p80211hdr.h.

#define WLAN_FSTYPE_REASSOCREQ   0x02

Definition at line 118 of file p80211hdr.h.

#define WLAN_FSTYPE_REASSOCRESP   0x03

Definition at line 119 of file p80211hdr.h.

#define WLAN_FSTYPE_PROBEREQ   0x04

Definition at line 120 of file p80211hdr.h.

#define WLAN_FSTYPE_PROBERESP   0x05

Definition at line 121 of file p80211hdr.h.

#define WLAN_FSTYPE_BEACON   0x08

Definition at line 122 of file p80211hdr.h.

#define WLAN_FSTYPE_ATIM   0x09

Definition at line 123 of file p80211hdr.h.

#define WLAN_FSTYPE_DISASSOC   0x0a

Definition at line 124 of file p80211hdr.h.

#define WLAN_FSTYPE_AUTHEN   0x0b

Definition at line 125 of file p80211hdr.h.

#define WLAN_FSTYPE_DEAUTHEN   0x0c

Definition at line 126 of file p80211hdr.h.

#define WLAN_FSTYPE_BLOCKACKREQ   0x8

Definition at line 129 of file p80211hdr.h.

#define WLAN_FSTYPE_BLOCKACK   0x9

Definition at line 130 of file p80211hdr.h.

#define WLAN_FSTYPE_PSPOLL   0x0a

Definition at line 131 of file p80211hdr.h.

#define WLAN_FSTYPE_RTS   0x0b

Definition at line 132 of file p80211hdr.h.

#define WLAN_FSTYPE_CTS   0x0c

Definition at line 133 of file p80211hdr.h.

#define WLAN_FSTYPE_ACK   0x0d

Definition at line 134 of file p80211hdr.h.

#define WLAN_FSTYPE_CFEND   0x0e

Definition at line 135 of file p80211hdr.h.

#define WLAN_FSTYPE_CFENDCFACK   0x0f

Definition at line 136 of file p80211hdr.h.

#define WLAN_FSTYPE_DATAONLY   0x00

Definition at line 139 of file p80211hdr.h.

Referenced by prism2_transmit().

#define WLAN_FSTYPE_DATA_CFACK   0x01

Definition at line 140 of file p80211hdr.h.

#define WLAN_FSTYPE_DATA_CFPOLL   0x02

Definition at line 141 of file p80211hdr.h.

#define WLAN_FSTYPE_DATA_CFACK_CFPOLL   0x03

Definition at line 142 of file p80211hdr.h.

#define WLAN_FSTYPE_NULL   0x04

Definition at line 143 of file p80211hdr.h.

#define WLAN_FSTYPE_CFACK   0x05

Definition at line 144 of file p80211hdr.h.

#define WLAN_FSTYPE_CFPOLL   0x06

Definition at line 145 of file p80211hdr.h.

#define WLAN_FSTYPE_CFACK_CFPOLL   0x07

Definition at line 146 of file p80211hdr.h.

#define WLAN_GET_FC_PVER (   n)    (((uint16_t)(n)) & (BIT0 | BIT1))

Definition at line 171 of file p80211hdr.h.

#define WLAN_GET_FC_FTYPE (   n)    ((((uint16_t)(n)) & (BIT2 | BIT3)) >> 2)

Definition at line 172 of file p80211hdr.h.

Referenced by p80211_headerlen().

#define WLAN_GET_FC_FSTYPE (   n)    ((((uint16_t)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4)

Definition at line 173 of file p80211hdr.h.

Referenced by p80211_headerlen().

#define WLAN_GET_FC_TODS (   n)    ((((uint16_t)(n)) & (BIT8)) >> 8)

Definition at line 174 of file p80211hdr.h.

Referenced by p80211_headerlen().

#define WLAN_GET_FC_FROMDS (   n)    ((((uint16_t)(n)) & (BIT9)) >> 9)

Definition at line 175 of file p80211hdr.h.

Referenced by p80211_headerlen().

#define WLAN_GET_FC_MOREFRAG (   n)    ((((uint16_t)(n)) & (BIT10)) >> 10)

Definition at line 176 of file p80211hdr.h.

#define WLAN_GET_FC_RETRY (   n)    ((((uint16_t)(n)) & (BIT11)) >> 11)

Definition at line 177 of file p80211hdr.h.

#define WLAN_GET_FC_PWRMGT (   n)    ((((uint16_t)(n)) & (BIT12)) >> 12)

Definition at line 178 of file p80211hdr.h.

#define WLAN_GET_FC_MOREDATA (   n)    ((((uint16_t)(n)) & (BIT13)) >> 13)

Definition at line 179 of file p80211hdr.h.

#define WLAN_GET_FC_ISWEP (   n)    ((((uint16_t)(n)) & (BIT14)) >> 14)

Definition at line 180 of file p80211hdr.h.

#define WLAN_GET_FC_ORDER (   n)    ((((uint16_t)(n)) & (BIT15)) >> 15)

Definition at line 181 of file p80211hdr.h.

#define WLAN_SET_FC_PVER (   n)    ((uint16_t)(n))

Definition at line 183 of file p80211hdr.h.

#define WLAN_SET_FC_FTYPE (   n)    (((uint16_t)(n)) << 2)

Definition at line 184 of file p80211hdr.h.

Referenced by prism2_transmit().

#define WLAN_SET_FC_FSTYPE (   n)    (((uint16_t)(n)) << 4)

Definition at line 185 of file p80211hdr.h.

Referenced by prism2_transmit().

#define WLAN_SET_FC_TODS (   n)    (((uint16_t)(n)) << 8)

Definition at line 186 of file p80211hdr.h.

Referenced by prism2_transmit().

#define WLAN_SET_FC_FROMDS (   n)    (((uint16_t)(n)) << 9)

Definition at line 187 of file p80211hdr.h.

#define WLAN_SET_FC_MOREFRAG (   n)    (((uint16_t)(n)) << 10)

Definition at line 188 of file p80211hdr.h.

#define WLAN_SET_FC_RETRY (   n)    (((uint16_t)(n)) << 11)

Definition at line 189 of file p80211hdr.h.

#define WLAN_SET_FC_PWRMGT (   n)    (((uint16_t)(n)) << 12)

Definition at line 190 of file p80211hdr.h.

#define WLAN_SET_FC_MOREDATA (   n)    (((uint16_t)(n)) << 13)

Definition at line 191 of file p80211hdr.h.

#define WLAN_SET_FC_ISWEP (   n)    (((uint16_t)(n)) << 14)

Definition at line 192 of file p80211hdr.h.

#define WLAN_SET_FC_ORDER (   n)    (((uint16_t)(n)) << 15)

Definition at line 193 of file p80211hdr.h.

#define WLAN_GET_SEQ_FRGNUM (   n)    (((uint16_t)(n)) & (BIT0|BIT1|BIT2|BIT3))

Definition at line 206 of file p80211hdr.h.

#define WLAN_GET_SEQ_SEQNUM (   n)    ((((uint16_t)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4)

Definition at line 207 of file p80211hdr.h.

#define WLAN_HDR_A3_DATAP (   p)    (((uint8_t*)(p)) + WLAN_HDR_A3_LEN)

Definition at line 213 of file p80211hdr.h.

#define WLAN_HDR_A4_DATAP (   p)    (((uint8_t*)(p)) + WLAN_HDR_A4_LEN)

Definition at line 214 of file p80211hdr.h.

#define DOT11_RATE5_ISBASIC_GET (   r)    (((uint8_t)(r)) & BIT7)

Definition at line 216 of file p80211hdr.h.

#define WLAN_CTL_FRAMELEN (   fstype)
Value:
(\
        (fstype) == WLAN_FSTYPE_BLOCKACKREQ     ? 24 : \
        (fstype) == WLAN_FSTYPE_BLOCKACK        ? 152 : \
        (fstype) == WLAN_FSTYPE_PSPOLL          ? 20 : \
        (fstype) == WLAN_FSTYPE_RTS             ? 20 : \
        (fstype) == WLAN_FSTYPE_CTS             ? 14 : \
        (fstype) == WLAN_FSTYPE_ACK             ? 14 : \
        (fstype) == WLAN_FSTYPE_CFEND           ? 20 : \
        (fstype) == WLAN_FSTYPE_CFENDCFACK      ? 20 : 4)

Definition at line 263 of file p80211hdr.h.

Referenced by p80211_headerlen().

#define WLAN_FCS_LEN   4

Definition at line 273 of file p80211hdr.h.

Referenced by p80211_headerlen().


Typedef Documentation

Definition at line 222 of file p80211hdr.h.

typedef union p80211_hdr p80211_hdr_t

Function Documentation

FILE_LICENCE ( GPL2_ONLY  )
static uint16_t p80211_headerlen ( uint16_t  fctl) [inline, static]

Definition at line 276 of file p80211hdr.h.

References WLAN_ADDR_LEN, WLAN_CTL_FRAMELEN, WLAN_FCS_LEN, WLAN_FTYPE_CTL, WLAN_FTYPE_DATA, WLAN_FTYPE_MGMT, WLAN_GET_FC_FROMDS, WLAN_GET_FC_FSTYPE, WLAN_GET_FC_FTYPE, WLAN_GET_FC_TODS, and WLAN_HDR_A3_LEN.

{
        uint16_t hdrlen = 0;

        switch ( WLAN_GET_FC_FTYPE(fctl) ) {
        case WLAN_FTYPE_MGMT:
                hdrlen = WLAN_HDR_A3_LEN;
                break;
        case WLAN_FTYPE_DATA:
                hdrlen = WLAN_HDR_A3_LEN;
                if ( WLAN_GET_FC_TODS(fctl) && WLAN_GET_FC_FROMDS(fctl) ) {
                        hdrlen += WLAN_ADDR_LEN;
                }
                break;
        case WLAN_FTYPE_CTL:
                hdrlen = WLAN_CTL_FRAMELEN(WLAN_GET_FC_FSTYPE(fctl)) -
                        WLAN_FCS_LEN;
                break;
        default:
                hdrlen = WLAN_HDR_A3_LEN;
        }

        return hdrlen;
}