ieee80211_netbsd.h revision 1.14.4.3 1 1.14.4.3 skrll /* $NetBSD: ieee80211_netbsd.h,v 1.14.4.3 2008/02/23 14:31:31 skrll Exp $ */
2 1.2 dyoung /*-
3 1.2 dyoung * Copyright (c) 2003-2005 Sam Leffler, Errno Consulting
4 1.2 dyoung * All rights reserved.
5 1.2 dyoung *
6 1.2 dyoung * Redistribution and use in source and binary forms, with or without
7 1.2 dyoung * modification, are permitted provided that the following conditions
8 1.2 dyoung * are met:
9 1.2 dyoung * 1. Redistributions of source code must retain the above copyright
10 1.2 dyoung * notice, this list of conditions and the following disclaimer.
11 1.2 dyoung * 2. Redistributions in binary form must reproduce the above copyright
12 1.2 dyoung * notice, this list of conditions and the following disclaimer in the
13 1.2 dyoung * documentation and/or other materials provided with the distribution.
14 1.2 dyoung * 3. The name of the author may not be used to endorse or promote products
15 1.2 dyoung * derived from this software without specific prior written permission.
16 1.2 dyoung *
17 1.2 dyoung * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 1.2 dyoung * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 1.2 dyoung * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 1.2 dyoung * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 1.2 dyoung * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 1.2 dyoung * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 1.2 dyoung * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 1.2 dyoung * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 1.2 dyoung * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 1.2 dyoung * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 1.2 dyoung *
28 1.7 skrll * $FreeBSD: src/sys/net80211/ieee80211_freebsd.h,v 1.6 2005/08/08 18:46:36 sam Exp $
29 1.2 dyoung */
30 1.2 dyoung #ifndef _NET80211_IEEE80211_NETBSD_H_
31 1.2 dyoung #define _NET80211_IEEE80211_NETBSD_H_
32 1.2 dyoung
33 1.14.4.2 skrll #ifdef _KERNEL
34 1.2 dyoung #define IASSERT(__cond, __complaint) \
35 1.2 dyoung do { \
36 1.2 dyoung if (!(__cond)) \
37 1.2 dyoung panic __complaint ; \
38 1.14.4.2 skrll } while (/*CONSTCOND*/0)
39 1.2 dyoung
40 1.2 dyoung void if_printf(struct ifnet *, const char *, ...)
41 1.2 dyoung __attribute__((__format__(__printf__,2,3)));
42 1.2 dyoung
43 1.2 dyoung #define IEEE80211_LOCK_INIT_IMPL(_ic, _name, _member) \
44 1.14.4.2 skrll mutex_init(&(_ic)->_member, MUTEX_DEFAULT, IPL_NET)
45 1.2 dyoung #define IEEE80211_LOCK_IMPL(_ic, _member) \
46 1.14.4.2 skrll mutex_enter(&(_ic)->_member)
47 1.7 skrll #define IEEE80211_IS_LOCKED_IMPL(_ic, _member) \
48 1.14.4.2 skrll mutex_owned(&(_ic)->_member)
49 1.2 dyoung #define IEEE80211_UNLOCK_IMPL(_ic, _member) \
50 1.14.4.2 skrll mutex_exit(&(_ic)->_member)
51 1.2 dyoung #define IEEE80211_LOCK_ASSERT_IMPL(_ic, _member) \
52 1.14.4.2 skrll IASSERT(mutex_owned(&(_ic)->_member), \
53 1.14.4.2 skrll ("%s: IEEE80211_LOCK not held", __func__))
54 1.14.4.2 skrll #define IEEE80211_LOCK_DESTROY_IMPL(_ic, _member) \
55 1.14.4.2 skrll mutex_destroy(&(_ic)->_member)
56 1.14.4.1 skrll
57 1.14.4.1 skrll /*
58 1.14.4.1 skrll * Common state locking definitions.
59 1.14.4.1 skrll */
60 1.14.4.2 skrll typedef kmutex_t ieee80211_com_lock_t;
61 1.14.4.1 skrll #define IEEE80211_LOCK_INIT(_ic, _name) \
62 1.14.4.1 skrll IEEE80211_LOCK_INIT_IMPL(_ic, _name, ic_comlock)
63 1.14.4.2 skrll #define IEEE80211_LOCK_DESTROY(_ic) \
64 1.14.4.2 skrll IEEE80211_LOCK_DESTROY_IMPL(_ic, ic_comlock)
65 1.14.4.1 skrll #define IEEE80211_LOCK(_ic) \
66 1.14.4.1 skrll IEEE80211_LOCK_IMPL(_ic, ic_comlock)
67 1.14.4.1 skrll #define IEEE80211_UNLOCK(_ic)\
68 1.14.4.1 skrll IEEE80211_UNLOCK_IMPL(_ic, ic_comlock)
69 1.14.4.1 skrll #define IEEE80211_LOCK_ASSERT(_ic) \
70 1.14.4.1 skrll IEEE80211_LOCK_ASSERT_IMPL(_ic, ic_comlock)
71 1.2 dyoung
72 1.4 dyoung /*
73 1.4 dyoung * Beacon locking definitions.
74 1.4 dyoung */
75 1.14.4.2 skrll typedef kmutex_t ieee80211_beacon_lock_t;
76 1.2 dyoung #define IEEE80211_BEACON_LOCK_INIT(_ic, _name) \
77 1.2 dyoung IEEE80211_LOCK_INIT_IMPL(_ic, _name, ic_beaconlock)
78 1.14.4.2 skrll #define IEEE80211_BEACON_LOCK_DESTROY(_ic) \
79 1.14.4.2 skrll IEEE80211_LOCK_DESTROY_IMPL(_ic, ic_beaconlock)
80 1.2 dyoung #define IEEE80211_BEACON_LOCK(_ic) \
81 1.2 dyoung IEEE80211_LOCK_IMPL(_ic, ic_beaconlock)
82 1.2 dyoung #define IEEE80211_BEACON_UNLOCK(_ic) \
83 1.2 dyoung IEEE80211_UNLOCK_IMPL(_ic, ic_beaconlock)
84 1.2 dyoung #define IEEE80211_BEACON_LOCK_ASSERT(_ic) \
85 1.2 dyoung IEEE80211_LOCK_ASSERT_IMPL(_ic, ic_beaconlock)
86 1.2 dyoung
87 1.2 dyoung /*
88 1.2 dyoung * Node locking definitions.
89 1.7 skrll * NB: MTX_DUPOK is because we don't generate per-interface strings.
90 1.2 dyoung */
91 1.14.4.2 skrll typedef kmutex_t ieee80211_node_lock_t;
92 1.2 dyoung #define IEEE80211_NODE_LOCK_INIT(_nt, _name) \
93 1.2 dyoung IEEE80211_LOCK_INIT_IMPL(_nt, _name, nt_nodelock)
94 1.14.4.2 skrll #define IEEE80211_NODE_LOCK_DESTROY(_nt) \
95 1.14.4.2 skrll IEEE80211_LOCK_DESTROY_IMPL(_nt, nt_nodelock)
96 1.2 dyoung #define IEEE80211_NODE_LOCK(_nt) \
97 1.2 dyoung IEEE80211_LOCK_IMPL(_nt, nt_nodelock)
98 1.7 skrll #define IEEE80211_NODE_IS_LOCKED(_nt) \
99 1.7 skrll IEEE80211_IS_LOCKED_IMPL(_nt, nt_nodelock)
100 1.2 dyoung #define IEEE80211_NODE_UNLOCK(_nt) \
101 1.2 dyoung IEEE80211_UNLOCK_IMPL(_nt, nt_nodelock)
102 1.2 dyoung #define IEEE80211_NODE_LOCK_ASSERT(_nt) \
103 1.2 dyoung IEEE80211_LOCK_ASSERT_IMPL(_nt, nt_nodelock)
104 1.2 dyoung
105 1.2 dyoung /*
106 1.2 dyoung * Node table scangen locking definitions.
107 1.2 dyoung */
108 1.14.4.2 skrll typedef kmutex_t ieee80211_scan_lock_t;
109 1.2 dyoung #define IEEE80211_SCAN_LOCK_INIT(_nt, _name) \
110 1.2 dyoung IEEE80211_LOCK_INIT_IMPL(_nt, _name, nt_scanlock)
111 1.14.4.2 skrll #define IEEE80211_SCAN_LOCK_DESTROY(_nt) \
112 1.14.4.2 skrll IEEE80211_LOCK_DESTROY_IMPL(_nt, nt_scanlock)
113 1.2 dyoung #define IEEE80211_SCAN_LOCK(_nt) \
114 1.2 dyoung IEEE80211_LOCK_IMPL(_nt, nt_scanlock)
115 1.2 dyoung #define IEEE80211_SCAN_UNLOCK(_nt) \
116 1.2 dyoung IEEE80211_UNLOCK_IMPL(_nt, nt_scanlock)
117 1.14.4.2 skrll #define IEEE80211_SCAN_LOCK_ASSERT(_nt) \
118 1.2 dyoung IEEE80211_LOCK_ASSERT_IMPL(_nt, nt_scanlock)
119 1.2 dyoung
120 1.2 dyoung /*
121 1.14.4.1 skrll * Scan table locking definitions.
122 1.14.4.1 skrll */
123 1.14.4.2 skrll typedef kmutex_t ieee80211_scantable_lock_t;
124 1.14.4.1 skrll #define IEEE80211_SCANTABLE_LOCK_INIT(_st, _name) \
125 1.14.4.1 skrll IEEE80211_LOCK_INIT_IMPL(_st, _name, st_lock)
126 1.14.4.2 skrll #define IEEE80211_SCANTABLE_LOCK_DESTROY(_st) \
127 1.14.4.2 skrll IEEE80211_LOCK_DESTROY_IMPL(_st, st_lock)
128 1.14.4.1 skrll #define IEEE80211_SCANTABLE_LOCK(_st) \
129 1.14.4.1 skrll IEEE80211_LOCK_IMPL(_st, st_lock)
130 1.14.4.1 skrll #define IEEE80211_SCANTABLE_UNLOCK(_st) \
131 1.14.4.1 skrll IEEE80211_UNLOCK_IMPL(_st, st_lock)
132 1.14.4.1 skrll #define IEEE80211_SCANTABLE_LOCK_ASSERT(_st) \
133 1.14.4.1 skrll IEEE80211_LOCK_ASSERT_IMPL(_st, st_lock)
134 1.14.4.1 skrll
135 1.14.4.1 skrll /*
136 1.14.4.1 skrll * Scan table scangen locking definitions.
137 1.14.4.1 skrll */
138 1.14.4.2 skrll typedef kmutex_t ieee80211_scangen_lock_t;
139 1.14.4.1 skrll #define IEEE80211_SCANGEN_LOCK_INIT(_st, _name) \
140 1.14.4.1 skrll IEEE80211_LOCK_INIT_IMPL(_st, _name, st_scanlock)
141 1.14.4.2 skrll #define IEEE80211_SCANGEN_LOCK_DESTROY(_st) \
142 1.14.4.2 skrll IEEE80211_LOCK_DESTROY_IMPL(_st, st_scanlock)
143 1.14.4.1 skrll #define IEEE80211_SCANGEN_LOCK(_st) \
144 1.14.4.1 skrll IEEE80211_LOCK_IMPL(_st, st_scanlock)
145 1.14.4.1 skrll #define IEEE80211_SCANGEN_UNLOCK(_st) \
146 1.14.4.1 skrll IEEE80211_UNLOCK_IMPL(_st, st_scanlock)
147 1.14.4.1 skrll #define IEEE80211_SCANGEN_LOCK_ASSERT(_st) \
148 1.14.4.1 skrll IEEE80211_LOCK_ASSERT_IMPL(_st, st_scanlock)
149 1.14.4.1 skrll
150 1.14.4.1 skrll /*
151 1.2 dyoung * Per-node power-save queue definitions.
152 1.2 dyoung */
153 1.2 dyoung #define IEEE80211_NODE_SAVEQ_INIT(_ni, _name) do { \
154 1.2 dyoung (_ni)->ni_savedq.ifq_maxlen = IEEE80211_PS_MAX_QUEUE; \
155 1.2 dyoung } while (0)
156 1.2 dyoung #define IEEE80211_NODE_SAVEQ_DESTROY(_ni)
157 1.2 dyoung #define IEEE80211_NODE_SAVEQ_QLEN(_ni) ((_ni)->ni_savedq.ifq_len)
158 1.2 dyoung #define IEEE80211_NODE_SAVEQ_LOCK(_ni)
159 1.2 dyoung #define IEEE80211_NODE_SAVEQ_UNLOCK(_ni)
160 1.2 dyoung #define IEEE80211_NODE_SAVEQ_DEQUEUE(_ni, _m, _qlen) do { \
161 1.2 dyoung IEEE80211_NODE_SAVEQ_LOCK(_ni); \
162 1.2 dyoung IF_DEQUEUE(&(_ni)->ni_savedq, _m); \
163 1.2 dyoung (_qlen) = IEEE80211_NODE_SAVEQ_QLEN(_ni); \
164 1.2 dyoung IEEE80211_NODE_SAVEQ_UNLOCK(_ni); \
165 1.2 dyoung } while (0)
166 1.2 dyoung #define IEEE80211_NODE_SAVEQ_DRAIN(_ni, _qlen) do { \
167 1.2 dyoung IEEE80211_NODE_SAVEQ_LOCK(_ni); \
168 1.2 dyoung (_qlen) = IEEE80211_NODE_SAVEQ_QLEN(_ni); \
169 1.2 dyoung IF_PURGE(&(_ni)->ni_savedq); \
170 1.2 dyoung IEEE80211_NODE_SAVEQ_UNLOCK(_ni); \
171 1.2 dyoung } while (0)
172 1.2 dyoung /* XXX could be optimized */
173 1.2 dyoung #define _IEEE80211_NODE_SAVEQ_DEQUEUE_HEAD(_ni, _m) do { \
174 1.2 dyoung IF_DEQUEUE(&(_ni)->ni_savedq, m); \
175 1.2 dyoung } while (0)
176 1.2 dyoung #define _IEEE80211_NODE_SAVEQ_ENQUEUE(_ni, _m, _qlen, _age) do {\
177 1.2 dyoung (_m)->m_nextpkt = NULL; \
178 1.2 dyoung if ((_ni)->ni_savedq.ifq_tail != NULL) { \
179 1.2 dyoung _age -= M_AGE_GET((_ni)->ni_savedq.ifq_tail); \
180 1.2 dyoung (_ni)->ni_savedq.ifq_tail->m_nextpkt = (_m); \
181 1.2 dyoung } else { \
182 1.2 dyoung (_ni)->ni_savedq.ifq_head = (_m); \
183 1.2 dyoung } \
184 1.2 dyoung M_AGE_SET(_m, _age); \
185 1.2 dyoung (_ni)->ni_savedq.ifq_tail = (_m); \
186 1.2 dyoung (_qlen) = ++(_ni)->ni_savedq.ifq_len; \
187 1.2 dyoung } while (0)
188 1.2 dyoung
189 1.14.4.1 skrll #define IEEE80211_TAPQ_INIT(_tap) do { \
190 1.14.4.1 skrll (_tap)->txa_q.ifq_maxlen = IEEE80211_AGGR_BAWMAX; \
191 1.14.4.1 skrll } while (0)
192 1.14.4.1 skrll #define IEEE80211_TAPQ_DESTROY(_tap)
193 1.14.4.1 skrll
194 1.14.4.1 skrll #define IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do { \
195 1.14.4.1 skrll (mtail)->m_nextpkt = (ifq)->ifq_head; \
196 1.14.4.1 skrll if ((ifq)->ifq_tail == NULL) \
197 1.14.4.1 skrll (ifq)->ifq_tail = (mtail); \
198 1.14.4.1 skrll (ifq)->ifq_head = (mhead); \
199 1.14.4.1 skrll (ifq)->ifq_len += (mcount); \
200 1.14.4.1 skrll } while (0)
201 1.14.4.1 skrll
202 1.2 dyoung /*
203 1.2 dyoung * 802.1x MAC ACL database locking definitions.
204 1.2 dyoung */
205 1.14.4.2 skrll typedef kmutex_t acl_lock_t;
206 1.2 dyoung #define ACL_LOCK_INIT(_as, _name) \
207 1.2 dyoung IEEE80211_LOCK_INIT_IMPL(_as, _name, as_lock)
208 1.14.4.2 skrll #define ACL_LOCK_DESTROY(_as) \
209 1.14.4.2 skrll IEEE80211_LOCK_DESTROY_IMPL(_as, as_lock)
210 1.2 dyoung #define ACL_LOCK(_as) IEEE80211_LOCK_IMPL(_as, as_lock)
211 1.2 dyoung #define ACL_UNLOCK(_as) IEEE80211_UNLOCK_IMPL(_as, as_lock)
212 1.2 dyoung #define ACL_LOCK_ASSERT(_as) IEEE80211_LOCK_ASSERT_IMPL(_as, as_lock)
213 1.2 dyoung
214 1.2 dyoung /*
215 1.2 dyoung * Node reference counting definitions.
216 1.2 dyoung *
217 1.2 dyoung * ieee80211_node_initref initialize the reference count to 1
218 1.2 dyoung * ieee80211_node_incref add a reference
219 1.2 dyoung * ieee80211_node_decref remove a reference
220 1.2 dyoung * ieee80211_node_dectestref remove a reference and return 1 if this
221 1.2 dyoung * is the last reference, otherwise 0
222 1.2 dyoung * ieee80211_node_refcnt reference count for printing (only)
223 1.2 dyoung */
224 1.2 dyoung
225 1.2 dyoung #define ieee80211_node_initref(_ni) \
226 1.2 dyoung do { ((_ni)->ni_refcnt = 1); } while (0)
227 1.2 dyoung #define ieee80211_node_incref(_ni) \
228 1.2 dyoung do { (_ni)->ni_refcnt++; } while (0)
229 1.2 dyoung #define ieee80211_node_decref(_ni) \
230 1.2 dyoung do { (_ni)->ni_refcnt--; } while (0)
231 1.2 dyoung struct ieee80211_node;
232 1.2 dyoung int ieee80211_node_dectestref(struct ieee80211_node *ni);
233 1.2 dyoung #define ieee80211_node_refcnt(_ni) (_ni)->ni_refcnt
234 1.2 dyoung
235 1.12 degroote struct ifqueue;
236 1.12 degroote void ieee80211_drain_ifq(struct ifqueue *);
237 1.12 degroote
238 1.14.4.1 skrll #define msecs_to_ticks(ms) (((ms)*hz)/1000)
239 1.14.4.1 skrll #define ticks_to_msecs(t) ((t) / hz)
240 1.14.4.1 skrll #define time_after(a,b) ((long)(b) - (long)(a) < 0)
241 1.14.4.1 skrll #define time_before(a,b) time_after(b,a)
242 1.14.4.1 skrll #define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0)
243 1.14.4.1 skrll #define time_before_eq(a,b) time_after_eq(b,a)
244 1.14.4.1 skrll
245 1.14.4.1 skrll struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int, u_int pktlen);
246 1.14.4.1 skrll
247 1.14.4.1 skrll /* tx path usage */
248 1.2 dyoung #define M_PWR_SAV M_PROTO1 /* bypass PS handling */
249 1.5 dyoung #define M_MORE_DATA M_LINK3 /* more data frames to follow */
250 1.10 dyoung #define M_FRAG M_LINK4 /* 802.11 fragment */
251 1.10 dyoung #define M_FIRSTFRAG M_LINK5 /* first 802.11 fragment */
252 1.10 dyoung #define M_FF M_LINK6 /* "fast frames" */
253 1.14.4.1 skrll
254 1.14.4.1 skrll /* rx path usage */
255 1.14.4.1 skrll #define M_AMPDU M_PROTO1 /* A-MPDU processing done */
256 1.14.4.1 skrll #define M_WEP M_LINK3 /* WEP done by hardware */ /* XXXNH */
257 1.14.4.1 skrll #define M_80211_RX (M_AMPDU|M_WEP)
258 1.14.4.1 skrll
259 1.14.4.1 skrll #ifdef __FreeBSD__
260 1.14.4.1 skrll /* tx path usage */
261 1.14.4.1 skrll #define M_LINK0 M_PROTO1 /* WEP requested */
262 1.14.4.1 skrll #define M_PWR_SAV M_PROTO4 /* bypass PS handling */
263 1.14.4.1 skrll #define M_MORE_DATA M_PROTO5 /* more data frames to follow */
264 1.14.4.1 skrll #define M_FF 0x20000 /* fast frame */
265 1.14.4.1 skrll #define M_TXCB 0x40000 /* do tx complete callback */
266 1.14.4.1 skrll #define M_80211_TX (0x60000|M_PROTO1|M_WME_AC_MASK|M_PROTO4|M_PROTO5)
267 1.14.4.1 skrll
268 1.14.4.1 skrll /* rx path usage */
269 1.14.4.1 skrll #define M_AMPDU M_PROTO1 /* A-MPDU processing done */
270 1.14.4.1 skrll #define M_WEP M_PROTO2 /* WEP done by hardware */
271 1.14.4.1 skrll #define M_80211_RX (M_AMPDU|M_WEP)
272 1.14.4.1 skrll #endif
273 1.14.4.1 skrll
274 1.2 dyoung /*
275 1.2 dyoung * Encode WME access control bits in the PROTO flags.
276 1.2 dyoung * This is safe since it's passed directly in to the
277 1.2 dyoung * driver and there's no chance someone else will clobber
278 1.2 dyoung * them on us.
279 1.2 dyoung */
280 1.2 dyoung #define M_WME_AC_MASK (M_LINK1|M_LINK2)
281 1.2 dyoung /* XXX 5 is wrong if M_LINK* are redefined */
282 1.2 dyoung #define M_WME_AC_SHIFT 13
283 1.2 dyoung
284 1.2 dyoung #define M_WME_SETAC(m, ac) \
285 1.2 dyoung ((m)->m_flags = ((m)->m_flags &~ M_WME_AC_MASK) | \
286 1.2 dyoung ((ac) << M_WME_AC_SHIFT))
287 1.2 dyoung #define M_WME_GETAC(m) (((m)->m_flags >> M_WME_AC_SHIFT) & 0x3)
288 1.2 dyoung
289 1.2 dyoung /*
290 1.2 dyoung * Mbufs on the power save queue are tagged with an age and
291 1.2 dyoung * timed out. We reuse the hardware checksum field in the
292 1.2 dyoung * mbuf packet header to store this data.
293 1.2 dyoung */
294 1.2 dyoung #define M_AGE_SET(m,v) (m->m_pkthdr.csum_data = v)
295 1.2 dyoung #define M_AGE_GET(m) (m->m_pkthdr.csum_data)
296 1.2 dyoung #define M_AGE_SUB(m,adj) (m->m_pkthdr.csum_data -= adj)
297 1.2 dyoung
298 1.14.4.1 skrll struct ieee80211_cb {
299 1.14.4.1 skrll void (*func)(struct ieee80211_node *, void *, int status);
300 1.14.4.1 skrll void *arg;
301 1.14.4.1 skrll };
302 1.14.4.1 skrll #define NET80211_TAG_CALLBACK 0 /* xmit complete callback */
303 1.14.4.1 skrll int ieee80211_add_callback(struct mbuf *m,
304 1.14.4.1 skrll void (*func)(struct ieee80211_node *, void *, int), void *arg);
305 1.14.4.1 skrll void ieee80211_process_callback(struct ieee80211_node *, struct mbuf *, int);
306 1.14.4.1 skrll
307 1.2 dyoung struct ieee80211com;
308 1.14.4.2 skrll #endif /* _KERNEL */
309 1.2 dyoung
310 1.2 dyoung /* XXX this stuff belongs elsewhere */
311 1.2 dyoung /*
312 1.2 dyoung * Message formats for messages from the net80211 layer to user
313 1.2 dyoung * applications via the routing socket. These messages are appended
314 1.2 dyoung * to an if_announcemsghdr structure.
315 1.2 dyoung */
316 1.2 dyoung struct ieee80211_join_event {
317 1.2 dyoung uint8_t iev_addr[6];
318 1.2 dyoung };
319 1.2 dyoung
320 1.2 dyoung struct ieee80211_leave_event {
321 1.2 dyoung uint8_t iev_addr[6];
322 1.2 dyoung };
323 1.2 dyoung
324 1.2 dyoung struct ieee80211_replay_event {
325 1.2 dyoung uint8_t iev_src[6]; /* src MAC */
326 1.2 dyoung uint8_t iev_dst[6]; /* dst MAC */
327 1.2 dyoung uint8_t iev_cipher; /* cipher type */
328 1.2 dyoung uint8_t iev_keyix; /* key id/index */
329 1.2 dyoung uint64_t iev_keyrsc; /* RSC from key */
330 1.2 dyoung uint64_t iev_rsc; /* RSC from frame */
331 1.2 dyoung };
332 1.2 dyoung
333 1.2 dyoung struct ieee80211_michael_event {
334 1.2 dyoung uint8_t iev_src[6]; /* src MAC */
335 1.2 dyoung uint8_t iev_dst[6]; /* dst MAC */
336 1.2 dyoung uint8_t iev_cipher; /* cipher type */
337 1.2 dyoung uint8_t iev_keyix; /* key id/index */
338 1.2 dyoung };
339 1.2 dyoung
340 1.2 dyoung #define RTM_IEEE80211_ASSOC 100 /* station associate (bss mode) */
341 1.2 dyoung #define RTM_IEEE80211_REASSOC 101 /* station re-associate (bss mode) */
342 1.2 dyoung #define RTM_IEEE80211_DISASSOC 102 /* station disassociate (bss mode) */
343 1.2 dyoung #define RTM_IEEE80211_JOIN 103 /* station join (ap mode) */
344 1.2 dyoung #define RTM_IEEE80211_LEAVE 104 /* station leave (ap mode) */
345 1.2 dyoung #define RTM_IEEE80211_SCAN 105 /* scan complete, results available */
346 1.2 dyoung #define RTM_IEEE80211_REPLAY 106 /* sequence counter replay detected */
347 1.2 dyoung #define RTM_IEEE80211_MICHAEL 107 /* Michael MIC failure detected */
348 1.2 dyoung #define RTM_IEEE80211_REJOIN 108 /* station re-associate (ap mode) */
349 1.2 dyoung
350 1.14.4.3 skrll #ifdef _KERNEL
351 1.2 dyoung #define __offsetof offsetof
352 1.2 dyoung #define ticks hardclock_ticks
353 1.2 dyoung #define ovbcopy(__src, __dst, __n) ((void)memmove(__dst, __src, __n))
354 1.2 dyoung
355 1.2 dyoung #define TAILQ_FOREACH_SAFE(var, head, field, nextvar) \
356 1.2 dyoung for (var = TAILQ_FIRST(head); \
357 1.2 dyoung var != NULL && (nextvar = TAILQ_NEXT(var, field), 1); \
358 1.2 dyoung var = nextvar)
359 1.2 dyoung
360 1.2 dyoung void if_printf(struct ifnet *, const char *, ...);
361 1.10 dyoung void m_align(struct mbuf *, int);
362 1.11 christos int m_append(struct mbuf *, int, const void *);
363 1.2 dyoung void get_random_bytes(void *, size_t);
364 1.6 skrll
365 1.2 dyoung void ieee80211_sysctl_attach(struct ieee80211com *);
366 1.2 dyoung void ieee80211_sysctl_detach(struct ieee80211com *);
367 1.2 dyoung void ieee80211_load_module(const char *);
368 1.2 dyoung
369 1.14.4.1 skrll void net80211_init(void);
370 1.7 skrll #define IEEE80211_CRYPTO_SETUP(name) \
371 1.7 skrll static void name(void); \
372 1.7 skrll __link_set_add_text(ieee80211_funcs, name); \
373 1.7 skrll static void name(void)
374 1.14.4.3 skrll #endif /* _KERNEL */
375 1.7 skrll
376 1.9 elad #endif /* !_NET80211_IEEE80211_NETBSD_H_ */
377