first commit

This commit is contained in:
Your Name
2026-02-07 20:22:48 +08:00
commit 1b9711d5e4
2270 changed files with 805872 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,27 @@
/*
* BT-AMP (BlueTooth Alternate Mac and Phy) 802.11 PAL (Protocol Adaptation Layer)
*
* $Copyright Open Broadcom Corporation$
*
* $Id: 802.11_bta.h 294267 2011-11-04 23:41:52Z $
*/
#ifndef _802_11_BTA_H_
#define _802_11_BTA_H_
#define BT_SIG_SNAP_MPROT "\xAA\xAA\x03\x00\x19\x58"
/* BT-AMP 802.11 PAL Protocols */
#define BTA_PROT_L2CAP 1
#define BTA_PROT_ACTIVITY_REPORT 2
#define BTA_PROT_SECURITY 3
#define BTA_PROT_LINK_SUPERVISION_REQUEST 4
#define BTA_PROT_LINK_SUPERVISION_REPLY 5
/* BT-AMP 802.11 PAL AMP_ASSOC Type IDs */
#define BTA_TYPE_ID_MAC_ADDRESS 1
#define BTA_TYPE_ID_PREFERRED_CHANNELS 2
#define BTA_TYPE_ID_CONNECTED_CHANNELS 3
#define BTA_TYPE_ID_CAPABILITIES 4
#define BTA_TYPE_ID_VERSION 5
#endif /* _802_11_bta_h_ */

View File

@@ -0,0 +1,123 @@
/*
* 802.11e protocol header file
*
* $Copyright Open Broadcom Corporation$
*
* $Id: 802.11e.h 365823 2012-10-31 04:24:30Z jerryko $
*/
#ifndef _802_11e_H_
#define _802_11e_H_
#ifndef _TYPEDEFS_H_
#include <typedefs.h>
#endif
/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
#ifdef BCMDBG
extern const char * const aci_names[];
#endif /* BCMDBG */
/* WME Traffic Specification (TSPEC) element */
#define WME_TSPEC_HDR_LEN 2 /* WME TSPEC header length */
#define WME_TSPEC_BODY_OFF 2 /* WME TSPEC body offset */
#define WME_CATEGORY_CODE_OFFSET 0 /* WME Category code offset */
#define WME_ACTION_CODE_OFFSET 1 /* WME Action code offset */
#define WME_TOKEN_CODE_OFFSET 2 /* WME Token code offset */
#define WME_STATUS_CODE_OFFSET 3 /* WME Status code offset */
BWL_PRE_PACKED_STRUCT struct tsinfo {
uint8 octets[3];
} BWL_POST_PACKED_STRUCT;
typedef struct tsinfo tsinfo_t;
/* 802.11e TSPEC IE */
typedef BWL_PRE_PACKED_STRUCT struct tspec {
uint8 oui[DOT11_OUI_LEN]; /* WME_OUI */
uint8 type; /* WME_TYPE */
uint8 subtype; /* WME_SUBTYPE_TSPEC */
uint8 version; /* WME_VERSION */
tsinfo_t tsinfo; /* TS Info bit field */
uint16 nom_msdu_size; /* (Nominal or fixed) MSDU Size (bytes) */
uint16 max_msdu_size; /* Maximum MSDU Size (bytes) */
uint32 min_srv_interval; /* Minimum Service Interval (us) */
uint32 max_srv_interval; /* Maximum Service Interval (us) */
uint32 inactivity_interval; /* Inactivity Interval (us) */
uint32 suspension_interval; /* Suspension Interval (us) */
uint32 srv_start_time; /* Service Start Time (us) */
uint32 min_data_rate; /* Minimum Data Rate (bps) */
uint32 mean_data_rate; /* Mean Data Rate (bps) */
uint32 peak_data_rate; /* Peak Data Rate (bps) */
uint32 max_burst_size; /* Maximum Burst Size (bytes) */
uint32 delay_bound; /* Delay Bound (us) */
uint32 min_phy_rate; /* Minimum PHY Rate (bps) */
uint16 surplus_bw; /* Surplus Bandwidth Allowance (range 1.0-8.0) */
uint16 medium_time; /* Medium Time (32 us/s periods) */
} BWL_POST_PACKED_STRUCT tspec_t;
#define WME_TSPEC_LEN (sizeof(tspec_t)) /* not including 2-bytes of header */
/* ts_info */
/* 802.1D priority is duplicated - bits 13-11 AND bits 3-1 */
#define TS_INFO_TID_SHIFT 1 /* TS info. TID shift */
#define TS_INFO_TID_MASK (0xf << TS_INFO_TID_SHIFT) /* TS info. TID mask */
#define TS_INFO_CONTENTION_SHIFT 7 /* TS info. contention shift */
#define TS_INFO_CONTENTION_MASK (0x1 << TS_INFO_CONTENTION_SHIFT) /* TS info. contention mask */
#define TS_INFO_DIRECTION_SHIFT 5 /* TS info. direction shift */
#define TS_INFO_DIRECTION_MASK (0x3 << TS_INFO_DIRECTION_SHIFT) /* TS info. direction mask */
#define TS_INFO_PSB_SHIFT 2 /* TS info. PSB bit Shift */
#define TS_INFO_PSB_MASK (1 << TS_INFO_PSB_SHIFT) /* TS info. PSB mask */
#define TS_INFO_UPLINK (0 << TS_INFO_DIRECTION_SHIFT) /* TS info. uplink */
#define TS_INFO_DOWNLINK (1 << TS_INFO_DIRECTION_SHIFT) /* TS info. downlink */
#define TS_INFO_BIDIRECTIONAL (3 << TS_INFO_DIRECTION_SHIFT) /* TS info. bidirectional */
#define TS_INFO_USER_PRIO_SHIFT 3 /* TS info. user priority shift */
/* TS info. user priority mask */
#define TS_INFO_USER_PRIO_MASK (0x7 << TS_INFO_USER_PRIO_SHIFT)
/* Macro to get/set bit(s) field in TSINFO */
#define WLC_CAC_GET_TID(pt) ((((pt).octets[0]) & TS_INFO_TID_MASK) >> TS_INFO_TID_SHIFT)
#define WLC_CAC_GET_DIR(pt) ((((pt).octets[0]) & \
TS_INFO_DIRECTION_MASK) >> TS_INFO_DIRECTION_SHIFT)
#define WLC_CAC_GET_PSB(pt) ((((pt).octets[1]) & TS_INFO_PSB_MASK) >> TS_INFO_PSB_SHIFT)
#define WLC_CAC_GET_USER_PRIO(pt) ((((pt).octets[1]) & \
TS_INFO_USER_PRIO_MASK) >> TS_INFO_USER_PRIO_SHIFT)
#define WLC_CAC_SET_TID(pt, id) ((((pt).octets[0]) & (~TS_INFO_TID_MASK)) | \
((id) << TS_INFO_TID_SHIFT))
#define WLC_CAC_SET_USER_PRIO(pt, prio) ((((pt).octets[0]) & (~TS_INFO_USER_PRIO_MASK)) | \
((prio) << TS_INFO_USER_PRIO_SHIFT))
/* 802.11e QBSS Load IE */
#define QBSS_LOAD_IE_LEN 5 /* QBSS Load IE length */
#define QBSS_LOAD_AAC_OFF 3 /* AAC offset in IE */
#define CAC_ADDTS_RESP_TIMEOUT 1000 /* default ADDTS response timeout in ms */
/* DEFVAL dot11ADDTSResponseTimeout = 1s */
/* 802.11e ADDTS status code */
#define DOT11E_STATUS_ADMISSION_ACCEPTED 0 /* TSPEC Admission accepted status */
#define DOT11E_STATUS_ADDTS_INVALID_PARAM 1 /* TSPEC invalid parameter status */
#define DOT11E_STATUS_ADDTS_REFUSED_NSBW 3 /* ADDTS refused (non-sufficient BW) */
#define DOT11E_STATUS_ADDTS_REFUSED_AWHILE 47 /* ADDTS refused but could retry later */
#ifdef BCMCCX
#define CCX_STATUS_ASSOC_DENIED_UNKNOWN 0xc8 /* unspecified QoS related failure */
#define CCX_STATUS_ASSOC_DENIED_AP_POLICY 0xc9 /* TSPEC refused due to AP policy */
#define CCX_STATUS_ASSOC_DENIED_NO_BW 0xca /* Assoc denied due to AP insufficient BW */
#define CCX_STATUS_ASSOC_DENIED_BAD_PARAM 0xcb /* one or more TSPEC with invalid parameter */
#endif /* BCMCCX */
/* 802.11e DELTS status code */
#define DOT11E_STATUS_QSTA_LEAVE_QBSS 36 /* STA leave QBSS */
#define DOT11E_STATUS_END_TS 37 /* END TS */
#define DOT11E_STATUS_UNKNOWN_TS 38 /* UNKNOWN TS */
#define DOT11E_STATUS_QSTA_REQ_TIMEOUT 39 /* STA ADDTS request timeout */
/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
#endif /* _802_11e_CAC_H_ */

View File

@@ -0,0 +1,32 @@
/*
* $Copyright Open Broadcom Corporation$
*
* Fundamental types and constants relating to 802.1D
*
* $Id: 802.1d.h 241182 2011-02-17 21:50:03Z gmo $
*/
#ifndef _802_1_D_
#define _802_1_D_
/* 802.1D priority defines */
#define PRIO_8021D_NONE 2 /* None = - */
#define PRIO_8021D_BK 1 /* BK - Background */
#define PRIO_8021D_BE 0 /* BE - Best-effort */
#define PRIO_8021D_EE 3 /* EE - Excellent-effort */
#define PRIO_8021D_CL 4 /* CL - Controlled Load */
#define PRIO_8021D_VI 5 /* Vi - Video */
#define PRIO_8021D_VO 6 /* Vo - Voice */
#define PRIO_8021D_NC 7 /* NC - Network Control */
#define MAXPRIO 7 /* 0-7 */
#define NUMPRIO (MAXPRIO + 1)
#define ALLPRIO -1 /* All prioirty */
/* Converts prio to precedence since the numerical value of
* PRIO_8021D_BE and PRIO_8021D_NONE are swapped.
*/
#define PRIO2PREC(prio) \
(((prio) == PRIO_8021D_NONE || (prio) == PRIO_8021D_BE) ? ((prio^2)) : (prio))
#endif /* _802_1_D__ */

View File

@@ -0,0 +1,94 @@
/*
* Broadcom Ethernettype protocol definitions
*
* $Copyright Open Broadcom Corporation$
*
* $Id: bcmeth.h 294352 2011-11-06 19:23:00Z hharte $
*/
/*
* Broadcom Ethernet protocol defines
*/
#ifndef _BCMETH_H_
#define _BCMETH_H_
#ifndef _TYPEDEFS_H_
#include <typedefs.h>
#endif
/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
/* ETHER_TYPE_BRCM is defined in ethernet.h */
/*
* Following the 2byte BRCM ether_type is a 16bit BRCM subtype field
* in one of two formats: (only subtypes 32768-65535 are in use now)
*
* subtypes 0-32767:
* 8 bit subtype (0-127)
* 8 bit length in bytes (0-255)
*
* subtypes 32768-65535:
* 16 bit big-endian subtype
* 16 bit big-endian length in bytes (0-65535)
*
* length is the number of additional bytes beyond the 4 or 6 byte header
*
* Reserved values:
* 0 reserved
* 5-15 reserved for iLine protocol assignments
* 17-126 reserved, assignable
* 127 reserved
* 32768 reserved
* 32769-65534 reserved, assignable
* 65535 reserved
*/
/*
* While adding the subtypes and their specific processing code make sure
* bcmeth_bcm_hdr_t is the first data structure in the user specific data structure definition
*/
#define BCMILCP_SUBTYPE_RATE 1
#define BCMILCP_SUBTYPE_LINK 2
#define BCMILCP_SUBTYPE_CSA 3
#define BCMILCP_SUBTYPE_LARQ 4
#define BCMILCP_SUBTYPE_VENDOR 5
#define BCMILCP_SUBTYPE_FLH 17
#define BCMILCP_SUBTYPE_VENDOR_LONG 32769
#define BCMILCP_SUBTYPE_CERT 32770
#define BCMILCP_SUBTYPE_SES 32771
#define BCMILCP_BCM_SUBTYPE_RESERVED 0
#define BCMILCP_BCM_SUBTYPE_EVENT 1
#define BCMILCP_BCM_SUBTYPE_SES 2
/*
* The EAPOL type is not used anymore. Instead EAPOL messages are now embedded
* within BCMILCP_BCM_SUBTYPE_EVENT type messages
*/
/* #define BCMILCP_BCM_SUBTYPE_EAPOL 3 */
#define BCMILCP_BCM_SUBTYPE_DPT 4
#define BCMILCP_BCM_SUBTYPEHDR_MINLENGTH 8
#define BCMILCP_BCM_SUBTYPEHDR_VERSION 0
/* These fields are stored in network order */
typedef BWL_PRE_PACKED_STRUCT struct bcmeth_hdr
{
uint16 subtype; /* Vendor specific..32769 */
uint16 length;
uint8 version; /* Version is 0 */
uint8 oui[3]; /* Broadcom OUI */
/* user specific Data */
uint16 usr_subtype;
} BWL_POST_PACKED_STRUCT bcmeth_hdr_t;
/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
#endif /* _BCMETH_H_ */

View File

@@ -0,0 +1,485 @@
/*
* Broadcom Event protocol definitions
*
* $Copyright Open Broadcom Corporation$
*
* Dependencies: proto/bcmeth.h
*
* $Id: bcmevent.h 410874 2013-07-03 18:07:25Z ryeh $
*
*/
/*
* Broadcom Ethernet Events protocol defines
*
*/
#ifndef _BCMEVENT_H_
#define _BCMEVENT_H_
#ifndef _TYPEDEFS_H_
#include <typedefs.h>
#endif
/* #include <ethernet.h> -- TODO: req., excluded to overwhelming coupling (break up ethernet.h) */
#include <proto/bcmeth.h>
/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
#define BCM_EVENT_MSG_VERSION 2 /* wl_event_msg_t struct version */
#define BCM_MSG_IFNAME_MAX 16 /* max length of interface name */
/* flags */
#define WLC_EVENT_MSG_LINK 0x01 /* link is up */
#define WLC_EVENT_MSG_FLUSHTXQ 0x02 /* flush tx queue on MIC error */
#define WLC_EVENT_MSG_GROUP 0x04 /* group MIC error */
#define WLC_EVENT_MSG_UNKBSS 0x08 /* unknown source bsscfg */
#define WLC_EVENT_MSG_UNKIF 0x10 /* unknown source OS i/f */
/* these fields are stored in network order */
/* version 1 */
typedef BWL_PRE_PACKED_STRUCT struct
{
uint16 version;
uint16 flags; /* see flags below */
uint32 event_type; /* Message (see below) */
uint32 status; /* Status code (see below) */
uint32 reason; /* Reason code (if applicable) */
uint32 auth_type; /* WLC_E_AUTH */
uint32 datalen; /* data buf */
struct ether_addr addr; /* Station address (if applicable) */
char ifname[BCM_MSG_IFNAME_MAX]; /* name of the packet incoming interface */
} BWL_POST_PACKED_STRUCT wl_event_msg_v1_t;
/* the current version */
typedef BWL_PRE_PACKED_STRUCT struct
{
uint16 version;
uint16 flags; /* see flags below */
uint32 event_type; /* Message (see below) */
uint32 status; /* Status code (see below) */
uint32 reason; /* Reason code (if applicable) */
uint32 auth_type; /* WLC_E_AUTH */
uint32 datalen; /* data buf */
struct ether_addr addr; /* Station address (if applicable) */
char ifname[BCM_MSG_IFNAME_MAX]; /* name of the packet incoming interface */
uint8 ifidx; /* destination OS i/f index */
uint8 bsscfgidx; /* source bsscfg index */
} BWL_POST_PACKED_STRUCT wl_event_msg_t;
/* used by driver msgs */
typedef BWL_PRE_PACKED_STRUCT struct bcm_event {
struct ether_header eth;
bcmeth_hdr_t bcm_hdr;
wl_event_msg_t event;
/* data portion follows */
} BWL_POST_PACKED_STRUCT bcm_event_t;
#define BCM_MSG_LEN (sizeof(bcm_event_t) - sizeof(bcmeth_hdr_t) - sizeof(struct ether_header))
/* Event messages */
#define WLC_E_SET_SSID 0 /* indicates status of set SSID */
#define WLC_E_JOIN 1 /* differentiates join IBSS from found (WLC_E_START) IBSS */
#define WLC_E_START 2 /* STA founded an IBSS or AP started a BSS */
#define WLC_E_AUTH 3 /* 802.11 AUTH request */
#define WLC_E_AUTH_IND 4 /* 802.11 AUTH indication */
#define WLC_E_DEAUTH 5 /* 802.11 DEAUTH request */
#define WLC_E_DEAUTH_IND 6 /* 802.11 DEAUTH indication */
#define WLC_E_ASSOC 7 /* 802.11 ASSOC request */
#define WLC_E_ASSOC_IND 8 /* 802.11 ASSOC indication */
#define WLC_E_REASSOC 9 /* 802.11 REASSOC request */
#define WLC_E_REASSOC_IND 10 /* 802.11 REASSOC indication */
#define WLC_E_DISASSOC 11 /* 802.11 DISASSOC request */
#define WLC_E_DISASSOC_IND 12 /* 802.11 DISASSOC indication */
#define WLC_E_QUIET_START 13 /* 802.11h Quiet period started */
#define WLC_E_QUIET_END 14 /* 802.11h Quiet period ended */
#define WLC_E_BEACON_RX 15 /* BEACONS received/lost indication */
#define WLC_E_LINK 16 /* generic link indication */
#define WLC_E_MIC_ERROR 17 /* TKIP MIC error occurred */
#define WLC_E_NDIS_LINK 18 /* NDIS style link indication */
#define WLC_E_ROAM 19 /* roam attempt occurred: indicate status & reason */
#define WLC_E_TXFAIL 20 /* change in dot11FailedCount (txfail) */
#define WLC_E_PMKID_CACHE 21 /* WPA2 pmkid cache indication */
#define WLC_E_RETROGRADE_TSF 22 /* current AP's TSF value went backward */
#define WLC_E_PRUNE 23 /* AP was pruned from join list for reason */
#define WLC_E_AUTOAUTH 24 /* report AutoAuth table entry match for join attempt */
#define WLC_E_EAPOL_MSG 25 /* Event encapsulating an EAPOL message */
#define WLC_E_SCAN_COMPLETE 26 /* Scan results are ready or scan was aborted */
#define WLC_E_ADDTS_IND 27 /* indicate to host addts fail/success */
#define WLC_E_DELTS_IND 28 /* indicate to host delts fail/success */
#define WLC_E_BCNSENT_IND 29 /* indicate to host of beacon transmit */
#define WLC_E_BCNRX_MSG 30 /* Send the received beacon up to the host */
#define WLC_E_BCNLOST_MSG 31 /* indicate to host loss of beacon */
#define WLC_E_ROAM_PREP 32 /* before attempting to roam */
#define WLC_E_PFN_NET_FOUND 33 /* PFN network found event */
#define WLC_E_PFN_NET_LOST 34 /* PFN network lost event */
#define WLC_E_RESET_COMPLETE 35
#define WLC_E_JOIN_START 36
#define WLC_E_ROAM_START 37
#define WLC_E_ASSOC_START 38
#define WLC_E_IBSS_ASSOC 39
#define WLC_E_RADIO 40
#define WLC_E_PSM_WATCHDOG 41 /* PSM microcode watchdog fired */
#if defined(BCMCCX) && defined(CCX_SDK)
#define WLC_E_CCX_ASSOC_START 42 /* CCX association start */
#define WLC_E_CCX_ASSOC_ABORT 43 /* CCX association abort */
#endif /* BCMCCX && CCX_SDK */
#define WLC_E_PROBREQ_MSG 44 /* probe request received */
#define WLC_E_SCAN_CONFIRM_IND 45
#define WLC_E_PSK_SUP 46 /* WPA Handshake fail */
#define WLC_E_COUNTRY_CODE_CHANGED 47
#define WLC_E_EXCEEDED_MEDIUM_TIME 48 /* WMMAC excedded medium time */
#define WLC_E_ICV_ERROR 49 /* WEP ICV error occurred */
#define WLC_E_UNICAST_DECODE_ERROR 50 /* Unsupported unicast encrypted frame */
#define WLC_E_MULTICAST_DECODE_ERROR 51 /* Unsupported multicast encrypted frame */
#define WLC_E_TRACE 52
#ifdef WLBTAMP
#define WLC_E_BTA_HCI_EVENT 53 /* BT-AMP HCI event */
#endif
#define WLC_E_IF 54 /* I/F change (for dongle host notification) */
#define WLC_E_P2P_DISC_LISTEN_COMPLETE 55 /* listen state expires */
#define WLC_E_RSSI 56 /* indicate RSSI change based on configured levels */
#define WLC_E_PFN_SCAN_COMPLETE 57 /* PFN completed scan of network list */
#define WLC_E_EXTLOG_MSG 58
#define WLC_E_ACTION_FRAME 59 /* Action frame Rx */
#define WLC_E_ACTION_FRAME_COMPLETE 60 /* Action frame Tx complete */
#define WLC_E_PRE_ASSOC_IND 61 /* assoc request received */
#define WLC_E_PRE_REASSOC_IND 62 /* re-assoc request received */
#define WLC_E_CHANNEL_ADOPTED 63 /* channel adopted (xxx: obsoleted) */
#define WLC_E_AP_STARTED 64 /* AP started */
#define WLC_E_DFS_AP_STOP 65 /* AP stopped due to DFS */
#define WLC_E_DFS_AP_RESUME 66 /* AP resumed due to DFS */
#define WLC_E_WAI_STA_EVENT 67 /* WAI stations event */
#define WLC_E_WAI_MSG 68 /* event encapsulating an WAI message */
#define WLC_E_ESCAN_RESULT 69 /* escan result event */
#define WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE 70 /* action frame off channel complete */
#define WLC_E_PROBRESP_MSG 71 /* probe response received */
#define WLC_E_P2P_PROBREQ_MSG 72 /* P2P Probe request received */
#define WLC_E_DCS_REQUEST 73
/* XXX: will enable this after proptxstatus code is merged back to ToT */
#define WLC_E_FIFO_CREDIT_MAP 74 /* credits for D11 FIFOs. [AC0,AC1,AC2,AC3,BC_MC,ATIM] */
#define WLC_E_ACTION_FRAME_RX 75 /* Received action frame event WITH
* wl_event_rx_frame_data_t header
*/
#define WLC_E_WAKE_EVENT 76 /* Wake Event timer fired, used for wake WLAN test mode */
#define WLC_E_RM_COMPLETE 77 /* Radio measurement complete */
#define WLC_E_HTSFSYNC 78 /* Synchronize TSF with the host */
#define WLC_E_OVERLAY_REQ 79 /* request an overlay IOCTL/iovar from the host */
#define WLC_E_CSA_COMPLETE_IND 80 /* 802.11 CHANNEL SWITCH ACTION completed */
#define WLC_E_EXCESS_PM_WAKE_EVENT 81 /* excess PM Wake Event to inform host */
#define WLC_E_PFN_SCAN_NONE 82 /* no PFN networks around */
#define WLC_E_PFN_SCAN_ALLGONE 83 /* last found PFN network gets lost */
#define WLC_E_GTK_PLUMBED 84
#define WLC_E_ASSOC_IND_NDIS 85 /* 802.11 ASSOC indication for NDIS only */
#define WLC_E_REASSOC_IND_NDIS 86 /* 802.11 REASSOC indication for NDIS only */
#define WLC_E_ASSOC_REQ_IE 87
#define WLC_E_ASSOC_RESP_IE 88
#define WLC_E_ASSOC_RECREATED 89 /* association recreated on resume */
#define WLC_E_ACTION_FRAME_RX_NDIS 90 /* rx action frame event for NDIS only */
#define WLC_E_AUTH_REQ 91 /* authentication request received */
#define WLC_E_TDLS_PEER_EVENT 92 /* discovered peer, connected/disconnected peer */
#define WLC_E_SPEEDY_RECREATE_FAIL 93 /* fast assoc recreation failed */
#define WLC_E_NATIVE 94 /* port-specific event and payload (e.g. NDIS) */
#define WLC_E_PKTDELAY_IND 95 /* event for tx pkt delay suddently jump */
#define WLC_E_AWDL_AW 96 /* AWDL AW period starts */
#define WLC_E_AWDL_ROLE 97 /* AWDL Master/Slave/NE master role event */
#define WLC_E_AWDL_EVENT 98 /* Generic AWDL event */
#ifdef WLNIC
#define WLC_E_NIC_AF_TXS 99 /* NIC AF txstatus */
#define WLC_E_NIC_NIC_REPORT 100 /* NIC period report */
#endif
#define WLC_E_BEACON_FRAME_RX 101
#define WLC_E_SERVICE_FOUND 102 /* desired service found */
#define WLC_E_GAS_FRAGMENT_RX 103 /* GAS fragment received */
#define WLC_E_GAS_COMPLETE 104 /* GAS sessions all complete */
#define WLC_E_P2PO_ADD_DEVICE 105 /* New device found by p2p offload */
#define WLC_E_P2PO_DEL_DEVICE 106 /* device has been removed by p2p offload */
#define WLC_E_WNM_STA_SLEEP 107 /* WNM event to notify STA enter sleep mode */
#define WLC_E_TXFAIL_THRESH 108 /* Indication of MAC tx failures (exhaustion of
* 802.11 retries) exceeding threshold(s)
*/
#define WLC_E_PROXD 109 /* Proximity Detection event */
#define WLC_E_IBSS_COALESCE 110 /* IBSS Coalescing */
#define WLC_E_AWDL_AW_EXT_END 111 /* AWDL extended period ends */
#define WLC_E_AWDL_AW_EXT_START 112 /* SWDL AW extension start */
#define WLC_E_AWDL_AW_START 113 /* AWDL start Event to inform host */
#define WLC_E_AWDL_RADIO_OFF 114 /* Radio Off */
#define WLC_E_AWDL_PEER_STATE 115 /* AWDL peer state open/close */
#define WLC_E_AWDL_SYNC_STATE_CHANGED 116 /* AWDL sync role changed */
#define WLC_E_AWDL_CHIP_RESET 117 /* infroms the interface of a chip rest */
#define WLC_E_AWDL_INTERLEAVED_SCAN_START 118
#define WLC_E_AWDL_INTERLEAVED_SCAN_STOP 119
#define WLC_E_AWDL_PEER_CACHE_CONTROL 120
#define WLC_E_CSA_START_IND 121
#define WLC_E_CSA_DONE_IND 122
#define WLC_E_CSA_FAILURE_IND 123
#define WLC_E_CCA_CHAN_QUAL 124 /* CCA based channel quality report */
#define WLC_E_BSSID 125 /* to report change in BSSID while roaming */
#define WLC_E_TX_STAT_ERROR 126 /* tx error indication */
#define WLC_E_BCMC_CREDIT_SUPPORT 127 /* credit check for BCMC supported */
#define WLC_E_PSTA_PRIMARY_INTF_IND 128 /* psta primary interface indication */
#define WLC_E_CCX_S69_RESP_RX 129 /* CCX S69 response received */
#define WLC_E_LAST 130 /* highest val + 1 for range checking */
/* xxx:
* Please do not insert/delete events in the middle causing renumbering.
* It is a problem for host-device compatibility, especially with ROMmed chips.
*/
/* Table of event name strings for UIs and debugging dumps */
typedef struct {
uint event;
const char *name;
} bcmevent_name_t;
extern const bcmevent_name_t bcmevent_names[];
extern const int bcmevent_names_size;
/* XXX Translate between internal and exported status codes */
/* Event status codes */
#define WLC_E_STATUS_SUCCESS 0 /* operation was successful */
#define WLC_E_STATUS_FAIL 1 /* operation failed */
#define WLC_E_STATUS_TIMEOUT 2 /* operation timed out */
#define WLC_E_STATUS_NO_NETWORKS 3 /* failed due to no matching network found */
#define WLC_E_STATUS_ABORT 4 /* operation was aborted */
#define WLC_E_STATUS_NO_ACK 5 /* protocol failure: packet not ack'd */
#define WLC_E_STATUS_UNSOLICITED 6 /* AUTH or ASSOC packet was unsolicited */
#define WLC_E_STATUS_ATTEMPT 7 /* attempt to assoc to an auto auth configuration */
#define WLC_E_STATUS_PARTIAL 8 /* scan results are incomplete */
#define WLC_E_STATUS_NEWSCAN 9 /* scan aborted by another scan */
#define WLC_E_STATUS_NEWASSOC 10 /* scan aborted due to assoc in progress */
#define WLC_E_STATUS_11HQUIET 11 /* 802.11h quiet period started */
#define WLC_E_STATUS_SUPPRESS 12 /* user disabled scanning (WLC_SET_SCANSUPPRESS) */
#define WLC_E_STATUS_NOCHANS 13 /* no allowable channels to scan */
#ifdef BCMCCX
#define WLC_E_STATUS_CCXFASTRM 14 /* scan aborted due to CCX fast roam */
#endif /* BCMCCX */
#define WLC_E_STATUS_CS_ABORT 15 /* abort channel select */
#define WLC_E_STATUS_ERROR 16 /* request failed due to error */
/* roam reason codes */
#define WLC_E_REASON_INITIAL_ASSOC 0 /* initial assoc */
#define WLC_E_REASON_LOW_RSSI 1 /* roamed due to low RSSI */
#define WLC_E_REASON_DEAUTH 2 /* roamed due to DEAUTH indication */
#define WLC_E_REASON_DISASSOC 3 /* roamed due to DISASSOC indication */
#define WLC_E_REASON_BCNS_LOST 4 /* roamed due to lost beacons */
/* Roam codes used primarily by CCX */
#define WLC_E_REASON_FAST_ROAM_FAILED 5 /* roamed due to fast roam failure */
#define WLC_E_REASON_DIRECTED_ROAM 6 /* roamed due to request by AP */
#define WLC_E_REASON_TSPEC_REJECTED 7 /* roamed due to TSPEC rejection */
#define WLC_E_REASON_BETTER_AP 8 /* roamed due to finding better AP */
#define WLC_E_REASON_MINTXRATE 9 /* roamed because at mintxrate for too long */
#define WLC_E_REASON_TXFAIL 10 /* We can hear AP, but AP can't hear us */
#define WLC_E_REASON_REQUESTED_ROAM 11 /* roamed due to BSS Mgmt Transition request by AP */
/* prune reason codes */
#define WLC_E_PRUNE_ENCR_MISMATCH 1 /* encryption mismatch */
#define WLC_E_PRUNE_BCAST_BSSID 2 /* AP uses a broadcast BSSID */
#define WLC_E_PRUNE_MAC_DENY 3 /* STA's MAC addr is in AP's MAC deny list */
#define WLC_E_PRUNE_MAC_NA 4 /* STA's MAC addr is not in AP's MAC allow list */
#define WLC_E_PRUNE_REG_PASSV 5 /* AP not allowed due to regulatory restriction */
#define WLC_E_PRUNE_SPCT_MGMT 6 /* AP does not support STA locale spectrum mgmt */
#define WLC_E_PRUNE_RADAR 7 /* AP is on a radar channel of STA locale */
#define WLC_E_RSN_MISMATCH 8 /* STA does not support AP's RSN */
#define WLC_E_PRUNE_NO_COMMON_RATES 9 /* No rates in common with AP */
#define WLC_E_PRUNE_BASIC_RATES 10 /* STA does not support all basic rates of BSS */
#ifdef BCMCCX
#define WLC_E_PRUNE_CCXFAST_PREVAP 11 /* CCX FAST ROAM: prune previous AP */
#endif /* def BCMCCX */
#define WLC_E_PRUNE_CIPHER_NA 12 /* BSS's cipher not supported */
#define WLC_E_PRUNE_KNOWN_STA 13 /* AP is already known to us as a STA */
#ifdef BCMCCX
#define WLC_E_PRUNE_CCXFAST_DROAM 14 /* CCX FAST ROAM: prune unqualified AP */
#endif /* def BCMCCX */
#define WLC_E_PRUNE_WDS_PEER 15 /* AP is already known to us as a WDS peer */
#define WLC_E_PRUNE_QBSS_LOAD 16 /* QBSS LOAD - AAC is too low */
#define WLC_E_PRUNE_HOME_AP 17 /* prune home AP */
#ifdef BCMCCX
#define WLC_E_PRUNE_AP_BLOCKED 18 /* prune blocked AP */
#define WLC_E_PRUNE_NO_DIAG_SUPPORT 19 /* prune due to diagnostic mode not supported */
#endif /* BCMCCX */
/* WPA failure reason codes carried in the WLC_E_PSK_SUP event */
#define WLC_E_SUP_OTHER 0 /* Other reason */
#define WLC_E_SUP_DECRYPT_KEY_DATA 1 /* Decryption of key data failed */
#define WLC_E_SUP_BAD_UCAST_WEP128 2 /* Illegal use of ucast WEP128 */
#define WLC_E_SUP_BAD_UCAST_WEP40 3 /* Illegal use of ucast WEP40 */
#define WLC_E_SUP_UNSUP_KEY_LEN 4 /* Unsupported key length */
#define WLC_E_SUP_PW_KEY_CIPHER 5 /* Unicast cipher mismatch in pairwise key */
#define WLC_E_SUP_MSG3_TOO_MANY_IE 6 /* WPA IE contains > 1 RSN IE in key msg 3 */
#define WLC_E_SUP_MSG3_IE_MISMATCH 7 /* WPA IE mismatch in key message 3 */
#define WLC_E_SUP_NO_INSTALL_FLAG 8 /* INSTALL flag unset in 4-way msg */
#define WLC_E_SUP_MSG3_NO_GTK 9 /* encapsulated GTK missing from msg 3 */
#define WLC_E_SUP_GRP_KEY_CIPHER 10 /* Multicast cipher mismatch in group key */
#define WLC_E_SUP_GRP_MSG1_NO_GTK 11 /* encapsulated GTK missing from group msg 1 */
#define WLC_E_SUP_GTK_DECRYPT_FAIL 12 /* GTK decrypt failure */
#define WLC_E_SUP_SEND_FAIL 13 /* message send failure */
#define WLC_E_SUP_DEAUTH 14 /* received FC_DEAUTH */
#define WLC_E_SUP_WPA_PSK_TMO 15 /* WPA PSK 4-way handshake timeout */
/* Event data for events that include frames received over the air */
/* WLC_E_PROBRESP_MSG
* WLC_E_P2P_PROBREQ_MSG
* WLC_E_ACTION_FRAME_RX
*/
#ifdef WLAWDL
#define WLC_E_AWDL_SCAN_START 1 /* Scan start indication to host */
#define WLC_E_AWDL_SCAN_DONE 0 /* Scan Done indication to host */
#define WLC_E_AWDL_RX_ACT_FRAME 1
#define WLC_E_AWDL_RX_PRB_RESP 2
#endif
typedef BWL_PRE_PACKED_STRUCT struct wl_event_rx_frame_data {
uint16 version;
uint16 channel; /* Matches chanspec_t format from bcmwifi_channels.h */
int32 rssi;
uint32 mactime;
uint32 rate;
} BWL_POST_PACKED_STRUCT wl_event_rx_frame_data_t;
#define BCM_RX_FRAME_DATA_VERSION 1
/* WLC_E_IF event data */
typedef struct wl_event_data_if {
uint8 ifidx; /* RTE virtual device index (for dongle) */
uint8 opcode; /* see I/F opcode */
uint8 reserved; /* bit mask (WLC_E_IF_FLAGS_XXX ) */
uint8 bssidx; /* bsscfg index */
uint8 role; /* see I/F role */
} wl_event_data_if_t;
/* opcode in WLC_E_IF event */
#define WLC_E_IF_ADD 1 /* bsscfg add */
#define WLC_E_IF_DEL 2 /* bsscfg delete */
#define WLC_E_IF_CHANGE 3 /* bsscfg role change */
/* I/F role code in WLC_E_IF event */
#define WLC_E_IF_ROLE_STA 0 /* Infra STA */
#define WLC_E_IF_ROLE_AP 1 /* Access Point */
#define WLC_E_IF_ROLE_WDS 2 /* WDS link */
#define WLC_E_IF_ROLE_P2P_GO 3 /* P2P Group Owner */
#define WLC_E_IF_ROLE_P2P_CLIENT 4 /* P2P Client */
#ifdef WLBTAMP
#define WLC_E_IF_ROLE_BTA_CREATOR 5 /* BT-AMP Creator */
#define WLC_E_IF_ROLE_BTA_ACCEPTOR 6 /* BT-AMP Acceptor */
#endif
/* WLC_E_RSSI event data */
typedef struct wl_event_data_rssi {
int32 rssi;
int32 snr;
int32 noise;
} wl_event_data_rssi_t;
/* WLC_E_IF flag */
#define WLC_E_IF_FLAGS_BSSCFG_NOIF 0x1 /* no host I/F creation needed */
/* Reason codes for LINK */
#define WLC_E_LINK_BCN_LOSS 1 /* Link down because of beacon loss */
#define WLC_E_LINK_DISASSOC 2 /* Link down because of disassoc */
#define WLC_E_LINK_ASSOC_REC 3 /* Link down because assoc recreate failed */
#define WLC_E_LINK_BSSCFG_DIS 4 /* Link down due to bsscfg down */
/* reason codes for WLC_E_OVERLAY_REQ event */
#define WLC_E_OVL_DOWNLOAD 0 /* overlay download request */
#define WLC_E_OVL_UPDATE_IND 1 /* device indication of host overlay update */
/* reason codes for WLC_E_TDLS_PEER_EVENT event */
#define WLC_E_TDLS_PEER_DISCOVERED 0 /* peer is ready to establish TDLS */
#define WLC_E_TDLS_PEER_CONNECTED 1
#define WLC_E_TDLS_PEER_DISCONNECTED 2
#ifdef WLAWDL
/* WLC_E_AWDL_EVENT subtypes */
#define WLC_E_AWDL_SCAN_STATUS 0
#define WLC_E_AWDL_RX_ACT_FRAME 1
#define WLC_E_AWDL_RX_PRB_RESP 2
#define WLC_E_AWDL_PHYCAL_STATUS 3
#define WLC_E_AWDL_WOWL_NULLPKT 4
#define WLC_E_AWDL_OOB_AF_STATUS 5
/* WLC_E_AWDL_SCAN_STATUS status values */
#define WLC_E_AWDL_SCAN_START 1 /* Scan start indication to host */
#define WLC_E_AWDL_SCAN_DONE 0 /* Scan Done indication to host */
#define WLC_E_AWDL_PHYCAL_START 1 /* Phy calibration start indication to host */
#define WLC_E_AWDL_PHYCAL_DONE 0 /* Phy calibration done indication to host */
#endif
/* GAS event data */
typedef BWL_PRE_PACKED_STRUCT struct wl_event_gas {
uint16 channel; /* channel of GAS protocol */
uint8 dialog_token; /* GAS dialog token */
uint8 fragment_id; /* fragment id */
uint16 status_code; /* status code on GAS completion */
uint16 data_len; /* length of data to follow */
uint8 data[1]; /* variable length specified by data_len */
} BWL_POST_PACKED_STRUCT wl_event_gas_t;
/* service discovery TLV */
typedef BWL_PRE_PACKED_STRUCT struct wl_sd_tlv {
uint16 length; /* length of response_data */
uint8 protocol; /* service protocol type */
uint8 transaction_id; /* service transaction id */
uint8 status_code; /* status code */
uint8 data[1]; /* response data */
} BWL_POST_PACKED_STRUCT wl_sd_tlv_t;
/* service discovery event data */
typedef BWL_PRE_PACKED_STRUCT struct wl_event_sd {
uint16 channel; /* channel */
uint8 count; /* number of tlvs */
wl_sd_tlv_t tlv[1]; /* service discovery TLV */
} BWL_POST_PACKED_STRUCT wl_event_sd_t;
/* Reason codes for WLC_E_PROXD */
#define WLC_E_PROXD_FOUND 1 /* Found a proximity device */
#define WLC_E_PROXD_GONE 2 /* Lost a proximity device */
/* WLC_E_AWDL_AW event data */
typedef BWL_PRE_PACKED_STRUCT struct awdl_aws_event_data {
uint32 fw_time; /* firmware PMU time */
struct ether_addr current_master; /* Current master Mac addr */
uint16 aw_counter; /* AW seq# */
uint8 aw_ext_count; /* AW extension count */
uint8 aw_role; /* AW role */
uint8 flags; /* AW event flag */
uint16 aw_chan;
uint8 infra_rssi; /* rssi on the infra channel */
uint32 infra_rxbcn_count; /* number of beacons received */
} BWL_POST_PACKED_STRUCT awdl_aws_event_data_t;
/* For awdl_aws_event_data_t.flags */
#define AWDL_AW_LAST_EXT 0x01
/* WLC_E_AWDL_OOB_AF_STATUS event data */
typedef BWL_PRE_PACKED_STRUCT struct awdl_oob_af_status_data {
uint32 tx_time_diff;
uint16 pkt_tag;
uint8 tx_chan;
} BWL_POST_PACKED_STRUCT awdl_oob_af_status_data_t;
/* Video Traffic Interference Monitor Event */
#define INTFER_EVENT_VERSION 1
#define INTFER_STREAM_TYPE_NONTCP 1
#define INTFER_STREAM_TYPE_TCP 2
#define WLINTFER_STATS_NSMPLS 4
typedef struct wl_intfer_event {
uint16 version; /* version */
uint16 status; /* status */
uint8 txfail_histo[WLINTFER_STATS_NSMPLS]; /* txfail histo */
} wl_intfer_event_t;
/* WLC_E_PSTA_PRIMARY_INTF_IND event data */
typedef struct wl_psta_primary_intf_event {
struct ether_addr prim_ea; /* primary intf ether addr */
} wl_psta_primary_intf_event_t;
/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
#endif /* _BCMEVENT_H_ */

View File

@@ -0,0 +1,207 @@
/*
* $Copyright Open Broadcom Corporation$
*
* Fundamental constants relating to IP Protocol
*
* $Id: bcmip.h 407107 2013-06-11 19:39:14Z esawma $
*/
#ifndef _bcmip_h_
#define _bcmip_h_
#ifndef _TYPEDEFS_H_
#include <typedefs.h>
#endif
/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
/* IPV4 and IPV6 common */
#define IP_VER_OFFSET 0x0 /* offset to version field */
#define IP_VER_MASK 0xf0 /* version mask */
#define IP_VER_SHIFT 4 /* version shift */
#define IP_VER_4 4 /* version number for IPV4 */
#define IP_VER_6 6 /* version number for IPV6 */
#define IP_VER(ip_body) \
((((uint8 *)(ip_body))[IP_VER_OFFSET] & IP_VER_MASK) >> IP_VER_SHIFT)
#define IP_PROT_ICMP 0x1 /* ICMP protocol */
#define IP_PROT_IGMP 0x2 /* IGMP protocol */
#define IP_PROT_TCP 0x6 /* TCP protocol */
#define IP_PROT_UDP 0x11 /* UDP protocol type */
#define IP_PROT_ICMP6 0x3a /* ICMPv6 protocol type */
/* IPV4 field offsets */
#define IPV4_VER_HL_OFFSET 0 /* version and ihl byte offset */
#define IPV4_TOS_OFFSET 1 /* type of service offset */
#define IPV4_PKTLEN_OFFSET 2 /* packet length offset */
#define IPV4_PKTFLAG_OFFSET 6 /* more-frag,dont-frag flag offset */
#define IPV4_PROT_OFFSET 9 /* protocol type offset */
#define IPV4_CHKSUM_OFFSET 10 /* IP header checksum offset */
#define IPV4_SRC_IP_OFFSET 12 /* src IP addr offset */
#define IPV4_DEST_IP_OFFSET 16 /* dest IP addr offset */
#define IPV4_OPTIONS_OFFSET 20 /* IP options offset */
#define IPV4_MIN_HEADER_LEN 20 /* Minimum size for an IP header (no options) */
/* IPV4 field decodes */
#define IPV4_VER_MASK 0xf0 /* IPV4 version mask */
#define IPV4_VER_SHIFT 4 /* IPV4 version shift */
#define IPV4_HLEN_MASK 0x0f /* IPV4 header length mask */
#define IPV4_HLEN(ipv4_body) (4 * (((uint8 *)(ipv4_body))[IPV4_VER_HL_OFFSET] & IPV4_HLEN_MASK))
#define IPV4_ADDR_LEN 4 /* IPV4 address length */
#define IPV4_ADDR_NULL(a) ((((uint8 *)(a))[0] | ((uint8 *)(a))[1] | \
((uint8 *)(a))[2] | ((uint8 *)(a))[3]) == 0)
#define IPV4_ADDR_BCAST(a) ((((uint8 *)(a))[0] & ((uint8 *)(a))[1] & \
((uint8 *)(a))[2] & ((uint8 *)(a))[3]) == 0xff)
#define IPV4_TOS_DSCP_MASK 0xfc /* DiffServ codepoint mask */
#define IPV4_TOS_DSCP_SHIFT 2 /* DiffServ codepoint shift */
#define IPV4_TOS(ipv4_body) (((uint8 *)(ipv4_body))[IPV4_TOS_OFFSET])
#define IPV4_TOS_PREC_MASK 0xe0 /* Historical precedence mask */
#define IPV4_TOS_PREC_SHIFT 5 /* Historical precedence shift */
#define IPV4_TOS_LOWDELAY 0x10 /* Lowest delay requested */
#define IPV4_TOS_THROUGHPUT 0x8 /* Best throughput requested */
#define IPV4_TOS_RELIABILITY 0x4 /* Most reliable delivery requested */
#define IPV4_PROT(ipv4_body) (((uint8 *)(ipv4_body))[IPV4_PROT_OFFSET])
#define IPV4_FRAG_RESV 0x8000 /* Reserved */
#define IPV4_FRAG_DONT 0x4000 /* Don't fragment */
#define IPV4_FRAG_MORE 0x2000 /* More fragments */
#define IPV4_FRAG_OFFSET_MASK 0x1fff /* Fragment offset */
#define IPV4_ADDR_STR_LEN 16 /* Max IP address length in string format */
/* IPV4 packet formats */
BWL_PRE_PACKED_STRUCT struct ipv4_addr {
uint8 addr[IPV4_ADDR_LEN];
} BWL_POST_PACKED_STRUCT;
BWL_PRE_PACKED_STRUCT struct ipv4_hdr {
uint8 version_ihl; /* Version and Internet Header Length */
uint8 tos; /* Type Of Service */
uint16 tot_len; /* Number of bytes in packet (max 65535) */
uint16 id;
uint16 frag; /* 3 flag bits and fragment offset */
uint8 ttl; /* Time To Live */
uint8 prot; /* Protocol */
uint16 hdr_chksum; /* IP header checksum */
uint8 src_ip[IPV4_ADDR_LEN]; /* Source IP Address */
uint8 dst_ip[IPV4_ADDR_LEN]; /* Destination IP Address */
} BWL_POST_PACKED_STRUCT;
/* IPV6 field offsets */
#define IPV6_PAYLOAD_LEN_OFFSET 4 /* payload length offset */
#define IPV6_NEXT_HDR_OFFSET 6 /* next header/protocol offset */
#define IPV6_HOP_LIMIT_OFFSET 7 /* hop limit offset */
#define IPV6_SRC_IP_OFFSET 8 /* src IP addr offset */
#define IPV6_DEST_IP_OFFSET 24 /* dst IP addr offset */
/* IPV6 field decodes */
#define IPV6_TRAFFIC_CLASS(ipv6_body) \
(((((uint8 *)(ipv6_body))[0] & 0x0f) << 4) | \
((((uint8 *)(ipv6_body))[1] & 0xf0) >> 4))
#define IPV6_FLOW_LABEL(ipv6_body) \
(((((uint8 *)(ipv6_body))[1] & 0x0f) << 16) | \
(((uint8 *)(ipv6_body))[2] << 8) | \
(((uint8 *)(ipv6_body))[3]))
#define IPV6_PAYLOAD_LEN(ipv6_body) \
((((uint8 *)(ipv6_body))[IPV6_PAYLOAD_LEN_OFFSET + 0] << 8) | \
((uint8 *)(ipv6_body))[IPV6_PAYLOAD_LEN_OFFSET + 1])
#define IPV6_NEXT_HDR(ipv6_body) \
(((uint8 *)(ipv6_body))[IPV6_NEXT_HDR_OFFSET])
#define IPV6_PROT(ipv6_body) IPV6_NEXT_HDR(ipv6_body)
#define IPV6_ADDR_LEN 16 /* IPV6 address length */
/* IPV4 TOS or IPV6 Traffic Classifier or 0 */
#define IP_TOS46(ip_body) \
(IP_VER(ip_body) == IP_VER_4 ? IPV4_TOS(ip_body) : \
IP_VER(ip_body) == IP_VER_6 ? IPV6_TRAFFIC_CLASS(ip_body) : 0)
#define IP_DSCP46(ip_body) (IP_TOS46(ip_body) >> IPV4_TOS_DSCP_SHIFT);
/* IPV6 extension headers (options) */
#define IPV6_EXTHDR_HOP 0
#define IPV6_EXTHDR_ROUTING 43
#define IPV6_EXTHDR_FRAGMENT 44
#define IPV6_EXTHDR_AUTH 51
#define IPV6_EXTHDR_NONE 59
#define IPV6_EXTHDR_DEST 60
#define IPV6_EXTHDR(prot) (((prot) == IPV6_EXTHDR_HOP) || \
((prot) == IPV6_EXTHDR_ROUTING) || \
((prot) == IPV6_EXTHDR_FRAGMENT) || \
((prot) == IPV6_EXTHDR_AUTH) || \
((prot) == IPV6_EXTHDR_NONE) || \
((prot) == IPV6_EXTHDR_DEST))
#define IPV6_MIN_HLEN 40
#define IPV6_EXTHDR_LEN(eh) ((((struct ipv6_exthdr *)(eh))->hdrlen + 1) << 3)
BWL_PRE_PACKED_STRUCT struct ipv6_exthdr {
uint8 nexthdr;
uint8 hdrlen;
} BWL_POST_PACKED_STRUCT;
BWL_PRE_PACKED_STRUCT struct ipv6_exthdr_frag {
uint8 nexthdr;
uint8 rsvd;
uint16 frag_off;
uint32 ident;
} BWL_POST_PACKED_STRUCT;
static INLINE int32
ipv6_exthdr_len(uint8 *h, uint8 *proto)
{
uint16 len = 0, hlen;
struct ipv6_exthdr *eh = (struct ipv6_exthdr *)h;
while (IPV6_EXTHDR(eh->nexthdr)) {
if (eh->nexthdr == IPV6_EXTHDR_NONE)
return -1;
else if (eh->nexthdr == IPV6_EXTHDR_FRAGMENT)
hlen = 8;
else if (eh->nexthdr == IPV6_EXTHDR_AUTH)
hlen = (eh->hdrlen + 2) << 2;
else
hlen = IPV6_EXTHDR_LEN(eh);
len += hlen;
eh = (struct ipv6_exthdr *)(h + len);
}
*proto = eh->nexthdr;
return len;
}
#define IPV4_ISMULTI(a) (((a) & 0xf0000000) == 0xe0000000)
#define IPV4_MCAST_TO_ETHER_MCAST(ipv4, ether) \
{ \
ether[0] = 0x01; \
ether[1] = 0x00; \
ether[2] = 0x5E; \
ether[3] = (ipv4 & 0x7f0000) >> 16; \
ether[4] = (ipv4 & 0xff00) >> 8; \
ether[5] = (ipv4 & 0xff); \
}
/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
#endif /* _bcmip_h_ */

View File

@@ -0,0 +1,145 @@
/*
* $Copyright Open Broadcom Corporation$
*
* Fundamental constants relating to Neighbor Discovery Protocol
*
* $Id: bcmipv6.h 399481 2013-04-30 09:24:20Z cylee $
*/
#ifndef _bcmipv6_h_
#define _bcmipv6_h_
#ifndef _TYPEDEFS_H_
#include <typedefs.h>
#endif
/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
/* Extension headers */
#define IPV6_EXT_HOP 0
#define IPV6_EXT_ROUTE 43
#define IPV6_EXT_FRAG 44
#define IPV6_EXT_DEST 60
#define IPV6_EXT_ESEC 50
#define IPV6_EXT_AUTH 51
/* Minimum size (extension header "word" length) */
#define IPV6_EXT_WORD 8
/* Offsets for most extension headers */
#define IPV6_EXT_NEXTHDR 0
#define IPV6_EXT_HDRLEN 1
/* Constants specific to fragmentation header */
#define IPV6_FRAG_MORE_MASK 0x0001
#define IPV6_FRAG_MORE_SHIFT 0
#define IPV6_FRAG_OFFS_MASK 0xfff8
#define IPV6_FRAG_OFFS_SHIFT 3
/* For icmpv6 */
#define ICMPV6_HEADER_TYPE 0x3A
#define ICMPV6_PKT_TYPE_NS 135
#define ICMPV6_PKT_TYPE_NA 136
#define ICMPV6_ND_OPT_TYPE_TARGET_MAC 2
#define ICMPV6_ND_OPT_TYPE_SRC_MAC 1
#define ICMPV6_ND_OPT_LEN_LINKADDR 1
#define ICMPV6_ND_OPT_LEN_LINKADDR 1
#define IPV6_VERSION 6
#define IPV6_HOP_LIMIT 255
#define IPV6_ADDR_NULL(a) ((a[0] | a[1] | a[2] | a[3] | a[4] | \
a[5] | a[6] | a[7] | a[8] | a[9] | \
a[10] | a[11] | a[12] | a[13] | \
a[14] | a[15]) == 0)
#define IPV6_ADDR_LOCAL(a) (((a[0] == 0xfe) && (a[1] & 0x80))? TRUE: FALSE)
/* IPV6 address */
BWL_PRE_PACKED_STRUCT struct ipv6_addr {
uint8 addr[16];
} BWL_POST_PACKED_STRUCT;
/* XXX use masks, htonl instead of bit fileds */
#ifndef IL_BIGENDIAN
/* ICMPV6 Header */
BWL_PRE_PACKED_STRUCT struct icmp6_hdr {
uint8 icmp6_type;
uint8 icmp6_code;
uint16 icmp6_cksum;
BWL_PRE_PACKED_STRUCT union {
uint32 reserved;
BWL_PRE_PACKED_STRUCT struct nd_advt {
uint32 reserved1:5,
override:1,
solicited:1,
router:1,
reserved2:24;
} BWL_POST_PACKED_STRUCT nd_advt;
} BWL_POST_PACKED_STRUCT opt;
} BWL_POST_PACKED_STRUCT;
/* Ipv6 Header Format */
BWL_PRE_PACKED_STRUCT struct ipv6_hdr {
uint8 priority:4,
version:4;
uint8 flow_lbl[3];
uint16 payload_len;
uint8 nexthdr;
uint8 hop_limit;
struct ipv6_addr saddr;
struct ipv6_addr daddr;
} BWL_POST_PACKED_STRUCT;
/* Neighbor Advertisement/Solicitation Packet Structure */
BWL_PRE_PACKED_STRUCT struct nd_msg {
struct icmp6_hdr icmph;
struct ipv6_addr target;
} BWL_POST_PACKED_STRUCT;
/* Neighibor Solicitation/Advertisement Optional Structure */
BWL_PRE_PACKED_STRUCT struct nd_msg_opt {
uint8 type;
uint8 len;
uint8 mac_addr[ETHER_ADDR_LEN];
} BWL_POST_PACKED_STRUCT;
/* Ipv6 Fragmentation Header */
BWL_PRE_PACKED_STRUCT struct ipv6_frag {
uint8 nexthdr;
uint8 reserved;
uint16 frag_offset;
uint32 ident;
} BWL_POST_PACKED_STRUCT;
#endif /* IL_BIGENDIAN */
/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
static const struct ipv6_addr all_node_ipv6_maddr = {
{ 0xff, 0x2, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 1
}};
#define IPV6_ISMULTI(a) (a[0] == 0xff)
#define IPV6_MCAST_TO_ETHER_MCAST(ipv6, ether) \
{ \
ether[0] = 0x33; \
ether[1] = 0x33; \
ether[2] = ipv6[12]; \
ether[3] = ipv6[13]; \
ether[4] = ipv6[14]; \
ether[5] = ipv6[15]; \
}
#endif /* !defined(_bcmipv6_h_) */

View File

@@ -0,0 +1,423 @@
/*
* BT-AMP (BlueTooth Alternate Mac and Phy) HCI (Host/Controller Interface)
*
* $Copyright Open Broadcom Corporation$
*
* $Id: bt_amp_hci.h 294267 2011-11-04 23:41:52Z $
*/
#ifndef _bt_amp_hci_h
#define _bt_amp_hci_h
/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
/* AMP HCI CMD packet format */
typedef BWL_PRE_PACKED_STRUCT struct amp_hci_cmd {
uint16 opcode;
uint8 plen;
uint8 parms[1];
} BWL_POST_PACKED_STRUCT amp_hci_cmd_t;
#define HCI_CMD_PREAMBLE_SIZE OFFSETOF(amp_hci_cmd_t, parms)
#define HCI_CMD_DATA_SIZE 255
/* AMP HCI CMD opcode layout */
#define HCI_CMD_OPCODE(ogf, ocf) ((((ogf) & 0x3F) << 10) | ((ocf) & 0x03FF))
#define HCI_CMD_OGF(opcode) ((uint8)(((opcode) >> 10) & 0x3F))
#define HCI_CMD_OCF(opcode) ((opcode) & 0x03FF)
/* AMP HCI command opcodes */
#define HCI_Read_Failed_Contact_Counter HCI_CMD_OPCODE(0x05, 0x0001)
#define HCI_Reset_Failed_Contact_Counter HCI_CMD_OPCODE(0x05, 0x0002)
#define HCI_Read_Link_Quality HCI_CMD_OPCODE(0x05, 0x0003)
#define HCI_Read_Local_AMP_Info HCI_CMD_OPCODE(0x05, 0x0009)
#define HCI_Read_Local_AMP_ASSOC HCI_CMD_OPCODE(0x05, 0x000A)
#define HCI_Write_Remote_AMP_ASSOC HCI_CMD_OPCODE(0x05, 0x000B)
#define HCI_Create_Physical_Link HCI_CMD_OPCODE(0x01, 0x0035)
#define HCI_Accept_Physical_Link_Request HCI_CMD_OPCODE(0x01, 0x0036)
#define HCI_Disconnect_Physical_Link HCI_CMD_OPCODE(0x01, 0x0037)
#define HCI_Create_Logical_Link HCI_CMD_OPCODE(0x01, 0x0038)
#define HCI_Accept_Logical_Link HCI_CMD_OPCODE(0x01, 0x0039)
#define HCI_Disconnect_Logical_Link HCI_CMD_OPCODE(0x01, 0x003A)
#define HCI_Logical_Link_Cancel HCI_CMD_OPCODE(0x01, 0x003B)
#define HCI_Flow_Spec_Modify HCI_CMD_OPCODE(0x01, 0x003C)
#define HCI_Write_Flow_Control_Mode HCI_CMD_OPCODE(0x01, 0x0067)
#define HCI_Read_Best_Effort_Flush_Timeout HCI_CMD_OPCODE(0x01, 0x0069)
#define HCI_Write_Best_Effort_Flush_Timeout HCI_CMD_OPCODE(0x01, 0x006A)
#define HCI_Short_Range_Mode HCI_CMD_OPCODE(0x01, 0x006B)
#define HCI_Reset HCI_CMD_OPCODE(0x03, 0x0003)
#define HCI_Read_Connection_Accept_Timeout HCI_CMD_OPCODE(0x03, 0x0015)
#define HCI_Write_Connection_Accept_Timeout HCI_CMD_OPCODE(0x03, 0x0016)
#define HCI_Read_Link_Supervision_Timeout HCI_CMD_OPCODE(0x03, 0x0036)
#define HCI_Write_Link_Supervision_Timeout HCI_CMD_OPCODE(0x03, 0x0037)
#define HCI_Enhanced_Flush HCI_CMD_OPCODE(0x03, 0x005F)
#define HCI_Read_Logical_Link_Accept_Timeout HCI_CMD_OPCODE(0x03, 0x0061)
#define HCI_Write_Logical_Link_Accept_Timeout HCI_CMD_OPCODE(0x03, 0x0062)
#define HCI_Set_Event_Mask_Page_2 HCI_CMD_OPCODE(0x03, 0x0063)
#define HCI_Read_Location_Data_Command HCI_CMD_OPCODE(0x03, 0x0064)
#define HCI_Write_Location_Data_Command HCI_CMD_OPCODE(0x03, 0x0065)
#define HCI_Read_Local_Version_Info HCI_CMD_OPCODE(0x04, 0x0001)
#define HCI_Read_Local_Supported_Commands HCI_CMD_OPCODE(0x04, 0x0002)
#define HCI_Read_Buffer_Size HCI_CMD_OPCODE(0x04, 0x0005)
#define HCI_Read_Data_Block_Size HCI_CMD_OPCODE(0x04, 0x000A)
/* AMP HCI command parameters */
typedef BWL_PRE_PACKED_STRUCT struct read_local_cmd_parms {
uint8 plh;
uint8 offset[2]; /* length so far */
uint8 max_remote[2];
} BWL_POST_PACKED_STRUCT read_local_cmd_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct write_remote_cmd_parms {
uint8 plh;
uint8 offset[2];
uint8 len[2];
uint8 frag[1];
} BWL_POST_PACKED_STRUCT write_remote_cmd_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct phy_link_cmd_parms {
uint8 plh;
uint8 key_length;
uint8 key_type;
uint8 key[1];
} BWL_POST_PACKED_STRUCT phy_link_cmd_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct dis_phy_link_cmd_parms {
uint8 plh;
uint8 reason;
} BWL_POST_PACKED_STRUCT dis_phy_link_cmd_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct log_link_cmd_parms {
uint8 plh;
uint8 txflow[16];
uint8 rxflow[16];
} BWL_POST_PACKED_STRUCT log_link_cmd_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct ext_flow_spec {
uint8 id;
uint8 service_type;
uint8 max_sdu[2];
uint8 sdu_ia_time[4];
uint8 access_latency[4];
uint8 flush_timeout[4];
} BWL_POST_PACKED_STRUCT ext_flow_spec_t;
typedef BWL_PRE_PACKED_STRUCT struct log_link_cancel_cmd_parms {
uint8 plh;
uint8 tx_fs_ID;
} BWL_POST_PACKED_STRUCT log_link_cancel_cmd_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct flow_spec_mod_cmd_parms {
uint8 llh[2];
uint8 txflow[16];
uint8 rxflow[16];
} BWL_POST_PACKED_STRUCT flow_spec_mod_cmd_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct plh_pad {
uint8 plh;
uint8 pad;
} BWL_POST_PACKED_STRUCT plh_pad_t;
typedef BWL_PRE_PACKED_STRUCT union hci_handle {
uint16 bredr;
plh_pad_t amp;
} BWL_POST_PACKED_STRUCT hci_handle_t;
typedef BWL_PRE_PACKED_STRUCT struct ls_to_cmd_parms {
hci_handle_t handle;
uint8 timeout[2];
} BWL_POST_PACKED_STRUCT ls_to_cmd_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct befto_cmd_parms {
uint8 llh[2];
uint8 befto[4];
} BWL_POST_PACKED_STRUCT befto_cmd_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct srm_cmd_parms {
uint8 plh;
uint8 srm;
} BWL_POST_PACKED_STRUCT srm_cmd_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct ld_cmd_parms {
uint8 ld_aware;
uint8 ld[2];
uint8 ld_opts;
uint8 l_opts;
} BWL_POST_PACKED_STRUCT ld_cmd_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct eflush_cmd_parms {
uint8 llh[2];
uint8 packet_type;
} BWL_POST_PACKED_STRUCT eflush_cmd_parms_t;
/* Generic AMP extended flow spec service types */
#define EFS_SVCTYPE_NO_TRAFFIC 0
#define EFS_SVCTYPE_BEST_EFFORT 1
#define EFS_SVCTYPE_GUARANTEED 2
/* AMP HCI event packet format */
typedef BWL_PRE_PACKED_STRUCT struct amp_hci_event {
uint8 ecode;
uint8 plen;
uint8 parms[1];
} BWL_POST_PACKED_STRUCT amp_hci_event_t;
#define HCI_EVT_PREAMBLE_SIZE OFFSETOF(amp_hci_event_t, parms)
/* AMP HCI event codes */
#define HCI_Command_Complete 0x0E
#define HCI_Command_Status 0x0F
#define HCI_Flush_Occurred 0x11
#define HCI_Enhanced_Flush_Complete 0x39
#define HCI_Physical_Link_Complete 0x40
#define HCI_Channel_Select 0x41
#define HCI_Disconnect_Physical_Link_Complete 0x42
#define HCI_Logical_Link_Complete 0x45
#define HCI_Disconnect_Logical_Link_Complete 0x46
#define HCI_Flow_Spec_Modify_Complete 0x47
#define HCI_Number_of_Completed_Data_Blocks 0x48
#define HCI_Short_Range_Mode_Change_Complete 0x4C
#define HCI_Status_Change_Event 0x4D
#define HCI_Vendor_Specific 0xFF
/* AMP HCI event mask bit positions */
#define HCI_Physical_Link_Complete_Event_Mask 0x0001
#define HCI_Channel_Select_Event_Mask 0x0002
#define HCI_Disconnect_Physical_Link_Complete_Event_Mask 0x0004
#define HCI_Logical_Link_Complete_Event_Mask 0x0020
#define HCI_Disconnect_Logical_Link_Complete_Event_Mask 0x0040
#define HCI_Flow_Spec_Modify_Complete_Event_Mask 0x0080
#define HCI_Number_of_Completed_Data_Blocks_Event_Mask 0x0100
#define HCI_Short_Range_Mode_Change_Complete_Event_Mask 0x1000
#define HCI_Status_Change_Event_Mask 0x2000
#define HCI_All_Event_Mask 0x31e7
/* AMP HCI event parameters */
typedef BWL_PRE_PACKED_STRUCT struct cmd_status_parms {
uint8 status;
uint8 cmdpkts;
uint16 opcode;
} BWL_POST_PACKED_STRUCT cmd_status_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct cmd_complete_parms {
uint8 cmdpkts;
uint16 opcode;
uint8 parms[1];
} BWL_POST_PACKED_STRUCT cmd_complete_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct flush_occurred_evt_parms {
uint16 handle;
} BWL_POST_PACKED_STRUCT flush_occurred_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct write_remote_evt_parms {
uint8 status;
uint8 plh;
} BWL_POST_PACKED_STRUCT write_remote_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct read_local_evt_parms {
uint8 status;
uint8 plh;
uint16 len;
uint8 frag[1];
} BWL_POST_PACKED_STRUCT read_local_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct read_local_info_evt_parms {
uint8 status;
uint8 AMP_status;
uint32 bandwidth;
uint32 gbandwidth;
uint32 latency;
uint32 PDU_size;
uint8 ctrl_type;
uint16 PAL_cap;
uint16 AMP_ASSOC_len;
uint32 max_flush_timeout;
uint32 be_flush_timeout;
} BWL_POST_PACKED_STRUCT read_local_info_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct log_link_evt_parms {
uint8 status;
uint16 llh;
uint8 plh;
uint8 tx_fs_ID;
} BWL_POST_PACKED_STRUCT log_link_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct disc_log_link_evt_parms {
uint8 status;
uint16 llh;
uint8 reason;
} BWL_POST_PACKED_STRUCT disc_log_link_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct log_link_cancel_evt_parms {
uint8 status;
uint8 plh;
uint8 tx_fs_ID;
} BWL_POST_PACKED_STRUCT log_link_cancel_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct flow_spec_mod_evt_parms {
uint8 status;
uint16 llh;
} BWL_POST_PACKED_STRUCT flow_spec_mod_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct phy_link_evt_parms {
uint8 status;
uint8 plh;
} BWL_POST_PACKED_STRUCT phy_link_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct dis_phy_link_evt_parms {
uint8 status;
uint8 plh;
uint8 reason;
} BWL_POST_PACKED_STRUCT dis_phy_link_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct read_ls_to_evt_parms {
uint8 status;
hci_handle_t handle;
uint16 timeout;
} BWL_POST_PACKED_STRUCT read_ls_to_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct read_lla_ca_to_evt_parms {
uint8 status;
uint16 timeout;
} BWL_POST_PACKED_STRUCT read_lla_ca_to_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct read_data_block_size_evt_parms {
uint8 status;
uint16 ACL_pkt_len;
uint16 data_block_len;
uint16 data_block_num;
} BWL_POST_PACKED_STRUCT read_data_block_size_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct data_blocks {
uint16 handle;
uint16 pkts;
uint16 blocks;
} BWL_POST_PACKED_STRUCT data_blocks_t;
typedef BWL_PRE_PACKED_STRUCT struct num_completed_data_blocks_evt_parms {
uint16 num_blocks;
uint8 num_handles;
data_blocks_t completed[1];
} BWL_POST_PACKED_STRUCT num_completed_data_blocks_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct befto_evt_parms {
uint8 status;
uint32 befto;
} BWL_POST_PACKED_STRUCT befto_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct srm_evt_parms {
uint8 status;
uint8 plh;
uint8 srm;
} BWL_POST_PACKED_STRUCT srm_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct contact_counter_evt_parms {
uint8 status;
uint8 llh[2];
uint16 counter;
} BWL_POST_PACKED_STRUCT contact_counter_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct contact_counter_reset_evt_parms {
uint8 status;
uint8 llh[2];
} BWL_POST_PACKED_STRUCT contact_counter_reset_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct read_linkq_evt_parms {
uint8 status;
hci_handle_t handle;
uint8 link_quality;
} BWL_POST_PACKED_STRUCT read_linkq_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct ld_evt_parms {
uint8 status;
uint8 ld_aware;
uint8 ld[2];
uint8 ld_opts;
uint8 l_opts;
} BWL_POST_PACKED_STRUCT ld_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct eflush_complete_evt_parms {
uint16 handle;
} BWL_POST_PACKED_STRUCT eflush_complete_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct vendor_specific_evt_parms {
uint8 len;
uint8 parms[1];
} BWL_POST_PACKED_STRUCT vendor_specific_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct local_version_info_evt_parms {
uint8 status;
uint8 hci_version;
uint16 hci_revision;
uint8 pal_version;
uint16 mfg_name;
uint16 pal_subversion;
} BWL_POST_PACKED_STRUCT local_version_info_evt_parms_t;
#define MAX_SUPPORTED_CMD_BYTE 64
typedef BWL_PRE_PACKED_STRUCT struct local_supported_cmd_evt_parms {
uint8 status;
uint8 cmd[MAX_SUPPORTED_CMD_BYTE];
} BWL_POST_PACKED_STRUCT local_supported_cmd_evt_parms_t;
typedef BWL_PRE_PACKED_STRUCT struct status_change_evt_parms {
uint8 status;
uint8 amp_status;
} BWL_POST_PACKED_STRUCT status_change_evt_parms_t;
/* AMP HCI error codes */
#define HCI_SUCCESS 0x00
#define HCI_ERR_ILLEGAL_COMMAND 0x01
#define HCI_ERR_NO_CONNECTION 0x02
#define HCI_ERR_MEMORY_FULL 0x07
#define HCI_ERR_CONNECTION_TIMEOUT 0x08
#define HCI_ERR_MAX_NUM_OF_CONNECTIONS 0x09
#define HCI_ERR_CONNECTION_EXISTS 0x0B
#define HCI_ERR_CONNECTION_DISALLOWED 0x0C
#define HCI_ERR_CONNECTION_ACCEPT_TIMEOUT 0x10
#define HCI_ERR_UNSUPPORTED_VALUE 0x11
#define HCI_ERR_ILLEGAL_PARAMETER_FMT 0x12
#define HCI_ERR_CONN_TERM_BY_LOCAL_HOST 0x16
#define HCI_ERR_UNSPECIFIED 0x1F
#define HCI_ERR_UNIT_KEY_USED 0x26
#define HCI_ERR_QOS_REJECTED 0x2D
#define HCI_ERR_PARAM_OUT_OF_RANGE 0x30
#define HCI_ERR_NO_SUITABLE_CHANNEL 0x39
#define HCI_ERR_CHANNEL_MOVE 0xFF
/* AMP HCI ACL Data packet format */
typedef BWL_PRE_PACKED_STRUCT struct amp_hci_ACL_data {
uint16 handle; /* 12-bit connection handle + 2-bit PB and 2-bit BC flags */
uint16 dlen; /* data total length */
uint8 data[1];
} BWL_POST_PACKED_STRUCT amp_hci_ACL_data_t;
#define HCI_ACL_DATA_PREAMBLE_SIZE OFFSETOF(amp_hci_ACL_data_t, data)
#define HCI_ACL_DATA_BC_FLAGS (0x0 << 14)
#define HCI_ACL_DATA_PB_FLAGS (0x3 << 12)
#define HCI_ACL_DATA_HANDLE(handle) ((handle) & 0x0fff)
#define HCI_ACL_DATA_FLAGS(handle) ((handle) >> 12)
/* AMP Activity Report packet formats */
typedef BWL_PRE_PACKED_STRUCT struct amp_hci_activity_report {
uint8 ScheduleKnown;
uint8 NumReports;
uint8 data[1];
} BWL_POST_PACKED_STRUCT amp_hci_activity_report_t;
typedef BWL_PRE_PACKED_STRUCT struct amp_hci_activity_report_triple {
uint32 StartTime;
uint32 Duration;
uint32 Periodicity;
} BWL_POST_PACKED_STRUCT amp_hci_activity_report_triple_t;
#define HCI_AR_SCHEDULE_KNOWN 0x01
/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
#endif /* _bt_amp_hci_h_ */

View File

@@ -0,0 +1,193 @@
/*
* 802.1x EAPOL definitions
*
* See
* IEEE Std 802.1X-2001
* IEEE 802.1X RADIUS Usage Guidelines
*
* Copyright (C) 2002 Broadcom Corporation
*
* $Id: eapol.h 241182 2011-02-17 21:50:03Z $
*/
#ifndef _eapol_h_
#define _eapol_h_
#ifndef _TYPEDEFS_H_
#include <typedefs.h>
#endif
/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
#include <bcmcrypto/aeskeywrap.h>
/* EAPOL for 802.3/Ethernet */
typedef BWL_PRE_PACKED_STRUCT struct {
struct ether_header eth; /* 802.3/Ethernet header */
unsigned char version; /* EAPOL protocol version */
unsigned char type; /* EAPOL type */
unsigned short length; /* Length of body */
unsigned char body[1]; /* Body (optional) */
} BWL_POST_PACKED_STRUCT eapol_header_t;
#define EAPOL_HEADER_LEN 18
typedef struct {
unsigned char version; /* EAPOL protocol version */
unsigned char type; /* EAPOL type */
unsigned short length; /* Length of body */
} eapol_hdr_t;
#define EAPOL_HDR_LEN 4
/* EAPOL version */
#define WPA2_EAPOL_VERSION 2
#define WPA_EAPOL_VERSION 1
#define LEAP_EAPOL_VERSION 1
#define SES_EAPOL_VERSION 1
/* EAPOL types */
#define EAP_PACKET 0
#define EAPOL_START 1
#define EAPOL_LOGOFF 2
#define EAPOL_KEY 3
#define EAPOL_ASF 4
/* EAPOL-Key types */
#define EAPOL_RC4_KEY 1
#define EAPOL_WPA2_KEY 2 /* 802.11i/WPA2 */
#define EAPOL_WPA_KEY 254 /* WPA */
/* RC4 EAPOL-Key header field sizes */
#define EAPOL_KEY_REPLAY_LEN 8
#define EAPOL_KEY_IV_LEN 16
#define EAPOL_KEY_SIG_LEN 16
/* RC4 EAPOL-Key */
typedef BWL_PRE_PACKED_STRUCT struct {
unsigned char type; /* Key Descriptor Type */
unsigned short length; /* Key Length (unaligned) */
unsigned char replay[EAPOL_KEY_REPLAY_LEN]; /* Replay Counter */
unsigned char iv[EAPOL_KEY_IV_LEN]; /* Key IV */
unsigned char index; /* Key Flags & Index */
unsigned char signature[EAPOL_KEY_SIG_LEN]; /* Key Signature */
unsigned char key[1]; /* Key (optional) */
} BWL_POST_PACKED_STRUCT eapol_key_header_t;
#define EAPOL_KEY_HEADER_LEN 44
/* RC4 EAPOL-Key flags */
#define EAPOL_KEY_FLAGS_MASK 0x80
#define EAPOL_KEY_BROADCAST 0
#define EAPOL_KEY_UNICAST 0x80
/* RC4 EAPOL-Key index */
#define EAPOL_KEY_INDEX_MASK 0x7f
/* WPA/802.11i/WPA2 EAPOL-Key header field sizes */
#define EAPOL_WPA_KEY_REPLAY_LEN 8
#define EAPOL_WPA_KEY_NONCE_LEN 32
#define EAPOL_WPA_KEY_IV_LEN 16
#define EAPOL_WPA_KEY_RSC_LEN 8
#define EAPOL_WPA_KEY_ID_LEN 8
#define EAPOL_WPA_KEY_MIC_LEN 16
#define EAPOL_WPA_KEY_DATA_LEN (EAPOL_WPA_MAX_KEY_SIZE + AKW_BLOCK_LEN)
#define EAPOL_WPA_MAX_KEY_SIZE 32
/* WPA EAPOL-Key */
typedef BWL_PRE_PACKED_STRUCT struct {
unsigned char type; /* Key Descriptor Type */
unsigned short key_info; /* Key Information (unaligned) */
unsigned short key_len; /* Key Length (unaligned) */
unsigned char replay[EAPOL_WPA_KEY_REPLAY_LEN]; /* Replay Counter */
unsigned char nonce[EAPOL_WPA_KEY_NONCE_LEN]; /* Nonce */
unsigned char iv[EAPOL_WPA_KEY_IV_LEN]; /* Key IV */
unsigned char rsc[EAPOL_WPA_KEY_RSC_LEN]; /* Key RSC */
unsigned char id[EAPOL_WPA_KEY_ID_LEN]; /* WPA:Key ID, 802.11i/WPA2: Reserved */
unsigned char mic[EAPOL_WPA_KEY_MIC_LEN]; /* Key MIC */
unsigned short data_len; /* Key Data Length */
unsigned char data[EAPOL_WPA_KEY_DATA_LEN]; /* Key data */
} BWL_POST_PACKED_STRUCT eapol_wpa_key_header_t;
#define EAPOL_WPA_KEY_LEN 95
/* WPA/802.11i/WPA2 KEY KEY_INFO bits */
#define WPA_KEY_DESC_V1 0x01
#define WPA_KEY_DESC_V2 0x02
#define WPA_KEY_DESC_V3 0x03
#define WPA_KEY_PAIRWISE 0x08
#define WPA_KEY_INSTALL 0x40
#define WPA_KEY_ACK 0x80
#define WPA_KEY_MIC 0x100
#define WPA_KEY_SECURE 0x200
#define WPA_KEY_ERROR 0x400
#define WPA_KEY_REQ 0x800
#define WPA_KEY_DESC_V2_OR_V3 WPA_KEY_DESC_V2
/* WPA-only KEY KEY_INFO bits */
#define WPA_KEY_INDEX_0 0x00
#define WPA_KEY_INDEX_1 0x10
#define WPA_KEY_INDEX_2 0x20
#define WPA_KEY_INDEX_3 0x30
#define WPA_KEY_INDEX_MASK 0x30
#define WPA_KEY_INDEX_SHIFT 0x04
/* 802.11i/WPA2-only KEY KEY_INFO bits */
#define WPA_KEY_ENCRYPTED_DATA 0x1000
/* Key Data encapsulation */
typedef BWL_PRE_PACKED_STRUCT struct {
uint8 type;
uint8 length;
uint8 oui[3];
uint8 subtype;
uint8 data[1];
} BWL_POST_PACKED_STRUCT eapol_wpa2_encap_data_t;
#define EAPOL_WPA2_ENCAP_DATA_HDR_LEN 6
#define WPA2_KEY_DATA_SUBTYPE_GTK 1
#define WPA2_KEY_DATA_SUBTYPE_STAKEY 2
#define WPA2_KEY_DATA_SUBTYPE_MAC 3
#define WPA2_KEY_DATA_SUBTYPE_PMKID 4
#define WPA2_KEY_DATA_SUBTYPE_IGTK 9
/* GTK encapsulation */
typedef BWL_PRE_PACKED_STRUCT struct {
uint8 flags;
uint8 reserved;
uint8 gtk[EAPOL_WPA_MAX_KEY_SIZE];
} BWL_POST_PACKED_STRUCT eapol_wpa2_key_gtk_encap_t;
#define EAPOL_WPA2_KEY_GTK_ENCAP_HDR_LEN 2
#define WPA2_GTK_INDEX_MASK 0x03
#define WPA2_GTK_INDEX_SHIFT 0x00
#define WPA2_GTK_TRANSMIT 0x04
/* IGTK encapsulation */
typedef BWL_PRE_PACKED_STRUCT struct {
uint16 key_id;
uint8 ipn[6];
uint8 key[EAPOL_WPA_MAX_KEY_SIZE];
} BWL_POST_PACKED_STRUCT eapol_wpa2_key_igtk_encap_t;
#define EAPOL_WPA2_KEY_IGTK_ENCAP_HDR_LEN 8
/* STAKey encapsulation */
typedef BWL_PRE_PACKED_STRUCT struct {
uint8 reserved[2];
uint8 mac[ETHER_ADDR_LEN];
uint8 stakey[EAPOL_WPA_MAX_KEY_SIZE];
} BWL_POST_PACKED_STRUCT eapol_wpa2_key_stakey_encap_t;
#define WPA2_KEY_DATA_PAD 0xdd
/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
#endif /* _eapol_h_ */

View File

@@ -0,0 +1,228 @@
/*
* From FreeBSD 2.2.7: Fundamental constants relating to ethernet.
*
* $Copyright Open Broadcom Corporation$
*
* $Id: ethernet.h 401759 2013-05-13 16:08:08Z sudhirbs $
*/
#ifndef _NET_ETHERNET_H_ /* use native BSD ethernet.h when available */
#define _NET_ETHERNET_H_
#ifndef _TYPEDEFS_H_
#include "typedefs.h"
#endif
/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
/*
* The number of bytes in an ethernet (MAC) address.
*/
#define ETHER_ADDR_LEN 6
/*
* The number of bytes in the type field.
*/
#define ETHER_TYPE_LEN 2
/*
* The number of bytes in the trailing CRC field.
*/
#define ETHER_CRC_LEN 4
/*
* The length of the combined header.
*/
#define ETHER_HDR_LEN (ETHER_ADDR_LEN * 2 + ETHER_TYPE_LEN)
/*
* The minimum packet length.
*/
#define ETHER_MIN_LEN 64
/*
* The minimum packet user data length.
*/
#define ETHER_MIN_DATA 46
/*
* The maximum packet length.
*/
#define ETHER_MAX_LEN 1518
/*
* The maximum packet user data length.
*/
#define ETHER_MAX_DATA 1500
/* ether types */
#define ETHER_TYPE_MIN 0x0600 /* Anything less than MIN is a length */
#define ETHER_TYPE_IP 0x0800 /* IP */
#define ETHER_TYPE_ARP 0x0806 /* ARP */
#define ETHER_TYPE_8021Q 0x8100 /* 802.1Q */
#define ETHER_TYPE_IPV6 0x86dd /* IPv6 */
#define ETHER_TYPE_BRCM 0x886c /* Broadcom Corp. */
#define ETHER_TYPE_802_1X 0x888e /* 802.1x */
#ifdef PLC
#define ETHER_TYPE_88E1 0x88e1 /* GIGLE */
#define ETHER_TYPE_8912 0x8912 /* GIGLE */
#define ETHER_TYPE_GIGLED 0xffff /* GIGLE */
#endif /* PLC */
#define ETHER_TYPE_802_1X_PREAUTH 0x88c7 /* 802.1x preauthentication */
#define ETHER_TYPE_WAI 0x88b4 /* WAI */
#define ETHER_TYPE_89_0D 0x890d /* 89-0d frame for TDLS */
#define ETHER_TYPE_PPP_SES 0x8864 /* PPPoE Session */
#define ETHER_TYPE_IAPP_L2_UPDATE 0x6 /* IAPP L2 update frame */
/* Broadcom subtype follows ethertype; First 2 bytes are reserved; Next 2 are subtype; */
#define ETHER_BRCM_SUBTYPE_LEN 4 /* Broadcom 4 byte subtype */
/* ether header */
#define ETHER_DEST_OFFSET (0 * ETHER_ADDR_LEN) /* dest address offset */
#define ETHER_SRC_OFFSET (1 * ETHER_ADDR_LEN) /* src address offset */
#define ETHER_TYPE_OFFSET (2 * ETHER_ADDR_LEN) /* ether type offset */
/*
* A macro to validate a length with
*/
#define ETHER_IS_VALID_LEN(foo) \
((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
#define ETHER_FILL_MCAST_ADDR_FROM_IP(ea, mgrp_ip) { \
((uint8 *)ea)[0] = 0x01; \
((uint8 *)ea)[1] = 0x00; \
((uint8 *)ea)[2] = 0x5e; \
((uint8 *)ea)[3] = ((mgrp_ip) >> 16) & 0x7f; \
((uint8 *)ea)[4] = ((mgrp_ip) >> 8) & 0xff; \
((uint8 *)ea)[5] = ((mgrp_ip) >> 0) & 0xff; \
}
#ifndef __INCif_etherh /* Quick and ugly hack for VxWorks */
/*
* Structure of a 10Mb/s Ethernet header.
*/
BWL_PRE_PACKED_STRUCT struct ether_header {
uint8 ether_dhost[ETHER_ADDR_LEN];
uint8 ether_shost[ETHER_ADDR_LEN];
uint16 ether_type;
} BWL_POST_PACKED_STRUCT;
/*
* Structure of a 48-bit Ethernet address.
*/
BWL_PRE_PACKED_STRUCT struct ether_addr {
uint8 octet[ETHER_ADDR_LEN];
} BWL_POST_PACKED_STRUCT;
#elif defined(VX_BSD4_3) && VX_BSD4_3
/*
* Structure of a 48-bit Ethernet address.
*/
BWL_PRE_PACKED_STRUCT struct ether_addr {
uint8 octet[ETHER_ADDR_LEN];
} BWL_POST_PACKED_STRUCT;
#endif /* !__INCif_etherh Quick and ugly hack for VxWorks */
/*
* Takes a pointer, set, test, clear, toggle locally admininistered
* address bit in the 48-bit Ethernet address.
*/
#define ETHER_SET_LOCALADDR(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] | 2))
#define ETHER_IS_LOCALADDR(ea) (((uint8 *)(ea))[0] & 2)
#define ETHER_CLR_LOCALADDR(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] & 0xfd))
#define ETHER_TOGGLE_LOCALADDR(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] ^ 2))
/* Takes a pointer, marks unicast address bit in the MAC address */
#define ETHER_SET_UNICAST(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] & ~1))
/*
* Takes a pointer, returns true if a 48-bit multicast address
* (including broadcast, since it is all ones)
*/
#define ETHER_ISMULTI(ea) (((const uint8 *)(ea))[0] & 1)
/* compare two ethernet addresses - assumes the pointers can be referenced as shorts */
#define eacmp(a, b) ((((const uint16 *)(a))[0] ^ ((const uint16 *)(b))[0]) | \
(((const uint16 *)(a))[1] ^ ((const uint16 *)(b))[1]) | \
(((const uint16 *)(a))[2] ^ ((const uint16 *)(b))[2]))
#define ether_cmp(a, b) eacmp(a, b)
/* copy an ethernet address - assumes the pointers can be referenced as shorts */
#define eacopy(s, d) \
do { \
((uint16 *)(d))[0] = ((const uint16 *)(s))[0]; \
((uint16 *)(d))[1] = ((const uint16 *)(s))[1]; \
((uint16 *)(d))[2] = ((const uint16 *)(s))[2]; \
} while (0)
#define ether_copy(s, d) eacopy(s, d)
/* Copy an ethernet address in reverse order */
#define ether_rcopy(s, d) \
do { \
((uint16 *)(d))[2] = ((uint16 *)(s))[2]; \
((uint16 *)(d))[1] = ((uint16 *)(s))[1]; \
((uint16 *)(d))[0] = ((uint16 *)(s))[0]; \
} while (0)
#ifdef _HNDRTE_
/* Dongles use bcmutils functions instead of macros.
* Possibly slower but saves over 800 bytes off THUMB dongle image.
*/
extern const struct ether_addr ether_bcast;
extern const struct ether_addr ether_null;
extern const struct ether_addr ether_ipv6_mcast;
extern int ether_isbcast(const void *ea);
extern int ether_isnulladdr(const void *ea);
#define ETHER_ISBCAST(ea) ether_isbcast(ea)
#define ETHER_ISNULLADDR(ea) ether_isnulladdr(ea)
#else /* !_HNDRTE_ */
static const struct ether_addr ether_bcast = {{255, 255, 255, 255, 255, 255}};
static const struct ether_addr ether_null = {{0, 0, 0, 0, 0, 0}};
static const struct ether_addr ether_ipv6_mcast = {{0x33, 0x33, 0x00, 0x00, 0x00, 0x01}};
#define ETHER_ISBCAST(ea) ((((const uint8 *)(ea))[0] & \
((const uint8 *)(ea))[1] & \
((const uint8 *)(ea))[2] & \
((const uint8 *)(ea))[3] & \
((const uint8 *)(ea))[4] & \
((const uint8 *)(ea))[5]) == 0xff)
#define ETHER_ISNULLADDR(ea) ((((const uint8 *)(ea))[0] | \
((const uint8 *)(ea))[1] | \
((const uint8 *)(ea))[2] | \
((const uint8 *)(ea))[3] | \
((const uint8 *)(ea))[4] | \
((const uint8 *)(ea))[5]) == 0)
#endif /* !_HNDRTE_ */
#define ETHER_ISNULLDEST(da) ((((const uint16 *)(da))[0] | \
((const uint16 *)(da))[1] | \
((const uint16 *)(da))[2]) == 0)
#define ETHER_ISNULLSRC(sa) ETHER_ISNULLDEST(sa)
#define ETHER_MOVE_HDR(d, s) \
do { \
struct ether_header t; \
t = *(struct ether_header *)(s); \
*(struct ether_header *)(d) = t; \
} while (0)
#define ETHER_ISUCAST(ea) ((((uint8 *)(ea))[0] & 0x01) == 0)
/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
#endif /* _NET_ETHERNET_H_ */

View File

