Diffstat (limited to 'noncore/net/wellenreiter/daemon/source/ieee802_11.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/ieee802_11.h | 245 |
1 files changed, 245 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/ieee802_11.h b/noncore/net/wellenreiter/daemon/source/ieee802_11.h new file mode 100644 index 0000000..497e6ed --- a/dev/null +++ b/noncore/net/wellenreiter/daemon/source/ieee802_11.h | |||
@@ -0,0 +1,245 @@ | |||
1 | /* @(#) $Header$ (LBL) */ | ||
2 | /* | ||
3 | * Copyright (c) 2001 | ||
4 | *Fortress Technologies | ||
5 | * Charlie Lenahan ( clenahan@fortresstech.com ) | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that: (1) source code distributions | ||
9 | * retain the above copyright notice and this paragraph in its entirety, (2) | ||
10 | * distributions including binary code include the above copyright notice and | ||
11 | * this paragraph in its entirety in the documentation or other materials | ||
12 | * provided with the distribution, and (3) all advertising materials mentioning | ||
13 | * features or use of this software display the following acknowledgement: | ||
14 | * ``This product includes software developed by the University of California, | ||
15 | * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of | ||
16 | * the University nor the names of its contributors may be used to endorse | ||
17 | * or promote products derived from this software without specific prior | ||
18 | * written permission. | ||
19 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED | ||
20 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF | ||
21 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
22 | */ | ||
23 | |||
24 | #define IEEE802_11_FC_LEN2 | ||
25 | |||
26 | #define T_MGMT 0x0 /* management */ | ||
27 | #define T_CTRL 0x1 /* control */ | ||
28 | #define T_DATA 0x2 /* data */ | ||
29 | #define T_RESV 0x3 /* reserved */ | ||
30 | |||
31 | #define ST_ASSOC_REQUEST 0x0 | ||
32 | #define ST_ASSOC_RESPONSE 0x1 | ||
33 | #define ST_REASSOC_REQUEST 0x2 | ||
34 | #define ST_REASSOC_RESPONSE 0x3 | ||
35 | #define ST_PROBE_REQUEST 0x4 | ||
36 | #define ST_PROBE_RESPONSE 0x5 | ||
37 | /* RESERVED 0x6 */ | ||
38 | /* RESERVED 0x7 */ | ||
39 | #define ST_BEACON 0x8 | ||
40 | #define ST_ATIM 0x9 | ||
41 | #define ST_DISASSOC 0xA | ||
42 | #define ST_AUTH 0xB | ||
43 | #define ST_DEAUTH 0xC | ||
44 | /* RESERVED 0xD */ | ||
45 | /* RESERVED 0xE */ | ||
46 | /* RESERVED 0xF */ | ||
47 | |||
48 | |||
49 | #define CTRL_PS_POLL0xA | ||
50 | #define CTRL_RTS0xB | ||
51 | #define CTRL_CTS0xC | ||
52 | #define CTRL_ACK0xD | ||
53 | #define CTRL_CF_END0xE | ||
54 | #define CTRL_END_ACK0xF | ||
55 | |||
56 | /* | ||
57 | * Bits in the frame control field. | ||
58 | */ | ||
59 | #define FC_VERSION(fc) ((fc) & 0x3) | ||
60 | #define FC_TYPE(fc) (((fc) >> 2) & 0x3) | ||
61 | #define FC_SUBTYPE(fc) (((fc) >> 4) & 0xF) | ||
62 | #define FC_TO_DS(fc) ((fc) & 0x0100) | ||
63 | #define FC_FROM_DS(fc) ((fc) & 0x0200) | ||
64 | #define FC_MORE_FLAG(fc)((fc) & 0x0400) | ||
65 | #define FC_RETRY(fc) ((fc) & 0x0800) | ||
66 | #define FC_POWER_MGMT(fc)((fc) & 0x1000) | ||
67 | #define FC_MORE_DATA(fc)((fc) & 0x2000) | ||
68 | #define FC_WEP(fc) ((fc) & 0x4000) | ||
69 | #define FC_ORDER(fc) ((fc) & 0x8000) | ||
70 | |||
71 | struct mgmt_header_t { | ||
72 | u_int16_tfc; | ||
73 | u_int16_t duration; | ||
74 | u_int8_tda[6]; | ||
75 | u_int8_tsa[6]; | ||
76 | u_int8_tbssid[6]; | ||
77 | u_int16_tseq_ctrl; | ||
78 | }; | ||
79 | |||
80 | #define MGMT_HEADER_LEN(2+2+6+6+6+2) | ||
81 | |||
82 | #define CAPABILITY_ESS(cap)((cap) & 0x0001) | ||
83 | #define CAPABILITY_IBSS(cap)((cap) & 0x0002) | ||
84 | #define CAPABILITY_CFP(cap)((cap) & 0x0004) | ||
85 | #define CAPABILITY_CFP_REQ(cap)((cap) & 0x0008) | ||
86 | #define CAPABILITY_PRIVACY(cap)((cap) & 0x0010) | ||
87 | |||
88 | struct ssid_t { | ||
89 | u_int8_telement_id; | ||
90 | u_int8_tlength; | ||
91 | u_char ssid[33]; /* 32 + 1 for null */ | ||
92 | } ; | ||
93 | |||
94 | struct rates_t { | ||
95 | u_int8_telement_id; | ||
96 | u_int8_tlength; | ||
97 | u_int8_trate[8]; | ||
98 | }; | ||
99 | |||
100 | struct challenge_t { | ||
101 | u_int8_telement_id; | ||
102 | u_int8_tlength; | ||
103 | u_int8_ttext[254]; /* 1-253 + 1 for null */ | ||
104 | }; | ||
105 | struct fh_t { | ||
106 | u_int8_telement_id; | ||
107 | u_int8_tlength; | ||
108 | u_int16_tdwell_time; | ||
109 | u_int8_thop_set; | ||
110 | u_int8_t hop_pattern; | ||
111 | u_int8_thop_index; | ||
112 | }; | ||
113 | |||
114 | struct ds_t { | ||
115 | u_int8_telement_id; | ||
116 | u_int8_tlength; | ||
117 | u_int8_tchannel; | ||
118 | }; | ||
119 | |||
120 | struct cf_t { | ||
121 | u_int8_telement_id; | ||
122 | u_int8_tlength; | ||
123 | u_int8_tcount; | ||
124 | u_int8_tperiod; | ||
125 | u_int16_tmax_duration; | ||
126 | u_int16_tdur_remaing; | ||
127 | }; | ||
128 | |||
129 | struct tim_t { | ||
130 | u_int8_telement_id; | ||
131 | u_int8_tlength; | ||
132 | u_int8_tcount; | ||
133 | u_int8_tperiod; | ||
134 | u_int8_tbitmap_control; | ||
135 | u_int8_tbitmap[251]; | ||
136 | }; | ||
137 | |||
138 | #define E_SSID 0 | ||
139 | #define E_RATES 1 | ||
140 | #define E_FH 2 | ||
141 | #define E_DS 3 | ||
142 | #define E_CF 4 | ||
143 | #define E_TIM 5 | ||
144 | #define E_IBSS 6 | ||
145 | #define E_CISCO 133 | ||
146 | /* reserved 7 */ | ||
147 | /* reserved 8 */ | ||
148 | /* reserved 9 */ | ||
149 | /* reserved 10 */ | ||
150 | /* reserved 11 */ | ||
151 | /* reserved 12 */ | ||
152 | /* reserved 13 */ | ||
153 | /* reserved 14 */ | ||
154 | /* reserved 15 */ | ||
155 | /* reserved 16 */ | ||
156 | |||
157 | #define E_CHALLENGE 16 | ||
158 | /* reserved 17 */ | ||
159 | /* reserved 18 */ | ||
160 | /* reserved 19 */ | ||
161 | /* reserved 16 */ | ||
162 | /* reserved 16 */ | ||
163 | |||
164 | |||
165 | struct mgmt_body_t { | ||
166 | u_int8_t timestamp[8]; | ||
167 | u_int16_t beacon_interval; | ||
168 | u_int16_t listen_interval; | ||
169 | u_int16_t status_code; | ||
170 | u_int16_t aid; | ||
171 | u_char ap[6]; | ||
172 | u_int16_treason_code; | ||
173 | u_int16_tauth_alg; | ||
174 | u_int16_tauth_trans_seq_num; | ||
175 | struct challenge_t challenge; | ||
176 | u_int16_tcapability_info; | ||
177 | struct ssid_tssid; | ||
178 | struct rates_t rates; | ||
179 | struct ds_tds; | ||
180 | struct cf_tcf; | ||
181 | struct fh_tfh; | ||
182 | struct tim_ttim; | ||
183 | }; | ||
184 | |||
185 | struct ctrl_rts_t { | ||
186 | u_int16_tfc; | ||
187 | u_int16_tduration; | ||
188 | u_int8_tra[6]; | ||
189 | u_int8_tta[6]; | ||
190 | u_int8_tfcs[4]; | ||
191 | }; | ||
192 | |||
193 | #define CTRL_RTS_LEN(2+2+6+6+4) | ||
194 | |||
195 | struct ctrl_cts_t { | ||
196 | u_int16_tfc; | ||
197 | u_int16_tduration; | ||
198 | u_int8_tra[6]; | ||
199 | u_int8_tfcs[4]; | ||
200 | }; | ||
201 | |||
202 | #define CTRL_CTS_LEN(2+2+6+4) | ||
203 | |||
204 | struct ctrl_ack_t { | ||
205 | u_int16_tfc; | ||
206 | u_int16_tduration; | ||
207 | u_int8_tra[6]; | ||
208 | u_int8_tfcs[4]; | ||
209 | }; | ||
210 | |||
211 | #define CTRL_ACK_LEN(2+2+6+4) | ||
212 | |||
213 | struct ctrl_ps_poll_t { | ||
214 | u_int16_tfc; | ||
215 | u_int16_taid; | ||
216 | u_int8_tbssid[6]; | ||
217 | u_int8_tta[6]; | ||
218 | u_int8_tfcs[4]; | ||
219 | }; | ||
220 | |||
221 | #define CTRL_PS_POLL_LEN(2+2+6+6+4) | ||
222 | |||
223 | struct ctrl_end_t { | ||
224 | u_int16_tfc; | ||
225 | u_int16_tduration; | ||
226 | u_int8_tra[6]; | ||
227 | u_int8_tbssid[6]; | ||
228 | u_int8_tfcs[4]; | ||
229 | }; | ||
230 | |||
231 | #define CTRL_END_LEN(2+2+6+6+4) | ||
232 | |||
233 | struct ctrl_end_ack_t { | ||
234 | u_int16_tfc; | ||
235 | u_int16_tduration; | ||
236 | u_int8_tra[6]; | ||
237 | u_int8_tbssid[6]; | ||
238 | u_int8_tfcs[4]; | ||
239 | }; | ||
240 | |||
241 | #define CTRL_END_ACK_LEN(2+2+6+6+4) | ||
242 | |||
243 | #define IV_IV(iv)((iv) & 0xFFFFFF) | ||
244 | #define IV_PAD(iv)(((iv) >> 24) & 0x3F) | ||
245 | #define IV_KEYID(iv)(((iv) >> 30) & 0x03) | ||