⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wlanproto.h

📁 Atheros AP Test with Agilent N4010A source code
💻 H
📖 第 1 页 / 共 5 页
字号:
#define LLC_SAP_SNAP 0xAA

/*
 * This header has been added for encapsulating SNA Frames. 
 *
 * This LLC header format is as defined in:
 *   IEEE Std 802.2, 1998 Edition (ISO/IEC 8802-2:1998)
 *   Section 3.2: LLC PDU Structure
 */
typedef struct {
    LAN_FRAME_HEADER lanHeader;
    A_UINT8 dsap;
    A_UINT8 ssap;
    A_UINT8 control;
} __ATTRIB_PACK LAN_LLC_FRAME_HEADER;

typedef struct {
    A_UINT8 dsap;
    A_UINT8 ssap;
    A_UINT8 control;
} __ATTRIB_PACK LAN_LLC_HEADER;

#define CAP_TYPE_SIZE   6
typedef struct capType {
    A_UINT8     octets[CAP_TYPE_SIZE];
} __ATTRIB_PACK CAP_CONST;

typedef struct {
    CAP_CONST   capConst;
    A_UINT16    etherType;
} __ATTRIB_PACK LLC_SNAP_HEADER;

/*
 * Management frames, section 7.2.3
 */

/*
 * MAC header for the management packets is defined separately,
 * since it is common to all of them.
 */

typedef struct wlanMgtMacHeader {
    FRAME_CONTROL frameControl;
    DURATION      durationNav;
    WLAN_MACADDR  destAddr;
    WLAN_MACADDR  srcAddr;
    WLAN_MACADDR  bssId;
    SEQ_CONTROL   seqControl;
} __ATTRIB_PACK WLAN_MGT_MAC_HEADER;

/*
 * The beacon frame is variable length. First 5 fields are
 * always present, but the information elements, i.e. sets
 * of different parameters are present only when the beacon
 * is generated by that type of AP. These sets can be variable
 * size. We just declare 'buffer' field as a place holder. The
 * algorithms should look at the first byte, i.e. element ID,
 * then parse rest of the element and look for the next one.
 */

/*
 * WiFi requires supported beacon interval to be between 20 TU and 1000 TU
 */

#define BEACON_INTERVAL_MIN     20
#define BEACON_INTERVAL_MAX     1000
#define BEACON_INTERVAL_DEFAULT 100
#define IS_VALID_BEACON_INTERVAL(x) ((x) >= BEACON_INTERVAL_MIN && (x) <= BEACON_INTERVAL_MAX)

typedef struct wlanFrameBeacon {
    WLAN_MGT_MAC_HEADER macHeader;      /* Standard mgt header */
    WLAN_TIMESTAMP      timestamp;      /* 64 bit timestamp */
    A_UINT16            beaconInterval; /* Beacon interval in TU */
    CAP_INFO            capInfo;        /* AP capability info set */
    A_UCHAR             buffer[2];      /* Generic buffer. Variable size */
                                        /* data follows */
} __ATTRIB_PACK WLAN_FRAME_BEACON;

/* Atheros Vendor Specific types */
#define ATH_OUI                         0x007f0300
#define IS_ATHEROS_OUI(_oui)            ((_oui)[0] == 0x00 && (_oui)[1] == 0x03 && (_oui)[2] == 0x7f)
#define ATH_OUI_TYPE_CAP                0x01
#define ATH_OUI_TYPE_WME                0x02
#define ATH_OUI_TYPE_XR                 0x03
#define ATH_OUI_VER_CAP                 0x0001
#define ATH_OUI_VER_XR                  0x0001
#define ATH_OUI_SUBTYPE_WME_PARAM       0x01
#define ATH_OUI_VERSION_WME_PARAM       0x01

