📄 802.11.h
字号:
/* * Copyright 2005-2006, Broadcom Corporation * All Rights Reserved. * * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. * * Fundamental types and constants relating to 802.11 * * $Id$ */#ifndef _802_11_H_#define _802_11_H_#ifndef _TYPEDEFS_H_#include <typedefs.h>#endif#ifndef _NET_ETHERNET_H_#include <proto/ethernet.h>#endif#include <proto/wpa.h>/* enable structure packing */#if defined(__GNUC__)#define PACKED __attribute__((packed))#else#pragma pack(1)#define PACKED#endif#define DOT11_TU_TO_US 1024 /* 802.11 Time Unit is 1024 microseconds *//* Generic 802.11 frame constants */#define DOT11_A3_HDR_LEN 24 /* d11 header length with A3 */#define DOT11_A4_HDR_LEN 30 /* d11 header length with A4 */#define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN /* MAC header length */#define DOT11_FCS_LEN 4 /* d11 FCS length */#define DOT11_ICV_LEN 4 /* d11 ICV length */#define DOT11_ICV_AES_LEN 8 /* d11 ICV/AES length */#define DOT11_QOS_LEN 2 /* d11 QoS length */#define DOT11_KEY_INDEX_SHIFT 6 /* d11 key index shift */#define DOT11_IV_LEN 4 /* d11 IV length */#define DOT11_IV_TKIP_LEN 8 /* d11 IV TKIP length */#define DOT11_IV_AES_OCB_LEN 4 /* d11 IV/AES/OCB length */#define DOT11_IV_AES_CCM_LEN 8 /* d11 IV/AES/CCM length */#define DOT11_IV_MAX_LEN 8 /* maximum iv len for any encryption *//* Includes MIC */#define DOT11_MAX_MPDU_BODY_LEN 2304 /* max MPDU body length *//* A4 header + QoS + CCMP + PDU + ICV + FCS = 2352 */#define DOT11_MAX_MPDU_LEN (DOT11_A4_HDR_LEN + \ DOT11_QOS_LEN + \ DOT11_IV_AES_CCM_LEN + \ DOT11_MAX_MPDU_BODY_LEN + \ DOT11_ICV_LEN + \ DOT11_FCS_LEN) /* d11 max MPDU length */#define DOT11_MAX_SSID_LEN 32 /* d11 max ssid length *//* dot11RTSThreshold */#define DOT11_DEFAULT_RTS_LEN 2347 /* d11 default RTS length */#define DOT11_MAX_RTS_LEN 2347 /* d11 max RTS length *//* dot11FragmentationThreshold */#define DOT11_MIN_FRAG_LEN 256 /* d11 min fragmentation length */#define DOT11_MAX_FRAG_LEN 2346 /* Max frag is also limited by aMPDUMaxLength * of the attached PHY */#define DOT11_DEFAULT_FRAG_LEN 2346 /* d11 default fragmentation length *//* dot11BeaconPeriod */#define DOT11_MIN_BEACON_PERIOD 1 /* d11 min beacon period */#define DOT11_MAX_BEACON_PERIOD 0xFFFF /* d11 max beacon period *//* dot11DTIMPeriod */#define DOT11_MIN_DTIM_PERIOD 1 /* d11 min DTIM period */#define DOT11_MAX_DTIM_PERIOD 0xFF /* d11 max DTIM period *//* 802.2 LLC/SNAP header used by 802.11 per 802.1H */#define DOT11_LLC_SNAP_HDR_LEN 8 /* d11 LLC/SNAP header length */#define DOT11_OUI_LEN 3 /* d11 OUI length */struct dot11_llc_snap_header { uint8 dsap; /* always 0xAA */ uint8 ssap; /* always 0xAA */ uint8 ctl; /* always 0x03 */ uint8 oui[DOT11_OUI_LEN]; /* RFC1042: 0x00 0x00 0x00 * Bridge-Tunnel: 0x00 0x00 0xF8 */ uint16 type; /* ethertype */} PACKED;/* RFC1042 header used by 802.11 per 802.1H */#define RFC1042_HDR_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN) /* RCF1042 header length *//* Generic 802.11 MAC header *//* * N.B.: This struct reflects the full 4 address 802.11 MAC header. * The fields are defined such that the shorter 1, 2, and 3 * address headers just use the first k fields. */struct dot11_header { uint16 fc; /* frame control */ uint16 durid; /* duration/ID */ struct ether_addr a1; /* address 1 */ struct ether_addr a2; /* address 2 */ struct ether_addr a3; /* address 3 */ uint16 seq; /* sequence control */ struct ether_addr a4; /* address 4 */} PACKED;/* Control frames */struct dot11_rts_frame { uint16 fc; /* frame control */ uint16 durid; /* duration/ID */ struct ether_addr ra; /* receiver address */ struct ether_addr ta; /* transmitter address */} PACKED;#define DOT11_RTS_LEN 16 /* d11 RTS frame length */struct dot11_cts_frame { uint16 fc; /* frame control */ uint16 durid; /* duration/ID */ struct ether_addr ra; /* receiver address */} PACKED;#define DOT11_CTS_LEN 10 /* d11 CTS frame length */struct dot11_ack_frame { uint16 fc; /* frame control */ uint16 durid; /* duration/ID */ struct ether_addr ra; /* receiver address */} PACKED;#define DOT11_ACK_LEN 10 /* d11 ACK frame length */struct dot11_ps_poll_frame { uint16 fc; /* frame control */ uint16 durid; /* AID */ struct ether_addr bssid; /* receiver address, STA in AP */ struct ether_addr ta; /* transmitter address */} PACKED;#define DOT11_PS_POLL_LEN 16 /* d11 PS poll frame length */struct dot11_cf_end_frame { uint16 fc; /* frame control */ uint16 durid; /* duration/ID */ struct ether_addr ra; /* receiver address */ struct ether_addr bssid; /* transmitter address, STA in AP */} PACKED;#define DOT11_CS_END_LEN 16 /* d11 CF-END frame length *//* BA/BAR Control parameters */#define DOT11_BA_CTL_POLICY_NORMAL 0x0000 /* normal ack */#define DOT11_BA_CTL_POLICY_NOACK 0x0001 /* no ack */#define DOT11_BA_CTL_POLICY_MASK 0x0003 /* ack policy mask */#define DOT11_BA_CTL_COMPRESSED 0x0010 /* compressed bitmap */#define DOT11_BA_CTL_NUMMSDU_MASK 0x0FC0 /* num msdu in bitmap mask */#define DOT11_BA_CTL_NUMMSDU_SHIFT 6 /* num msdu in bitmap shift */#define DOT11_BA_CTL_TID_MASK 0xF000 /* tid mask */#define DOT11_BA_CTL_TID_SHIFT 12 /* tid shift */struct dot11_ba_req_frame { uint16 fc; /* frame control */ uint16 durid; /* duration/ID */ struct ether_addr ra; /* receiver address */ struct ether_addr ta; /* transmitter address */ uint16 bar_control; /* BAR Control */ uint16 seqnum; /* Starting Sequence control */} PACKED;#define DOT11_BA_REQ_LEN 20 /* BAR frame length */#define DOT11_BA_BITMAP_LEN 128 /* bitmap length */#define DOT11_BA_CMP_BITMAP_LEN 8 /* compressed bitmap length */struct dot11_ba_frame { uint16 fc; /* frame control */ uint16 durid; /* duration/ID */ struct ether_addr ra; /* receiver address */ struct ether_addr ta; /* transmitter address */ uint16 ba_control; /* BA Control */ uint16 seqnum; /* Starting Sequence control */ uint8 bitmap[DOT11_BA_BITMAP_LEN]; /* Block Ack Bitmap */} PACKED;#define DOT11_BA_LEN 20 /* BA frame length (without bitmap) *//* Management frame header */struct dot11_management_header { uint16 fc; /* frame control */ uint16 durid; /* duration/ID */ struct ether_addr da; /* receiver address */ struct ether_addr sa; /* transmitter address */ struct ether_addr bssid; /* BSS ID */ uint16 seq; /* sequence control */} PACKED;#define DOT11_MGMT_HDR_LEN 24 /* d11 management header length *//* Management frame payloads */struct dot11_bcn_prb { uint32 timestamp[2]; uint16 beacon_interval; uint16 capability;} PACKED;#define DOT11_BCN_PRB_LEN 12 /* d11 beacon probe frame length */struct dot11_auth { uint16 alg; /* algorithm */ uint16 seq; /* sequence control */ uint16 status; /* status code */} PACKED;#define DOT11_AUTH_FIXED_LEN 6 /* length of auth frame without challenge info * elt */struct dot11_assoc_req { uint16 capability; /* capability information */ uint16 listen; /* listen interval */} PACKED;#define DOT11_ASSOC_REQ_FIXED_LEN 4 /* length of assoc frame without info elts */struct dot11_reassoc_req { uint16 capability; /* capability information */ uint16 listen; /* listen interval */ struct ether_addr ap; /* Current AP address */} PACKED;#define DOT11_REASSOC_REQ_FIXED_LEN 10 /* length of assoc frame without info elts */struct dot11_assoc_resp { uint16 capability; /* capability information */ uint16 status; /* status code */ uint16 aid; /* association ID */} PACKED;struct dot11_action_measure { uint8 category; uint8 action; uint8 token; uint8 data[1];} PACKED;#define DOT11_ACTION_MEASURE_LEN 3 /* d11 action measurement header length */struct dot11_action_switch_channel { uint8 category; uint8 action; uint8 data[5]; /* for switch IE */} PACKED;/* ************* 802.11h related definitions. ************* */typedef struct { uint8 id; uint8 len; uint8 power;} dot11_power_cnst_t;typedef struct { uint8 min; uint8 max;} dot11_power_cap_t;typedef struct { uint8 id; uint8 len; uint8 tx_pwr; uint8 margin;} dot11_tpc_rep_t;#define DOT11_MNG_IE_TPC_REPORT_LEN 2 /* length of IE data, not including 2 byte header */typedef struct { uint8 id; uint8 len; uint8 first_channel; uint8 num_channels;} dot11_supp_channels_t;/* channel switch announcement (CSA) mode type - 802.11h-2003 $7.3.2.20 */#define DOT11_CSA_MODE_ADVISORY 0 /* no DOT11_CSA_MODE_NO_TX restriction imposed */#define DOT11_CSA_MODE_NO_TX 1 /* no transmission upon receiving CSA frame. *//* CSA IE data structure */struct dot11_channel_switch { uint8 id; uint8 len; uint8 mode; uint8 channel; uint8 count;} PACKED;typedef struct dot11_channel_switch dot11_channel_switch_t;#define DOT11_SWITCH_IE_LEN 3 /* length of IE data, not including 2 byte header *//* 802.11h Measurement Request/Report IEs *//* Measurement Type field */#define DOT11_MEASURE_TYPE_BASIC 0 /* d11 measurement basic type */#define DOT11_MEASURE_TYPE_CCA 1 /* d11 measurement CCA type */#define DOT11_MEASURE_TYPE_RPI 2 /* d11 measurement PRI type *//* Measurement Mode field *//* Measurement Request Modes */#define DOT11_MEASURE_MODE_ENABLE (1<<1) /* d11 measurement enable */#define DOT11_MEASURE_MODE_REQUEST (1<<2) /* d11 measurement request */#define DOT11_MEASURE_MODE_REPORT (1<<3) /* d11 measurement report *//* Measurement Report Modes */#define DOT11_MEASURE_MODE_LATE (1<<0) /* d11 measurement late */#define DOT11_MEASURE_MODE_INCAPABLE (1<<1) /* d11 measurement incapable */#define DOT11_MEASURE_MODE_REFUSED (1<<2) /* d11 measurement refuse *//* Basic Measurement Map bits */#define DOT11_MEASURE_BASIC_MAP_BSS ((uint8)(1<<0)) /* d11 measurement basic map BSS */#define DOT11_MEASURE_BASIC_MAP_OFDM ((uint8)(1<<1)) /* d11 measurement map OFDM */#define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2)) /* d11 measurement map unknown */#define DOT11_MEASURE_BASIC_MAP_RADAR ((uint8)(1<<3)) /* d11 measurement map radar */#define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4)) /* d11 measurement map unmeasuremnt */typedef struct { uint8 id; uint8 len; uint8 token; uint8 mode; uint8 type; uint8 channel; uint8 start_time[8]; uint16 duration;} dot11_meas_req_t;#define DOT11_MNG_IE_MREQ_LEN 14 /* d11 measurement request IE length *//* length of Measure Request IE data not including variable len */#define DOT11_MNG_IE_MREQ_FIXED_LEN 3 /* d11 measurement request IE fixed length */struct dot11_meas_rep { uint8 id; uint8 len; uint8 token; uint8 mode; uint8 type; union { struct { uint8 channel; uint8 start_time[8]; uint16 duration; uint8 map; } PACKED basic;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -