fix ar7 default config
[openwrt.git] / openwrt / package / wificonf / include / proto / wpa.h
1 /*
2 * Fundamental types and constants relating to WPA
3 *
4 * Copyright 2005, Broadcom Corporation
5 * All Rights Reserved.
6 *
7 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11 *
12 * $Id$
13 */
14
15 #ifndef _proto_wpa_h_
16 #define _proto_wpa_h_
17
18 #include <typedefs.h>
19 #include <proto/ethernet.h>
20
21 /* enable structure packing */
22 #if defined(__GNUC__)
23 #define PACKED __attribute__((packed))
24 #else
25 #pragma pack(1)
26 #define PACKED
27 #endif
28
29 /* Reason Codes */
30
31 /* 10 and 11 are from TGh. */
32 #define DOT11_RC_BAD_PC 10 /* Unacceptable power capability element */
33 #define DOT11_RC_BAD_CHANNELS 11 /* Unacceptable supported channels element */
34 /* 12 is unused */
35 /* 13 through 23 taken from P802.11i/D3.0, November 2002 */
36 #define DOT11_RC_INVALID_WPA_IE 13 /* Invalid info. element */
37 #define DOT11_RC_MIC_FAILURE 14 /* Michael failure */
38 #define DOT11_RC_4WH_TIMEOUT 15 /* 4-way handshake timeout */
39 #define DOT11_RC_GTK_UPDATE_TIMEOUT 16 /* Group key update timeout */
40 #define DOT11_RC_WPA_IE_MISMATCH 17 /* WPA IE in 4-way handshake differs from (re-)assoc. request/probe response */
41 #define DOT11_RC_INVALID_MC_CIPHER 18 /* Invalid multicast cipher */
42 #define DOT11_RC_INVALID_UC_CIPHER 19 /* Invalid unicast cipher */
43 #define DOT11_RC_INVALID_AKMP 20 /* Invalid authenticated key management protocol */
44 #define DOT11_RC_BAD_WPA_VERSION 21 /* Unsupported WPA version */
45 #define DOT11_RC_INVALID_WPA_CAP 22 /* Invalid WPA IE capabilities */
46 #define DOT11_RC_8021X_AUTH_FAIL 23 /* 802.1X authentication failure */
47
48 #define WPA2_PMKID_LEN 16
49
50 /* WPA IE fixed portion */
51 typedef struct
52 {
53 uint8 tag; /* TAG */
54 uint8 length; /* TAG length */
55 uint8 oui[3]; /* IE OUI */
56 uint8 oui_type; /* OUI type */
57 struct {
58 uint8 low;
59 uint8 high;
60 } PACKED version; /* IE version */
61 } PACKED wpa_ie_fixed_t;
62 #define WPA_IE_OUITYPE_LEN 4
63 #define WPA_IE_FIXED_LEN 8
64 #define WPA_IE_TAG_FIXED_LEN 6
65
66 typedef struct {
67 uint8 tag; /* TAG */
68 uint8 length; /* TAG length */
69 struct {
70 uint8 low;
71 uint8 high;
72 } PACKED version; /* IE version */
73 } PACKED wpa_rsn_ie_fixed_t;
74 #define WPA_RSN_IE_FIXED_LEN 4
75 #define WPA_RSN_IE_TAG_FIXED_LEN 2
76 typedef uint8 wpa_pmkid_t[WPA2_PMKID_LEN];
77
78 /* WPA suite/multicast suite */
79 typedef struct
80 {
81 uint8 oui[3];
82 uint8 type;
83 } PACKED wpa_suite_t, wpa_suite_mcast_t;
84 #define WPA_SUITE_LEN 4
85
86 /* WPA unicast suite list/key management suite list */
87 typedef struct
88 {
89 struct {
90 uint8 low;
91 uint8 high;
92 } PACKED count;
93 wpa_suite_t list[1];
94 } PACKED wpa_suite_ucast_t, wpa_suite_auth_key_mgmt_t;
95 #define WPA_IE_SUITE_COUNT_LEN 2
96 typedef struct
97 {
98 struct {
99 uint8 low;
100 uint8 high;
101 } PACKED count;
102 wpa_pmkid_t list[1];
103 } PACKED wpa_pmkid_list_t;
104
105 /* WPA cipher suites */
106 #define WPA_CIPHER_NONE 0 /* None */
107 #define WPA_CIPHER_WEP_40 1 /* WEP (40-bit) */
108 #define WPA_CIPHER_TKIP 2 /* TKIP: default for WPA */
109 #define WPA_CIPHER_AES_OCB 3 /* AES (OCB) */
110 #define WPA_CIPHER_AES_CCM 4 /* AES (CCM) */
111 #define WPA_CIPHER_WEP_104 5 /* WEP (104-bit) */
112
113 #define IS_WPA_CIPHER(cipher) ((cipher) == WPA_CIPHER_NONE || \
114 (cipher) == WPA_CIPHER_WEP_40 || \
115 (cipher) == WPA_CIPHER_WEP_104 || \
116 (cipher) == WPA_CIPHER_TKIP || \
117 (cipher) == WPA_CIPHER_AES_OCB || \
118 (cipher) == WPA_CIPHER_AES_CCM)
119
120 /* WPA TKIP countermeasures parameters */
121 #define WPA_TKIP_CM_DETECT 60 /* multiple MIC failure window (seconds) */
122 #define WPA_TKIP_CM_BLOCK 60 /* countermeasures active window (seconds) */
123
124 /* WPA capabilities defined in 802.11i */
125 #define WPA_CAP_4_REPLAY_CNTRS 2
126 #define WPA_CAP_16_REPLAY_CNTRS 3
127 #define WPA_CAP_REPLAY_CNTR_SHIFT 2
128 #define WPA_CAP_REPLAY_CNTR_MASK 0x000c
129
130 /* WPA Specific defines */
131 #define WPA_CAP_LEN 2
132
133 #define WPA_CAP_WPA2_PREAUTH 1
134
135 #undef PACKED
136 #if !defined(__GNUC__)
137 #pragma pack()
138 #endif
139
140 #endif /* _proto_wpa_h_ */
This page took 0.046976 seconds and 5 git commands to generate.