/* Cipher Suite Selectors, defined such that they go out on the air as little endian */
#define TGI_OUI                         0x000000
#define WPA_OUI                         0x00F25000
#define WPAIE_VERSION                   0x0001
#define AIRONET_OUI                     0x00964000
#define IS_AIRONET_OUI(_oui)            ((_oui)[0] == 0x00 && (_oui)[1] == 0x40 && (_oui)[2] == 0x96)

#define TGI_CSE_NULL                    0x00000000
#define TGI_CSE_WEP                     0x01000000
#define TGI_CSE_TKIP                    0x02000000
#define TGI_CSE_CCM                     0x04000000
#define TGI_CSE_WEP104                  0x05000000

#define WPA_OUI_TYPE                    0x01
#define WPA_CSE_NULL                    ((0x00<<24)|WPA_OUI)
#define WPA_CSE_WEP40                   ((0x01<<24)|WPA_OUI)
#define WPA_CSE_TKIP                    ((0x02<<24)|WPA_OUI)
#define WPA_CSE_AES_CCMP                ((0x04<<24)|WPA_OUI)
#define WPA_CSE_WEP104                  ((0x05<<24)|WPA_OUI)
#define WPA_CSE_CKIP                    ((0x00<<24)|AIRONET_OUI)
#define WPA_CSE_CKIP_MMH                ((0x01<<24)|AIRONET_OUI)
#define WPA_CSE_WEP_MMH                 ((0x02<<24)|AIRONET_OUI)

#define TGI_AUTHSE_NONE                 0x00000000
#define TGI_AUTHSE_8021X_UNSPEC         0x01000000
#define TGI_AUTHSE_8021x_PSK            0x02000000

#define WPA_AUTHSE_NONE                 ((0x00<<24)|WPA_OUI)
#define WPA_AUTHSE_8021X_UNSPEC         ((0x01<<24)|WPA_OUI)
#define WPA_AUTHSE_8021X_PSK            ((0x02<<24)|WPA_OUI)
#define WPA_AUTHSE_CCKM                 ((0x00<<24)|AIRONET_OUI)

#define ATH_CSE_AES_OCB                 0x007f0300
#define ATH_CSE_AES_OCB_REVA            0x017f0300
#define ATH_CSE_AES_CCM                 0x027f0300
#define ATH_CSE_TKIP                    0x107f0300
#define ATH_CSE_BASIC_WEP               0x207f0300
#define ATH_CSE_NULL                    0xff7f0300
#define ATH_CSE_DEFAULT                 0xff7f0300

#define IS_CIPHER_AES_CCM(cse)          \
        ((cse == ATH_CSE_AES_CCM)       \
         || (cse == WPA_CSE_AES_CCMP))

#define IS_CIPHER_WEP(cse)              \
        ((cse == ATH_CSE_BASIC_WEP)     \
         || (cse == WPA_CSE_WEP40)      \
         || (cse == WPA_CSE_WEP104)     )

#define IS_CIPHER_NULL(cse)             \
        ((cse == ATH_CSE_NULL)          \
        || (cse == WPA_CSE_NULL)        )

#define IS_CIPHER_TKIP(cse)             \
        ((cse) == WPA_CSE_TKIP)

#define IS_CIPHER_CKIP_MMH(cse)         \
        ((cse) == WPA_CSE_CKIP_MMH)

#define IS_CIPHER_WEP_MMH(cse)         \
        ((cse) == WPA_CSE_WEP_MMH)

#define IS_CIPHER_CKIP(cse)             \
        ((cse) == WPA_CSE_CKIP          \
        || IS_CIPHER_CKIP_MMH(cse))

/*
 * Status code field values in the management frames 802.11 Spec section 7.3.1.9 */

#define WLAN_SUCCESS                    WLAN_OK /* Successful */
#define WLAN_UNKNOWN_FAILURE            1       /* Unspecified failure */
#define WLAN_UNSUPPORTED_CAP            10      /* Can't support all requested */
                                                /* capabilities */
#define WLAN_UNCONFIRMED_ASSOC          11      /* Can't confirm current association */
#define WLAN_OUT_OF_SCOPE               12      /* Association denied due to a reason */
                                                /* outside the scope of 802.11 standard */