@@ -0,0 +1,496 @@
/*
* $Copyright Open Broadcom Corporation$
*
* Fundamental types and constants relating to WFA P2P (aka WiFi Direct)
*
* $Id: p2p.h 338828 2012-06-14 17:24:45Z harveysm $
*/
#ifndef _P2P_H_
#define _P2P_H_
#ifndef _TYPEDEFS_H_
#include <typedefs.h>
#endif
#include <wlioctl.h>
#include <proto/802.11.h>
/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
/* WiFi P2P OUI values */
#define P2P_OUI WFA_OUI /* WiFi P2P OUI */
#define P2P_VER WFA_OUI_TYPE_P2P /* P2P version: 9=WiFi P2P v1.0 */
#define P2P_IE_ID 0xdd /* P2P IE element ID */
/* WiFi P2P IE */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_ie {
uint8 id; /* IE ID: 0xDD */
uint8 len; /* IE length */
uint8 OUI[3]; /* WiFi P2P specific OUI: P2P_OUI */
uint8 oui_type; /* Identifies P2P version: P2P_VER */
uint8 subelts[1]; /* variable length subelements */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_ie wifi_p2p_ie_t;
#define P2P_IE_FIXED_LEN 6
#define P2P_ATTR_ID_OFF 0
#define P2P_ATTR_LEN_OFF 1
#define P2P_ATTR_DATA_OFF 3
#define P2P_ATTR_HDR_LEN 3 /* ID + 2-byte length field spec 1.02 */
/* P2P IE Subelement IDs from WiFi P2P Technical Spec 1.00 */
#define P2P_SEID_STATUS 0 /* Status */
#define P2P_SEID_MINOR_RC 1 /* Minor Reason Code */
#define P2P_SEID_P2P_INFO 2 /* P2P Capability (capabilities info) */
#define P2P_SEID_DEV_ID 3 /* P2P Device ID */
#define P2P_SEID_INTENT 4 /* Group Owner Intent */
#define P2P_SEID_CFG_TIMEOUT 5 /* Configuration Timeout */
#define P2P_SEID_CHANNEL 6 /* Listen channel */
#define P2P_SEID_GRP_BSSID 7 /* P2P Group BSSID */
#define P2P_SEID_XT_TIMING 8 /* Extended Listen Timing */
#define P2P_SEID_INTINTADDR 9 /* Intended P2P Interface Address */
#define P2P_SEID_P2P_MGBTY 10 /* P2P Manageability */
#define P2P_SEID_CHAN_LIST 11 /* Channel List */
#define P2P_SEID_ABSENCE 12 /* Notice of Absence */
#define P2P_SEID_DEV_INFO 13 /* Device Info */
#define P2P_SEID_GROUP_INFO 14 /* Group Info */
#define P2P_SEID_GROUP_ID 15 /* Group ID */
#define P2P_SEID_P2P_IF 16 /* P2P Interface */
#define P2P_SEID_OP_CHANNEL 17 /* Operating channel */
#define P2P_SEID_INVITE_FLAGS 18 /* Invitation flags */
#define P2P_SEID_VNDR 221 /* Vendor-specific subelement */
#define P2P_SE_VS_ID_SERVICES 0x1b /* BRCM proprietary subel: L2 Services */
/* WiFi P2P IE subelement: P2P Capability (capabilities info) */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_info_se_s {
uint8 eltId; /* SE ID: P2P_SEID_P2P_INFO */
uint8 len[2]; /* SE length not including eltId, len fields */
uint8 dev; /* Device Capability Bitmap */
uint8 group; /* Group Capability Bitmap */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_info_se_s wifi_p2p_info_se_t;
/* P2P Capability subelement's Device Capability Bitmap bit values */
#define P2P_CAPSE_DEV_SERVICE_DIS 0x1 /* Service Discovery */
#define P2P_CAPSE_DEV_CLIENT_DIS 0x2 /* Client Discoverability */
#define P2P_CAPSE_DEV_CONCURRENT 0x4 /* Concurrent Operation */
#define P2P_CAPSE_DEV_INFRA_MAN 0x8 /* P2P Infrastructure Managed */
#define P2P_CAPSE_DEV_LIMIT 0x10 /* P2P Device Limit */
#define P2P_CAPSE_INVITE_PROC 0x20 /* P2P Invitation Procedure */
/* P2P Capability subelement's Group Capability Bitmap bit values */
#define P2P_CAPSE_GRP_OWNER 0x1 /* P2P Group Owner */
#define P2P_CAPSE_PERSIST_GRP 0x2 /* Persistent P2P Group */
#define P2P_CAPSE_GRP_LIMIT 0x4 /* P2P Group Limit */
#define P2P_CAPSE_GRP_INTRA_BSS 0x8 /* Intra-BSS Distribution */
#define P2P_CAPSE_GRP_X_CONNECT 0x10 /* Cross Connection */
#define P2P_CAPSE_GRP_PERSISTENT 0x20 /* Persistent Reconnect */
#define P2P_CAPSE_GRP_FORMATION 0x40 /* Group Formation */
/* WiFi P2P IE subelement: Group Owner Intent */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_intent_se_s {
uint8 eltId; /* SE ID: P2P_SEID_INTENT */
uint8 len[2]; /* SE length not including eltId, len fields */
uint8 intent; /* Intent Value 0...15 (0=legacy 15=master only) */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_intent_se_s wifi_p2p_intent_se_t;
/* WiFi P2P IE subelement: Configuration Timeout */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_cfg_tmo_se_s {
uint8 eltId; /* SE ID: P2P_SEID_CFG_TIMEOUT */
uint8 len[2]; /* SE length not including eltId, len fields */
uint8 go_tmo; /* GO config timeout in units of 10 ms */
uint8 client_tmo; /* Client config timeout in units of 10 ms */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_cfg_tmo_se_s wifi_p2p_cfg_tmo_se_t;
/* WiFi P2P IE subelement: Status */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_status_se_s {
uint8 eltId; /* SE ID: P2P_SEID_STATUS */
uint8 len[2]; /* SE length not including eltId, len fields */
uint8 status; /* Status Code: P2P_STATSE_* */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_status_se_s wifi_p2p_status_se_t;
/* Status subelement Status Code definitions */
#define P2P_STATSE_SUCCESS 0
/* Success */
#define P2P_STATSE_FAIL_INFO_CURR_UNAVAIL 1
/* Failed, information currently unavailable */
#define P2P_STATSE_PASSED_UP P2P_STATSE_FAIL_INFO_CURR_UNAVAIL
/* Old name for above in P2P spec 1.08 and older */
#define P2P_STATSE_FAIL_INCOMPAT_PARAMS 2
/* Failed, incompatible parameters */
#define P2P_STATSE_FAIL_LIMIT_REACHED 3
/* Failed, limit reached */
#define P2P_STATSE_FAIL_INVALID_PARAMS 4
/* Failed, invalid parameters */
#define P2P_STATSE_FAIL_UNABLE_TO_ACCOM 5
/* Failed, unable to accomodate request */
#define P2P_STATSE_FAIL_PROTO_ERROR 6
/* Failed, previous protocol error or disruptive behaviour */
#define P2P_STATSE_FAIL_NO_COMMON_CHAN 7
/* Failed, no common channels */
#define P2P_STATSE_FAIL_UNKNOWN_GROUP 8
/* Failed, unknown P2P Group */
#define P2P_STATSE_FAIL_INTENT 9
/* Failed, both peers indicated Intent 15 in GO Negotiation */
#define P2P_STATSE_FAIL_INCOMPAT_PROVIS 10
/* Failed, incompatible provisioning method */
#define P2P_STATSE_FAIL_USER_REJECT 11
/* Failed, rejected by user */
/* WiFi P2P IE attribute: Extended Listen Timing */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_ext_se_s {
uint8 eltId; /* ID: P2P_SEID_EXT_TIMING */
uint8 len[2]; /* length not including eltId, len fields */
uint8 avail[2]; /* availibility period */
uint8 interval[2]; /* availibility interval */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_ext_se_s wifi_p2p_ext_se_t;
#define P2P_EXT_MIN 10 /* minimum 10ms */
/* WiFi P2P IE subelement: Intended P2P Interface Address */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_intintad_se_s {
uint8 eltId; /* SE ID: P2P_SEID_INTINTADDR */
uint8 len[2]; /* SE length not including eltId, len fields */
uint8 mac[6]; /* intended P2P interface MAC address */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_intintad_se_s wifi_p2p_intintad_se_t;
/* WiFi P2P IE subelement: Channel */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_channel_se_s {
uint8 eltId; /* SE ID: P2P_SEID_STATUS */
uint8 len[2]; /* SE length not including eltId, len fields */
uint8 band; /* Regulatory Class (band) */
uint8 channel; /* Channel */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_channel_se_s wifi_p2p_channel_se_t;
/* Channel Entry structure within the Channel List SE */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_chanlist_entry_s {
uint8 band; /* Regulatory Class (band) */
uint8 num_channels; /* # of channels in the channel list */
uint8 channels[WL_NUMCHANNELS]; /* Channel List */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_chanlist_entry_s wifi_p2p_chanlist_entry_t;
#define WIFI_P2P_CHANLIST_SE_MAX_ENTRIES 2
/* WiFi P2P IE subelement: Channel List */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_chanlist_se_s {
uint8 eltId; /* SE ID: P2P_SEID_STATUS */
uint8 len[2]; /* SE length not including eltId, len fields */
uint8 country[3]; /* Country String */
uint8 num_entries; /* # of channel entries */
wifi_p2p_chanlist_entry_t entries[WIFI_P2P_CHANLIST_SE_MAX_ENTRIES];
/* Channel Entry List */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_chanlist_se_s wifi_p2p_chanlist_se_t;
/* WiFi P2P IE's Device Info subelement */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_devinfo_se_s {
uint8 eltId; /* SE ID: P2P_SEID_DEVINFO */
uint8 len[2]; /* SE length not including eltId, len fields */
uint8 mac[6]; /* P2P Device MAC address */
uint16 wps_cfg_meths; /* Config Methods: reg_prototlv.h WPS_CONFMET_* */
uint8 pri_devtype[8]; /* Primary Device Type */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_devinfo_se_s wifi_p2p_devinfo_se_t;
#define P2P_DEV_TYPE_LEN 8
/* WiFi P2P IE's Group Info subelement Client Info Descriptor */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_cid_fixed_s {
uint8 len;
uint8 devaddr[ETHER_ADDR_LEN]; /* P2P Device Address */
uint8 ifaddr[ETHER_ADDR_LEN]; /* P2P Interface Address */
uint8 devcap; /* Device Capability */
uint8 cfg_meths[2]; /* Config Methods: reg_prototlv.h WPS_CONFMET_* */
uint8 pridt[P2P_DEV_TYPE_LEN]; /* Primary Device Type */
uint8 secdts; /* Number of Secondary Device Types */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_cid_fixed_s wifi_p2p_cid_fixed_t;
/* WiFi P2P IE's Device ID subelement */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_devid_se_s {
uint8 eltId;
uint8 len[2];
struct ether_addr addr; /* P2P Device MAC address */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_devid_se_s wifi_p2p_devid_se_t;
/* WiFi P2P IE subelement: P2P Manageability */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_mgbt_se_s {
uint8 eltId; /* SE ID: P2P_SEID_P2P_MGBTY */
uint8 len[2]; /* SE length not including eltId, len fields */
uint8 mg_bitmap; /* manageability bitmap */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_mgbt_se_s wifi_p2p_mgbt_se_t;
/* mg_bitmap field bit values */
#define P2P_MGBTSE_P2PDEVMGMT_FLAG 0x1 /* AP supports Managed P2P Device */
/* WiFi P2P IE subelement: Group Info */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_grpinfo_se_s {
uint8 eltId; /* SE ID: P2P_SEID_GROUP_INFO */
uint8 len[2]; /* SE length not including eltId, len fields */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_grpinfo_se_s wifi_p2p_grpinfo_se_t;
/* WiFi P2P Action Frame */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_action_frame {
uint8 category; /* P2P_AF_CATEGORY */
uint8 OUI[3]; /* OUI - P2P_OUI */
uint8 type; /* OUI Type - P2P_VER */
uint8 subtype; /* OUI Subtype - P2P_AF_* */
uint8 dialog_token; /* nonzero, identifies req/resp tranaction */
uint8 elts[1]; /* Variable length information elements. Max size =
* ACTION_FRAME_SIZE - sizeof(this structure) - 1
*/
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_action_frame wifi_p2p_action_frame_t;
#define P2P_AF_CATEGORY 0x7f
#define P2P_AF_FIXED_LEN 7
/* WiFi P2P Action Frame OUI Subtypes */
#define P2P_AF_NOTICE_OF_ABSENCE 0 /* Notice of Absence */
#define P2P_AF_PRESENCE_REQ 1 /* P2P Presence Request */
#define P2P_AF_PRESENCE_RSP 2 /* P2P Presence Response */
#define P2P_AF_GO_DISC_REQ 3 /* GO Discoverability Request */
/* WiFi P2P Public Action Frame */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_pub_act_frame {
uint8 category; /* P2P_PUB_AF_CATEGORY */
uint8 action; /* P2P_PUB_AF_ACTION */
uint8 oui[3]; /* P2P_OUI */
uint8 oui_type; /* OUI type - P2P_VER */
uint8 subtype; /* OUI subtype - P2P_TYPE_* */
uint8 dialog_token; /* nonzero, identifies req/rsp transaction */
uint8 elts[1]; /* Variable length information elements. Max size =
* ACTION_FRAME_SIZE - sizeof(this structure) - 1
*/
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_pub_act_frame wifi_p2p_pub_act_frame_t;
#define P2P_PUB_AF_FIXED_LEN 8
#define P2P_PUB_AF_CATEGORY 0x04
#define P2P_PUB_AF_ACTION 0x09
/* WiFi P2P Public Action Frame OUI Subtypes */
#define P2P_PAF_GON_REQ 0 /* Group Owner Negotiation Req */
#define P2P_PAF_GON_RSP 1 /* Group Owner Negotiation Rsp */
#define P2P_PAF_GON_CONF 2 /* Group Owner Negotiation Confirm */
#define P2P_PAF_INVITE_REQ 3 /* P2P Invitation Request */
#define P2P_PAF_INVITE_RSP 4 /* P2P Invitation Response */
#define P2P_PAF_DEVDIS_REQ 5 /* Device Discoverability Request */
#define P2P_PAF_DEVDIS_RSP 6 /* Device Discoverability Response */
#define P2P_PAF_PROVDIS_REQ 7 /* Provision Discovery Request */
#define P2P_PAF_PROVDIS_RSP 8 /* Provision Discovery Request */
/* TODO: Stop using these obsolete aliases for P2P_PAF_GON_* */
#define P2P_TYPE_MNREQ P2P_PAF_GON_REQ
#define P2P_TYPE_MNRSP P2P_PAF_GON_RSP
#define P2P_TYPE_MNCONF P2P_PAF_GON_CONF
/* WiFi P2P IE subelement: Notice of Absence */
BWL_PRE_PACKED_STRUCT struct wifi_p2p_noa_desc {
uint8 cnt_type; /* Count/Type */
uint32 duration; /* Duration */
uint32 interval; /* Interval */
uint32 start; /* Start Time */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_noa_desc wifi_p2p_noa_desc_t;
BWL_PRE_PACKED_STRUCT struct wifi_p2p_noa_se {
uint8 eltId; /* Subelement ID */
uint8 len[2]; /* Length */
uint8 index; /* Index */
uint8 ops_ctw_parms; /* CTWindow and OppPS Parameters */
wifi_p2p_noa_desc_t desc[1]; /* Notice of Absence Descriptor(s) */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_noa_se wifi_p2p_noa_se_t;
#define P2P_NOA_SE_FIXED_LEN 5
/* cnt_type field values */
#define P2P_NOA_DESC_CNT_RESERVED 0 /* reserved and should not be used */
#define P2P_NOA_DESC_CNT_REPEAT 255 /* continuous schedule */
#define P2P_NOA_DESC_TYPE_PREFERRED 1 /* preferred values */
#define P2P_NOA_DESC_TYPE_ACCEPTABLE 2 /* acceptable limits */
/* ctw_ops_parms field values */
#define P2P_NOA_CTW_MASK 0x7f
#define P2P_NOA_OPS_MASK 0x80
#define P2P_NOA_OPS_SHIFT 7
#define P2P_CTW_MIN 10 /* minimum 10TU */
/*
* P2P Service Discovery related
*/
#define P2PSD_ACTION_CATEGORY 0x04
/* Public action frame */
#define P2PSD_ACTION_ID_GAS_IREQ 0x0a
/* Action value for GAS Initial Request AF */
#define P2PSD_ACTION_ID_GAS_IRESP 0x0b
/* Action value for GAS Initial Response AF */
#define P2PSD_ACTION_ID_GAS_CREQ 0x0c
/* Action value for GAS Comback Request AF */
#define P2PSD_ACTION_ID_GAS_CRESP 0x0d
/* Action value for GAS Comback Response AF */
#define P2PSD_AD_EID 0x6c
/* Advertisement Protocol IE ID */
#define P2PSD_ADP_TUPLE_QLMT_PAMEBI 0x00
/* Query Response Length Limit 7 bits plus PAME-BI 1 bit */
#define P2PSD_ADP_PROTO_ID 0x00
/* Advertisement Protocol ID. Always 0 for P2P SD */
#define P2PSD_GAS_OUI P2P_OUI
/* WFA OUI */
#define P2PSD_GAS_OUI_SUBTYPE P2P_VER
/* OUI Subtype for GAS IE */
#define P2PSD_GAS_NQP_INFOID 0xDDDD
/* NQP Query Info ID: 56797 */
#define P2PSD_GAS_COMEBACKDEALY 0x00
/* Not used in the Native GAS protocol */
/* Service Protocol Type */
typedef enum p2psd_svc_protype {
SVC_RPOTYPE_ALL = 0,
SVC_RPOTYPE_BONJOUR = 1,
SVC_RPOTYPE_UPNP = 2,
SVC_RPOTYPE_WSD = 3,
SVC_RPOTYPE_VENDOR = 255
} p2psd_svc_protype_t;
/* Service Discovery response status code */
typedef enum {
P2PSD_RESP_STATUS_SUCCESS = 0,
P2PSD_RESP_STATUS_PROTYPE_NA = 1,
P2PSD_RESP_STATUS_DATA_NA = 2,
P2PSD_RESP_STATUS_BAD_REQUEST = 3
} p2psd_resp_status_t;
/* Advertisement Protocol IE tuple field */
BWL_PRE_PACKED_STRUCT struct wifi_p2psd_adp_tpl {
uint8 llm_pamebi; /* Query Response Length Limit bit 0-6, set to 0 plus
* Pre-Associated Message Exchange BSSID Independent bit 7, set to 0
*/
uint8 adp_id; /* Advertisement Protocol ID: 0 for NQP Native Query Protocol */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_adp_tpl wifi_p2psd_adp_tpl_t;
/* Advertisement Protocol IE */
BWL_PRE_PACKED_STRUCT struct wifi_p2psd_adp_ie {
uint8 id; /* IE ID: 0x6c - 108 */
uint8 len; /* IE length */
wifi_p2psd_adp_tpl_t adp_tpl; /* Advertisement Protocol Tuple field. Only one
* tuple is defined for P2P Service Discovery
*/
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_adp_ie wifi_p2psd_adp_ie_t;
/* NQP Vendor-specific Content */
BWL_PRE_PACKED_STRUCT struct wifi_p2psd_nqp_query_vsc {
uint8 oui_subtype; /* OUI Subtype: 0x09 */
uint16 svc_updi; /* Service Update Indicator */
uint8 svc_tlvs[1]; /* wifi_p2psd_qreq_tlv_t type for service request,
* wifi_p2psd_qresp_tlv_t type for service response
*/
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_nqp_query_vsc wifi_p2psd_nqp_query_vsc_t;
/* Service Request TLV */
BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qreq_tlv {
uint16 len; /* Length: 5 plus size of Query Data */
uint8 svc_prot; /* Service Protocol Type */
uint8 svc_tscid; /* Service Transaction ID */
uint8 query_data[1]; /* Query Data, passed in from above Layer 2 */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_qreq_tlv wifi_p2psd_qreq_tlv_t;
/* Query Request Frame, defined in generic format, instead of NQP specific */
BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qreq_frame {
uint16 info_id; /* Info ID: 0xDDDD */
uint16 len; /* Length of service request TLV, 5 plus the size of request data */
uint8 oui[3]; /* WFA OUI: 0x0050F2 */
uint8 qreq_vsc[1]; /* Vendor-specific Content: wifi_p2psd_nqp_query_vsc_t type for NQP */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_qreq_frame wifi_p2psd_qreq_frame_t;
/* GAS Initial Request AF body, "elts" in wifi_p2p_pub_act_frame */
BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_ireq_frame {
wifi_p2psd_adp_ie_t adp_ie; /* Advertisement Protocol IE */
uint16 qreq_len; /* Query Request Length */
uint8 qreq_frm[1]; /* Query Request Frame wifi_p2psd_qreq_frame_t */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_gas_ireq_frame wifi_p2psd_gas_ireq_frame_t;
/* Service Response TLV */
BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qresp_tlv {
uint16 len; /* Length: 5 plus size of Query Data */
uint8 svc_prot; /* Service Protocol Type */
uint8 svc_tscid; /* Service Transaction ID */
uint8 status; /* Value defined in Table 57 of P2P spec. */
uint8 query_data[1]; /* Response Data, passed in from above Layer 2 */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_qresp_tlv wifi_p2psd_qresp_tlv_t;
/* Query Response Frame, defined in generic format, instead of NQP specific */
BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qresp_frame {
uint16 info_id; /* Info ID: 0xDDDD */
uint16 len; /* Lenth of service response TLV, 6 plus the size of resp data */
uint8 oui[3]; /* WFA OUI: 0x0050F2 */
uint8 qresp_vsc[1]; /* Vendor-specific Content: wifi_p2psd_qresp_tlv_t type for NQP */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_qresp_frame wifi_p2psd_qresp_frame_t;
/* GAS Initial Response AF body, "elts" in wifi_p2p_pub_act_frame */
BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_iresp_frame {
uint16 status; /* Value defined in Table 7-23 of IEEE P802.11u */
uint16 cb_delay; /* GAS Comeback Delay */
wifi_p2psd_adp_ie_t adp_ie; /* Advertisement Protocol IE */
uint16 qresp_len; /* Query Response Length */
uint8 qresp_frm[1]; /* Query Response Frame wifi_p2psd_qresp_frame_t */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_gas_iresp_frame wifi_p2psd_gas_iresp_frame_t;
/* GAS Comeback Response AF body, "elts" in wifi_p2p_pub_act_frame */
BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_cresp_frame {
uint16 status; /* Value defined in Table 7-23 of IEEE P802.11u */
uint8 fragment_id; /* Fragmentation ID */
uint16 cb_delay; /* GAS Comeback Delay */
wifi_p2psd_adp_ie_t adp_ie; /* Advertisement Protocol IE */
uint16 qresp_len; /* Query Response Length */
uint8 qresp_frm[1]; /* Query Response Frame wifi_p2psd_qresp_frame_t */
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_gas_cresp_frame wifi_p2psd_gas_cresp_frame_t;
/* Wi-Fi GAS Public Action Frame */
BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_pub_act_frame {
uint8 category; /* 0x04 Public Action Frame */
uint8 action; /* 0x6c Advertisement Protocol */
uint8 dialog_token; /* nonzero, identifies req/rsp transaction */
uint8 query_data[1]; /* Query Data. wifi_p2psd_gas_ireq_frame_t
* or wifi_p2psd_gas_iresp_frame_t format
*/
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_gas_pub_act_frame wifi_p2psd_gas_pub_act_frame_t;
/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
#endif /* _P2P_H_ */

View File

@@ -0,0 +1,57 @@
/*
* SD-SPI Protocol Standard
*
* $ Copyright Open Broadcom Corporation $
*
* $Id: sdspi.h 241182 2011-02-17 21:50:03Z $
*/
#ifndef _SD_SPI_H
#define _SD_SPI_H
#define SPI_START_M BITFIELD_MASK(1) /* Bit [31] - Start Bit */
#define SPI_START_S 31
#define SPI_DIR_M BITFIELD_MASK(1) /* Bit [30] - Direction */
#define SPI_DIR_S 30
#define SPI_CMD_INDEX_M BITFIELD_MASK(6) /* Bits [29:24] - Command number */
#define SPI_CMD_INDEX_S 24
#define SPI_RW_M BITFIELD_MASK(1) /* Bit [23] - Read=0, Write=1 */
#define SPI_RW_S 23
#define SPI_FUNC_M BITFIELD_MASK(3) /* Bits [22:20] - Function Number */
#define SPI_FUNC_S 20
#define SPI_RAW_M BITFIELD_MASK(1) /* Bit [19] - Read After Wr */
#define SPI_RAW_S 19
#define SPI_STUFF_M BITFIELD_MASK(1) /* Bit [18] - Stuff bit */
#define SPI_STUFF_S 18
#define SPI_BLKMODE_M BITFIELD_MASK(1) /* Bit [19] - Blockmode 1=blk */
#define SPI_BLKMODE_S 19
#define SPI_OPCODE_M BITFIELD_MASK(1) /* Bit [18] - OP Code */
#define SPI_OPCODE_S 18
#define SPI_ADDR_M BITFIELD_MASK(17) /* Bits [17:1] - Address */
#define SPI_ADDR_S 1
#define SPI_STUFF0_M BITFIELD_MASK(1) /* Bit [0] - Stuff bit */
#define SPI_STUFF0_S 0
#define SPI_RSP_START_M BITFIELD_MASK(1) /* Bit [7] - Start Bit (always 0) */
#define SPI_RSP_START_S 7
#define SPI_RSP_PARAM_ERR_M BITFIELD_MASK(1) /* Bit [6] - Parameter Error */
#define SPI_RSP_PARAM_ERR_S 6
#define SPI_RSP_RFU5_M BITFIELD_MASK(1) /* Bit [5] - RFU (Always 0) */
#define SPI_RSP_RFU5_S 5
#define SPI_RSP_FUNC_ERR_M BITFIELD_MASK(1) /* Bit [4] - Function number error */
#define SPI_RSP_FUNC_ERR_S 4
#define SPI_RSP_CRC_ERR_M BITFIELD_MASK(1) /* Bit [3] - COM CRC Error */
#define SPI_RSP_CRC_ERR_S 3
#define SPI_RSP_ILL_CMD_M BITFIELD_MASK(1) /* Bit [2] - Illegal Command error */
#define SPI_RSP_ILL_CMD_S 2
#define SPI_RSP_RFU1_M BITFIELD_MASK(1) /* Bit [1] - RFU (Always 0) */
#define SPI_RSP_RFU1_S 1
#define SPI_RSP_IDLE_M BITFIELD_MASK(1) /* Bit [0] - In idle state */
#define SPI_RSP_IDLE_S 0
/* SD-SPI Protocol Definitions */
#define SDSPI_COMMAND_LEN 6 /* Number of bytes in an SD command */
#define SDSPI_START_BLOCK 0xFE /* SD Start Block Token */
#define SDSPI_IDLE_PAD 0xFF /* SD-SPI idle value for MOSI */
#define SDSPI_START_BIT_MASK 0x80
#endif /* _SD_SPI_H */

View File

@@ -0,0 +1,77 @@
/*
* 802.1Q VLAN protocol definitions
*
* $Copyright Open Broadcom Corporation$
*
* $Id: vlan.h 352279 2012-08-22 07:21:57Z cylee $
*/
#ifndef _vlan_h_
#define _vlan_h_
#ifndef _TYPEDEFS_H_
#include <typedefs.h>
#endif
/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
#ifndef VLAN_VID_MASK
#define VLAN_VID_MASK 0xfff /* low 12 bits are vlan id */
#endif
#define VLAN_CFI_SHIFT 12 /* canonical format indicator bit */
#define VLAN_PRI_SHIFT 13 /* user priority */
#define VLAN_PRI_MASK 7 /* 3 bits of priority */
#define VLAN_TPID_OFFSET 12 /* offset of tag protocol id field */
#define VLAN_TCI_OFFSET 14 /* offset of tag ctrl info field */
#define VLAN_TAG_LEN 4
#define VLAN_TAG_OFFSET (2 * ETHER_ADDR_LEN) /* offset in Ethernet II packet only */
#define VLAN_TPID 0x8100 /* VLAN ethertype/Tag Protocol ID */
struct vlan_header {
uint16 vlan_type; /* 0x8100 */
uint16 vlan_tag; /* priority, cfi and vid */
};
struct ethervlan_header {
uint8 ether_dhost[ETHER_ADDR_LEN];
uint8 ether_shost[ETHER_ADDR_LEN];
uint16 vlan_type; /* 0x8100 */
uint16 vlan_tag; /* priority, cfi and vid */
uint16 ether_type;
};
struct dot3_mac_llc_snapvlan_header {
uint8 ether_dhost[ETHER_ADDR_LEN]; /* dest mac */
uint8 ether_shost[ETHER_ADDR_LEN]; /* src mac */
uint16 length; /* frame length incl header */
uint8 dsap; /* always 0xAA */
uint8 ssap; /* always 0xAA */
uint8 ctl; /* always 0x03 */
uint8 oui[3]; /* RFC1042: 0x00 0x00 0x00
* Bridge-Tunnel: 0x00 0x00 0xF8
*/
uint16 vlan_type; /* 0x8100 */
uint16 vlan_tag; /* priority, cfi and vid */
uint16 ether_type; /* ethertype */
};
#define ETHERVLAN_HDR_LEN (ETHER_HDR_LEN + VLAN_TAG_LEN)
/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
#define ETHERVLAN_MOVE_HDR(d, s) \
do { \
struct ethervlan_header t; \
t = *(struct ethervlan_header *)(s); \
*(struct ethervlan_header *)(d) = t; \
} while (0)
#endif /* _vlan_h_ */

View File

@@ -0,0 +1,196 @@
/*
* Fundamental types and constants relating to WPA
*
* $Copyright Open Broadcom Corporation$
*
* $Id: wpa.h 367468 2012-11-08 05:49:44Z cylee $
*/
#ifndef _proto_wpa_h_
#define _proto_wpa_h_
#include <typedefs.h>
#include <proto/ethernet.h>
/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
/* Reason Codes */
/* 13 through 23 taken from IEEE Std 802.11i-2004 */
#define DOT11_RC_INVALID_WPA_IE 13 /* Invalid info. element */
#define DOT11_RC_MIC_FAILURE 14 /* Michael failure */
#define DOT11_RC_4WH_TIMEOUT 15 /* 4-way handshake timeout */
#define DOT11_RC_GTK_UPDATE_TIMEOUT 16 /* Group key update timeout */
#define DOT11_RC_WPA_IE_MISMATCH 17 /* WPA IE in 4-way handshake differs from
* (re-)assoc. request/probe response
*/
#define DOT11_RC_INVALID_MC_CIPHER 18 /* Invalid multicast cipher */
#define DOT11_RC_INVALID_UC_CIPHER 19 /* Invalid unicast cipher */
#define DOT11_RC_INVALID_AKMP 20 /* Invalid authenticated key management protocol */
#define DOT11_RC_BAD_WPA_VERSION 21 /* Unsupported WPA version */
#define DOT11_RC_INVALID_WPA_CAP 22 /* Invalid WPA IE capabilities */
#define DOT11_RC_8021X_AUTH_FAIL 23 /* 802.1X authentication failure */
#define WPA2_PMKID_LEN 16
/* WPA IE fixed portion */
typedef BWL_PRE_PACKED_STRUCT struct
{
uint8 tag; /* TAG */
uint8 length; /* TAG length */
uint8 oui[3]; /* IE OUI */
uint8 oui_type; /* OUI type */
BWL_PRE_PACKED_STRUCT struct {
uint8 low;
uint8 high;
} BWL_POST_PACKED_STRUCT version; /* IE version */
} BWL_POST_PACKED_STRUCT wpa_ie_fixed_t;
#define WPA_IE_OUITYPE_LEN 4
#define WPA_IE_FIXED_LEN 8
#define WPA_IE_TAG_FIXED_LEN 6
typedef BWL_PRE_PACKED_STRUCT struct {
uint8 tag; /* TAG */
uint8 length; /* TAG length */
BWL_PRE_PACKED_STRUCT struct {
uint8 low;
uint8 high;
} BWL_POST_PACKED_STRUCT version; /* IE version */
} BWL_POST_PACKED_STRUCT wpa_rsn_ie_fixed_t;
#define WPA_RSN_IE_FIXED_LEN 4
#define WPA_RSN_IE_TAG_FIXED_LEN 2
typedef uint8 wpa_pmkid_t[WPA2_PMKID_LEN];
/* WPA suite/multicast suite */
typedef BWL_PRE_PACKED_STRUCT struct
{
uint8 oui[3];
uint8 type;
} BWL_POST_PACKED_STRUCT wpa_suite_t, wpa_suite_mcast_t;
#define WPA_SUITE_LEN 4
/* WPA unicast suite list/key management suite list */
typedef BWL_PRE_PACKED_STRUCT struct
{
BWL_PRE_PACKED_STRUCT struct {
uint8 low;
uint8 high;
} BWL_POST_PACKED_STRUCT count;
wpa_suite_t list[1];
} BWL_POST_PACKED_STRUCT wpa_suite_ucast_t, wpa_suite_auth_key_mgmt_t;
#define WPA_IE_SUITE_COUNT_LEN 2
typedef BWL_PRE_PACKED_STRUCT struct
{
BWL_PRE_PACKED_STRUCT struct {
uint8 low;
uint8 high;
} BWL_POST_PACKED_STRUCT count;
wpa_pmkid_t list[1];
} BWL_POST_PACKED_STRUCT wpa_pmkid_list_t;
/* WPA cipher suites */
#define WPA_CIPHER_NONE 0 /* None */
#define WPA_CIPHER_WEP_40 1 /* WEP (40-bit) */
#define WPA_CIPHER_TKIP 2 /* TKIP: default for WPA */
#define WPA_CIPHER_AES_OCB 3 /* AES (OCB) */
#define WPA_CIPHER_AES_CCM 4 /* AES (CCM) */
#define WPA_CIPHER_WEP_104 5 /* WEP (104-bit) */
#define WPA_CIPHER_BIP 6 /* WEP (104-bit) */
#define WPA_CIPHER_TPK 7 /* Group addressed traffic not allowed */
#ifdef BCMCCX
#define WPA_CIPHER_CKIP 8 /* KP with no MIC */
#define WPA_CIPHER_CKIP_MMH 9 /* KP with MIC ("CKIP/MMH", "CKIP+CMIC") */
#define WPA_CIPHER_WEP_MMH 10 /* MIC with no KP ("WEP/MMH", "CMIC") */
#define IS_CCX_CIPHER(cipher) ((cipher) == WPA_CIPHER_CKIP || \
(cipher) == WPA_CIPHER_CKIP_MMH || \
(cipher) == WPA_CIPHER_WEP_MMH)
#endif
#ifdef BCMWAPI_WAI
#define WAPI_CIPHER_NONE WPA_CIPHER_NONE
#define WAPI_CIPHER_SMS4 11
#define WAPI_CSE_WPI_SMS4 1
#endif /* BCMWAPI_WAI */
#define IS_WPA_CIPHER(cipher) ((cipher) == WPA_CIPHER_NONE || \
(cipher) == WPA_CIPHER_WEP_40 || \
(cipher) == WPA_CIPHER_WEP_104 || \
(cipher) == WPA_CIPHER_TKIP || \
(cipher) == WPA_CIPHER_AES_OCB || \
(cipher) == WPA_CIPHER_AES_CCM || \
(cipher) == WPA_CIPHER_TPK)
#ifdef BCMWAPI_WAI
#define IS_WAPI_CIPHER(cipher) ((cipher) == WAPI_CIPHER_NONE || \
(cipher) == WAPI_CSE_WPI_SMS4)
/* convert WAPI_CSE_WPI_XXX to WAPI_CIPHER_XXX */
#define WAPI_CSE_WPI_2_CIPHER(cse) ((cse) == WAPI_CSE_WPI_SMS4 ? \
WAPI_CIPHER_SMS4 : WAPI_CIPHER_NONE)
#define WAPI_CIPHER_2_CSE_WPI(cipher) ((cipher) == WAPI_CIPHER_SMS4 ? \
WAPI_CSE_WPI_SMS4 : WAPI_CIPHER_NONE)
#endif /* BCMWAPI_WAI */
/* WPA TKIP countermeasures parameters */
#define WPA_TKIP_CM_DETECT 60 /* multiple MIC failure window (seconds) */
#define WPA_TKIP_CM_BLOCK 60 /* countermeasures active window (seconds) */
/* RSN IE defines */
#define RSN_CAP_LEN 2 /* Length of RSN capabilities field (2 octets) */
/* RSN Capabilities defined in 802.11i */
#define RSN_CAP_PREAUTH 0x0001
#define RSN_CAP_NOPAIRWISE 0x0002
#define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C
#define RSN_CAP_PTK_REPLAY_CNTR_SHIFT 2
#define RSN_CAP_GTK_REPLAY_CNTR_MASK 0x0030
#define RSN_CAP_GTK_REPLAY_CNTR_SHIFT 4
#define RSN_CAP_1_REPLAY_CNTR 0
#define RSN_CAP_2_REPLAY_CNTRS 1
#define RSN_CAP_4_REPLAY_CNTRS 2
#define RSN_CAP_16_REPLAY_CNTRS 3
#define RSN_CAP_MFPR 0x0040
#define RSN_CAP_MFPC 0x0080
#define RSN_CAP_SPPC 0x0400
#define RSN_CAP_SPPR 0x0800
/* WPA capabilities defined in 802.11i */
#define WPA_CAP_4_REPLAY_CNTRS RSN_CAP_4_REPLAY_CNTRS
#define WPA_CAP_16_REPLAY_CNTRS RSN_CAP_16_REPLAY_CNTRS
#define WPA_CAP_REPLAY_CNTR_SHIFT RSN_CAP_PTK_REPLAY_CNTR_SHIFT
#define WPA_CAP_REPLAY_CNTR_MASK RSN_CAP_PTK_REPLAY_CNTR_MASK
/* WPA capabilities defined in 802.11zD9.0 */
#define WPA_CAP_PEER_KEY_ENABLE (0x1 << 1) /* bit 9 */
/* WPA Specific defines */
#define WPA_CAP_LEN RSN_CAP_LEN /* Length of RSN capabilities in RSN IE (2 octets) */
#define WPA_PMKID_CNT_LEN 2 /* Length of RSN PMKID count (2 octests) */
#define WPA_CAP_WPA2_PREAUTH RSN_CAP_PREAUTH
#define WPA2_PMKID_COUNT_LEN 2
#ifdef BCMWAPI_WAI
#define WAPI_CAP_PREAUTH RSN_CAP_PREAUTH
/* Other WAI definition */
#define WAPI_WAI_REQUEST 0x00F1
#define WAPI_UNICAST_REKEY 0x00F2
#define WAPI_STA_AGING 0x00F3
#define WAPI_MUTIL_REKEY 0x00F4
#define WAPI_STA_STATS 0x00F5
#define WAPI_USK_REKEY_COUNT 0x4000000 /* 0xA00000 */
#define WAPI_MSK_REKEY_COUNT 0x4000000 /* 0xA00000 */
#endif /* BCMWAPI_WAI */
/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
#endif /* _proto_wpa_h_ */

View File

@@ -0,0 +1,361 @@
/*
* WPS IE definitions
*
* $Copyright Open Broadcom Corporation$
*
* $Id$
*/
#ifndef _WPS_
#define _WPS_
#ifdef __cplusplus
extern "C" {
#endif
/* Data Element Definitions */
#define WPS_ID_AP_CHANNEL 0x1001
#define WPS_ID_ASSOC_STATE 0x1002
#define WPS_ID_AUTH_TYPE 0x1003
#define WPS_ID_AUTH_TYPE_FLAGS 0x1004
#define WPS_ID_AUTHENTICATOR 0x1005
#define WPS_ID_CONFIG_METHODS 0x1008
#define WPS_ID_CONFIG_ERROR 0x1009
#define WPS_ID_CONF_URL4 0x100A
#define WPS_ID_CONF_URL6 0x100B
#define WPS_ID_CONN_TYPE 0x100C
#define WPS_ID_CONN_TYPE_FLAGS 0x100D
#define WPS_ID_CREDENTIAL 0x100E
#define WPS_ID_DEVICE_NAME 0x1011
#define WPS_ID_DEVICE_PWD_ID 0x1012
#define WPS_ID_E_HASH1 0x1014
#define WPS_ID_E_HASH2 0x1015
#define WPS_ID_E_SNONCE1 0x1016
#define WPS_ID_E_SNONCE2 0x1017
#define WPS_ID_ENCR_SETTINGS 0x1018
#define WPS_ID_ENCR_TYPE 0x100F
#define WPS_ID_ENCR_TYPE_FLAGS 0x1010
#define WPS_ID_ENROLLEE_NONCE 0x101A
#define WPS_ID_FEATURE_ID 0x101B
#define WPS_ID_IDENTITY 0x101C
#define WPS_ID_IDENTITY_PROOF 0x101D
#define WPS_ID_KEY_WRAP_AUTH 0x101E
#define WPS_ID_KEY_IDENTIFIER 0x101F
#define WPS_ID_MAC_ADDR 0x1020
#define WPS_ID_MANUFACTURER 0x1021
#define WPS_ID_MSG_TYPE 0x1022
#define WPS_ID_MODEL_NAME 0x1023
#define WPS_ID_MODEL_NUMBER 0x1024
#define WPS_ID_NW_INDEX 0x1026
#define WPS_ID_NW_KEY 0x1027
#define WPS_ID_NW_KEY_INDEX 0x1028
#define WPS_ID_NEW_DEVICE_NAME 0x1029
#define WPS_ID_NEW_PWD 0x102A
#define WPS_ID_OOB_DEV_PWD 0x102C
#define WPS_ID_OS_VERSION 0x102D
#define WPS_ID_POWER_LEVEL 0x102F
#define WPS_ID_PSK_CURRENT 0x1030
#define WPS_ID_PSK_MAX 0x1031
#define WPS_ID_PUBLIC_KEY 0x1032
#define WPS_ID_RADIO_ENABLED 0x1033
#define WPS_ID_REBOOT 0x1034
#define WPS_ID_REGISTRAR_CURRENT 0x1035
#define WPS_ID_REGISTRAR_ESTBLSHD 0x1036
#define WPS_ID_REGISTRAR_LIST 0x1037
#define WPS_ID_REGISTRAR_MAX 0x1038
#define WPS_ID_REGISTRAR_NONCE 0x1039
#define WPS_ID_REQ_TYPE 0x103A
#define WPS_ID_RESP_TYPE 0x103B
#define WPS_ID_RF_BAND 0x103C
#define WPS_ID_R_HASH1 0x103D
#define WPS_ID_R_HASH2 0x103E
#define WPS_ID_R_SNONCE1 0x103F
#define WPS_ID_R_SNONCE2 0x1040
#define WPS_ID_SEL_REGISTRAR 0x1041
#define WPS_ID_SERIAL_NUM 0x1042
#define WPS_ID_SC_STATE 0x1044
#define WPS_ID_SSID 0x1045
#define WPS_ID_TOT_NETWORKS 0x1046
#define WPS_ID_UUID_E 0x1047
#define WPS_ID_UUID_R 0x1048
#define WPS_ID_VENDOR_EXT 0x1049
#define WPS_ID_VERSION 0x104A
#define WPS_ID_X509_CERT_REQ 0x104B
#define WPS_ID_X509_CERT 0x104C
#define WPS_ID_EAP_IDENTITY 0x104D
#define WPS_ID_MSG_COUNTER 0x104E
#define WPS_ID_PUBKEY_HASH 0x104F
#define WPS_ID_REKEY_KEY 0x1050
#define WPS_ID_KEY_LIFETIME 0x1051
#define WPS_ID_PERM_CFG_METHODS 0x1052
#define WPS_ID_SEL_REG_CFG_METHODS 0x1053
#define WPS_ID_PRIM_DEV_TYPE 0x1054
#define WPS_ID_SEC_DEV_TYPE_LIST 0x1055
#define WPS_ID_PORTABLE_DEVICE 0x1056
#define WPS_ID_AP_SETUP_LOCKED 0x1057
#define WPS_ID_APP_LIST 0x1058
#define WPS_ID_EAP_TYPE 0x1059
#define WPS_ID_INIT_VECTOR 0x1060
#define WPS_ID_KEY_PROVIDED_AUTO 0x1061
#define WPS_ID_8021X_ENABLED 0x1062
#define WPS_ID_WEP_TRANSMIT_KEY 0x1064
#define WPS_ID_REQ_DEV_TYPE 0x106A
/* WSC 2.0, WFA Vendor Extension Subelements */
#define WFA_VENDOR_EXT_ID "\x00\x37\x2A"
#define WPS_WFA_SUBID_VERSION2 0x00
#define WPS_WFA_SUBID_AUTHORIZED_MACS 0x01
#define WPS_WFA_SUBID_NW_KEY_SHAREABLE 0x02
#define WPS_WFA_SUBID_REQ_TO_ENROLL 0x03
#define WPS_WFA_SUBID_SETTINGS_DELAY_TIME 0x04
/* WCN-NET Windows Rally Vertical Pairing Vendor Extensions */
#define MS_VENDOR_EXT_ID "\x00\x01\x37"
#define WPS_MS_ID_VPI 0x1001 /* Vertical Pairing Identifier TLV */
#define WPS_MS_ID_TRANSPORT_UUID 0x1002 /* Transport UUID TLV */
/* Vertical Pairing Identifier TLV Definitions */
#define WPS_MS_VPI_TRANSPORT_NONE 0x00 /* None */
#define WPS_MS_VPI_TRANSPORT_DPWS 0x01 /* Devices Profile for Web Services */
#define WPS_MS_VPI_TRANSPORT_UPNP 0x02 /* uPnP */
#define WPS_MS_VPI_TRANSPORT_SDNWS 0x03 /* Secure Devices Profile for Web Services */
#define WPS_MS_VPI_NO_PROFILE_REQ 0x00 /* Wi-Fi profile not requested.
* Not supported in Windows 7
*/
#define WPS_MS_VPI_PROFILE_REQ 0x01 /* Wi-Fi profile requested. */
/* sizes of the fixed size elements */
#define WPS_ID_AP_CHANNEL_S 2
#define WPS_ID_ASSOC_STATE_S 2
#define WPS_ID_AUTH_TYPE_S 2
#define WPS_ID_AUTH_TYPE_FLAGS_S 2
#define WPS_ID_AUTHENTICATOR_S 8
#define WPS_ID_CONFIG_METHODS_S 2
#define WPS_ID_CONFIG_ERROR_S 2
#define WPS_ID_CONN_TYPE_S 1
#define WPS_ID_CONN_TYPE_FLAGS_S 1
#define WPS_ID_DEVICE_PWD_ID_S 2
#define WPS_ID_ENCR_TYPE_S 2
#define WPS_ID_ENCR_TYPE_FLAGS_S 2
#define WPS_ID_FEATURE_ID_S 4
#define WPS_ID_MAC_ADDR_S 6
#define WPS_ID_MSG_TYPE_S 1
#define WPS_ID_SC_STATE_S 1
#define WPS_ID_RF_BAND_S 1
#define WPS_ID_OS_VERSION_S 4
#define WPS_ID_VERSION_S 1
#define WPS_ID_SEL_REGISTRAR_S 1
#define WPS_ID_SEL_REG_CFG_METHODS_S 2
#define WPS_ID_REQ_TYPE_S 1
#define WPS_ID_RESP_TYPE_S 1
#define WPS_ID_AP_SETUP_LOCKED_S 1
/* WSC 2.0, WFA Vendor Extension Subelements */
#define WPS_WFA_SUBID_VERSION2_S 1
#define WPS_WFA_SUBID_NW_KEY_SHAREABLE_S 1
#define WPS_WFA_SUBID_REQ_TO_ENROLL_S 1
#define WPS_WFA_SUBID_SETTINGS_DELAY_TIME_S 1
/* Association states */
#define WPS_ASSOC_NOT_ASSOCIATED 0
#define WPS_ASSOC_CONN_SUCCESS 1
#define WPS_ASSOC_CONFIG_FAIL 2
#define WPS_ASSOC_ASSOC_FAIL 3
#define WPS_ASSOC_IP_FAIL 4
/* Authentication types */
#define WPS_AUTHTYPE_OPEN 0x0001
#define WPS_AUTHTYPE_WPAPSK 0x0002 /* Deprecated in WSC 2.0 */
#define WPS_AUTHTYPE_SHARED 0x0004 /* Deprecated in WSC 2.0 */
#define WPS_AUTHTYPE_WPA 0x0008 /* Deprecated in WSC 2.0 */
#define WPS_AUTHTYPE_WPA2 0x0010
#define WPS_AUTHTYPE_WPA2PSK 0x0020
/* Config methods */
#define WPS_CONFMET_USBA 0x0001 /* Deprecated in WSC 2.0 */
#define WPS_CONFMET_ETHERNET 0x0002 /* Deprecated in WSC 2.0 */
#define WPS_CONFMET_LABEL 0x0004
#define WPS_CONFMET_DISPLAY 0x0008
#define WPS_CONFMET_EXT_NFC_TOK 0x0010
#define WPS_CONFMET_INT_NFC_TOK 0x0020
#define WPS_CONFMET_NFC_INTF 0x0040
#define WPS_CONFMET_PBC 0x0080
#define WPS_CONFMET_KEYPAD 0x0100
/* WSC 2.0 */
#define WPS_CONFMET_VIRT_PBC 0x0280
#define WPS_CONFMET_PHY_PBC 0x0480
#define WPS_CONFMET_VIRT_DISPLAY 0x2008
#define WPS_CONFMET_PHY_DISPLAY 0x4008
/* WPS error messages */
#define WPS_ERROR_NO_ERROR 0
#define WPS_ERROR_OOB_INT_READ_ERR 1
#define WPS_ERROR_DECRYPT_CRC_FAIL 2
#define WPS_ERROR_CHAN24_NOT_SUPP 3
#define WPS_ERROR_CHAN50_NOT_SUPP 4
#define WPS_ERROR_SIGNAL_WEAK 5 /* Deprecated in WSC 2.0 */
#define WPS_ERROR_NW_AUTH_FAIL 6 /* Deprecated in WSC 2.0 */
#define WPS_ERROR_NW_ASSOC_FAIL 7 /* Deprecated in WSC 2.0 */
#define WPS_ERROR_NO_DHCP_RESP 8 /* Deprecated in WSC 2.0 */
#define WPS_ERROR_FAILED_DHCP_CONF 9 /* Deprecated in WSC 2.0 */
#define WPS_ERROR_IP_ADDR_CONFLICT 10 /* Deprecated in WSC 2.0 */
#define WPS_ERROR_FAIL_CONN_REGISTRAR 11
#define WPS_ERROR_MULTI_PBC_DETECTED 12
#define WPS_ERROR_ROGUE_SUSPECTED 13
#define WPS_ERROR_DEVICE_BUSY 14
#define WPS_ERROR_SETUP_LOCKED 15
#define WPS_ERROR_MSG_TIMEOUT 16 /* Deprecated in WSC 2.0 */
#define WPS_ERROR_REG_SESSION_TIMEOUT 17 /* Deprecated in WSC 2.0 */
#define WPS_ERROR_DEV_PWD_AUTH_FAIL 18
/* Connection types */
#define WPS_CONNTYPE_ESS 0x01
#define WPS_CONNTYPE_IBSS 0x02
/* Device password ID */
#define WPS_DEVICEPWDID_DEFAULT 0x0000
#define WPS_DEVICEPWDID_USER_SPEC 0x0001
#define WPS_DEVICEPWDID_MACHINE_SPEC 0x0002
#define WPS_DEVICEPWDID_REKEY 0x0003
#define WPS_DEVICEPWDID_PUSH_BTN 0x0004
#define WPS_DEVICEPWDID_REG_SPEC 0x0005
/* Encryption type */
#define WPS_ENCRTYPE_NONE 0x0001
#define WPS_ENCRTYPE_WEP 0x0002 /* Deprecated in WSC 2.0 */
#define WPS_ENCRTYPE_TKIP 0x0004 /* Deprecated in version 2.0. TKIP can only
* be advertised on the AP when Mixed Mode
* is enabled (Encryption Type is 0x000c).
*/
#define WPS_ENCRTYPE_AES 0x0008
/* WPS Message Types */
#define WPS_ID_BEACON 0x01
#define WPS_ID_PROBE_REQ 0x02
#define WPS_ID_PROBE_RESP 0x03
#define WPS_ID_MESSAGE_M1 0x04
#define WPS_ID_MESSAGE_M2 0x05
#define WPS_ID_MESSAGE_M2D 0x06
#define WPS_ID_MESSAGE_M3 0x07
#define WPS_ID_MESSAGE_M4 0x08
#define WPS_ID_MESSAGE_M5 0x09
#define WPS_ID_MESSAGE_M6 0x0A
#define WPS_ID_MESSAGE_M7 0x0B
#define WPS_ID_MESSAGE_M8 0x0C
#define WPS_ID_MESSAGE_ACK 0x0D
#define WPS_ID_MESSAGE_NACK 0x0E
#define WPS_ID_MESSAGE_DONE 0x0F
/* WSP private ID for local use */
#define WPS_PRIVATE_ID_IDENTITY (WPS_ID_MESSAGE_DONE + 1)
#define WPS_PRIVATE_ID_WPS_START (WPS_ID_MESSAGE_DONE + 2)
#define WPS_PRIVATE_ID_FAILURE (WPS_ID_MESSAGE_DONE + 3)
#define WPS_PRIVATE_ID_FRAG (WPS_ID_MESSAGE_DONE + 4)
#define WPS_PRIVATE_ID_FRAG_ACK (WPS_ID_MESSAGE_DONE + 5)
#define WPS_PRIVATE_ID_EAPOL_START (WPS_ID_MESSAGE_DONE + 6)
/* Device Type categories for primary and secondary device types */
#define WPS_DEVICE_TYPE_CAT_COMPUTER 1
#define WPS_DEVICE_TYPE_CAT_INPUT_DEVICE 2
#define WPS_DEVICE_TYPE_CAT_PRINTER 3
#define WPS_DEVICE_TYPE_CAT_CAMERA 4
#define WPS_DEVICE_TYPE_CAT_STORAGE 5
#define WPS_DEVICE_TYPE_CAT_NW_INFRA 6
#define WPS_DEVICE_TYPE_CAT_DISPLAYS 7
#define WPS_DEVICE_TYPE_CAT_MM_DEVICES 8
#define WPS_DEVICE_TYPE_CAT_GAME_DEVICES 9
#define WPS_DEVICE_TYPE_CAT_TELEPHONE 10
#define WPS_DEVICE_TYPE_CAT_AUDIO_DEVICES 11 /* WSC 2.0 */
/* Device Type sub categories for primary and secondary device types */
#define WPS_DEVICE_TYPE_SUB_CAT_COMP_PC 1
#define WPS_DEVICE_TYPE_SUB_CAT_COMP_SERVER 2
#define WPS_DEVICE_TYPE_SUB_CAT_COMP_MEDIA_CTR 3
#define WPS_DEVICE_TYPE_SUB_CAT_COMP_UM_PC 4 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_COMP_NOTEBOOK 5 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_COMP_DESKTOP 6 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_COMP_MID 7 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_COMP_NETBOOK 8 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_INP_Keyboard 1 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_INP_MOUSE 2 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_INP_JOYSTICK 3 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_INP_TRACKBALL 4 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_INP_GAM_CTRL 5 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_INP_REMOTE 6 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_INP_TOUCHSCREEN 7 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_INP_BIO_READER 8 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_INP_BAR_READER 9 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_PRTR_PRINTER 1
#define WPS_DEVICE_TYPE_SUB_CAT_PRTR_SCANNER 2
#define WPS_DEVICE_TYPE_SUB_CAT_PRTR_FAX 3 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_PRTR_COPIER 4 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_PRTR_ALLINONE 5 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_CAM_DGTL_STILL 1
#define WPS_DEVICE_TYPE_SUB_CAT_CAM_VIDEO_CAM 2 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_CAM_WEB_CAM 3 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_CAM_SECU_CAM 4 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_STOR_NAS 1
#define WPS_DEVICE_TYPE_SUB_CAT_NW_AP 1
#define WPS_DEVICE_TYPE_SUB_CAT_NW_ROUTER 2
#define WPS_DEVICE_TYPE_SUB_CAT_NW_SWITCH 3
#define WPS_DEVICE_TYPE_SUB_CAT_NW_GATEWAY 4 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_NW_BRIDGE 5 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_DISP_TV 1
#define WPS_DEVICE_TYPE_SUB_CAT_DISP_PIC_FRAME 2
#define WPS_DEVICE_TYPE_SUB_CAT_DISP_PROJECTOR 3
#define WPS_DEVICE_TYPE_SUB_CAT_DISP_MONITOR 4 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_MM_DAR 1
#define WPS_DEVICE_TYPE_SUB_CAT_MM_PVR 2
#define WPS_DEVICE_TYPE_SUB_CAT_MM_MCX 3
#define WPS_DEVICE_TYPE_SUB_CAT_MM_STB 4 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_MM_MS_ME 5 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_MM_PVP 6 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_GAM_XBOX 1
#define WPS_DEVICE_TYPE_SUB_CAT_GAM_XBOX_360 2
#define WPS_DEVICE_TYPE_SUB_CAT_GAM_PS 3
#define WPS_DEVICE_TYPE_SUB_CAT_GAM_GC 4 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_GAM_PGD 5 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_PHONE_WM 1
#define WPS_DEVICE_TYPE_SUB_CAT_PHONE_PSM 2 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_PHONE_PDM 3 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_PHONE_SSM 4 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_PHONE_SDM 5 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_AUDIO_TUNER 1 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_AUDIO_SPEAKERS 2 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_AUDIO_PMP 3 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_AUDIO_HEADSET 4 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_AUDIO_HPHONE 5 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_AUDIO_MPHONE 6 /* WSC 2.0 */
#define WPS_DEVICE_TYPE_SUB_CAT_AUDIO_HTS 7 /* WSC 2.0 */
/* Device request/response type */
#define WPS_MSGTYPE_ENROLLEE_INFO_ONLY 0x00
#define WPS_MSGTYPE_ENROLLEE_OPEN_8021X 0x01
#define WPS_MSGTYPE_REGISTRAR 0x02
#define WPS_MSGTYPE_AP_WLAN_MGR 0x03
/* RF Band */
#define WPS_RFBAND_24GHZ 0x01
#define WPS_RFBAND_50GHZ 0x02
/* Simple Config state */
#define WPS_SCSTATE_UNCONFIGURED 0x01
#define WPS_SCSTATE_CONFIGURED 0x02
#define WPS_SCSTATE_OFF 11
/* WPS Vendor extension key */
#define WPS_OUI_HEADER_LEN 2
#define WPS_OUI_HEADER_SIZE 4
#define WPS_OUI_FIXED_HEADER_OFF 16
#define WPS_WFA_SUBID_V2_OFF 3
#define WPS_WFA_V2_OFF 5
#ifdef __cplusplus
}
#endif
#endif /* _WPS_ */