#define WLAN_UNSUPPORTED_ALG            13      /* Unsupported algorithm */
#define WLAN_OUT_OF_SEQUENCE            14      /* Authentication frame out of sequence */
#define WLAN_CHLG_FAILURE               15      /* Challenge failure in authentication */
#define WLAN_AUTH_TIMEOUT               16      /* Auth timeout waiting for next frame */
#define WLAN_TOOMANY_ASSOC              17      /* AP not able to handle more assoc */
#define WLAN_UNSUPPORTED_RATE           18      /* Requesting station doesn't support */
                                                /* all the rates in BSSBasicRateSet */
#define WLAN_NO_SHORT_PREAMBLE          19      /* Requesting station doesn't support short preamble */
#define WLAN_NO_PBCC                    20      /* Requesting station doesn't support PBCC */
#define WLAN_NO_CHANNEL_AGILITY         21      /* Requesting station doesn't support channel agility */

/* Reason Code values for Disassoc and Deauth frames 802.11 Spec section 7.3.1.7 */

#define REASON_RESERVED                 0       /* Reserved */
#define REASON_UNSPECIFIED              1       /* Unspecified reason */
#define REASON_AUTH_EXPIRED             2       /* Past authentication no longer valid */
#define REASON_AUTH_LEAVING             3       /* Sending station leaving BSS */
#define REASON_INACTIVE                 4       /* Disassocd due to inactivity */
#define REASON_TOOMANY_ASSOC            5       /* AP not able to handle all assoc's */
#define REASON_CLASS2                   6       /* Class 2 frame received from non-auth */
#define REASON_CLASS3                   7       /* Class 3 frame received from non-assoc */
#define REASON_ASSOC_LEAVING            8       /* Sending station leaving BSS */
#define REASON_NOT_AUTH                 9       /* Sender not auth'ed before requesting */
                                                /* association */
                                                /* 10 reserved codes */
#define REASON_RSN_REQUIRED             11      /* Enhanced Security required by IE */
#define REASON_RSN_INCONSISTENT         12      /* Enhanced Security used inconsistently */
#define REASON_IE_INVALID               13      /* Invalid Information Element */
#define REASON_MIC_FAILURE              14      /* MIC failure */
                                                /* 15 - 65535 reserved codes */

#define ASSOCID_MIN                     1       /* Min value of Association ID */
#define ASSOCID_MAX                     2007    /* Max value of Association ID */

typedef struct wlanFrameDisassoc {
    WLAN_MGT_MAC_HEADER macHeader;      /* Standard mgt header */
    A_UINT16            reasonCode;     /* Reason for action */
} __ATTRIB_PACK WLAN_FRAME_DISASSOC;

/* Associate request frame. SSID and supported rates elements
 * are variable size. Hence, you should compute correct offset
 * to actual rates field. This structure assumes max size ssid
 * and rateSet fields.
 */
typedef struct wlanFrameAssocReq {
    WLAN_MGT_MAC_HEADER macHeader;      /* Standard mgt header */
    CAP_INFO            capInfo;        /* capability information */
    A_UINT16            listenInterval; /* interval value in TU */
    SSID                ssid;           /* SSID, variable size */
    RATE_SET            rateSet;        /* rates element */
    EXT_RATE_SET        extRateSet;     /* extended rates element */
} __ATTRIB_PACK WLAN_FRAME_ASSOC_REQ;

/* Associate response frame. Supported rates elements
 * is variable size.
 */
typedef struct wlanFrameAssocResp {
        WLAN_MGT_MAC_HEADER macHeader;  /* Standard mgt header */
        CAP_INFO        capInfo;        /* capability information */
        A_UINT16        statusCode;     /* status code */
        A_UINT16        assocId;        /* association ID */
        RATE_SET        rateSet;        /* rates element */
        EXT_RATE_SET    extRateSet;     /* extended rates element */
} __ATTRIB_PACK WLAN_FRAME_ASSOC_RESP;


/* Reassociate request frame. SSID and supported rates elements
 * are variable size. Hence, you should compute correct offset
 * to actual rates field. This structure assumes max size ssid
 * field.
 */
typedef struct wlanFrameReassocReq {
    WLAN_MGT_MAC_HEADER macHeader;      /* Standard mgt header */
    CAP_INFO            capInfo;        /* capability information */
    A_UINT16            listenInterval; /* interval value in TU */
    WLAN_MACADDR        curAPAddr;      /* Current AP Address */
    SSID                ssid;           /* SSID, variable size */
    RATE_SET            rateSet;        /* rates element */
    EXT_RATE_SET        extRateSet;     /* extended rates element */
} __ATTRIB_PACK WLAN_FRAME_REASSOC_REQ;

/* Frames for associate and reassociate response are the same */

typedef WLAN_FRAME_ASSOC_RESP   WLAN_FRAME_REASSOC_RESP;

/* Probe request frame. SSID and supported rates elements
 * are variable size. Hence, you should compute correct offset
 * to actual rates field. This structure assumes max size ssid
 * field.
 */
typedef struct wlanFrameProbeReq {
    WLAN_MGT_MAC_HEADER macHeader;      /* Standard mgt header */
    SSID                ssid;           /* SSID, variable size */
    RATE_SET            rateSet;        /* rates element */
    EXT_RATE_SET        extRateSet;     /* extended rates element */
} __ATTRIB_PACK WLAN_FRAME_PROBE_REQ;

/*
 * The probe response frame is variable length. First 5 fields are
 * always present, but the information elements, i.e. sets
 * of different parameters are present only when the frame
 * is generated by that type of AP. These sets can be variable
 * size. We just declare 'buffer' field as a place holder. The
 * algorithms should look at the first byte, i.e. element ID,
 * then parse rest of the element and look for the next one.
 */

typedef struct wlanFrameProbeResp {
    WLAN_MGT_MAC_HEADER macHeader;      /* Standard mgt header */
    WLAN_TIMESTAMP      timestamp;      /* 64 bit timestamp */
    A_UINT16            beaconInterval; /* Beacon interval in TU */
    CAP_INFO            capInfo;        /* AP capability info set */
    A_UCHAR             buffer[2];      /* Generic buffer. Variable size */
                                        /* data follows */
} __ATTRIB_PACK WLAN_FRAME_PROBE_RESP;

/* Two authentication algorithms are currently defined */
/* Use them in the field algNo of authentication frames */

#define AUTH_OPEN_SYSTEM        (A_UINT16)0     /* Open systems, no encryption */
#define AUTH_SHARED_KEY         (A_UINT16)1     /* Shared key, use WEP */
#define AUTH_SHARED_KEY_CHLG_SIZE       128     /* Section 8.1.2.2, 128 byte challenge */
#define AUTH_LEAP                       0x80
                                                /* text for shared key authentication */
/*
 * Authentication frames
 */

/*
 * Structure for #1 and #4 frames, no encryption fields.
 */

typedef struct wlanFrameAuth {
    WLAN_MGT_MAC_HEADER macHeader;      /* Standard mgt header */
    A_UINT16            algNo;          /* Algorithm number */
    A_UINT16            transSeqNo;     /* Authentication transaction */
                                        /* sequence number */
    A_UINT16            statusCode;     /* Status (result) code */
} __ATTRIB_PACK WLAN_FRAME_AUTH;

/*
 * Structure for #2 frame, challenge text, but no encryption or IV
 */

typedef struct wlanFrameAuthChlg {
        WLAN_MGT_MAC_HEADER macHeader;  /* Standard mgt header */
        A_UINT16            algNo;      /* Algorithm number */
        A_UINT16            transSeqNo; /* Authentication transaction */
                                        /* sequence number */
        A_UINT16            statusCode; /* Status (result) code */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -