MFC corrected printing of the slice number when adding a GPT partition.
[dragonfly.git] / sys / netproto / 802_11 / ieee80211_dragonfly.h
blob8d91a94a0c83c076dd789f8f539ac7f7bb5711af
1 /*
2 * Copyright (c) 2003-2005 Sam Leffler, Errno Consulting
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * $FreeBSD: src/sys/net80211/ieee80211_freebsd.h,v 1.5.2.1 2005/09/03 22:40:02 sam Exp $
28 * $DragonFly: src/sys/netproto/802_11/ieee80211_dragonfly.h,v 1.4 2007/08/22 13:24:44 sephe Exp $
30 #ifndef _NET80211_IEEE80211_DRAGONFLY_H_
31 #define _NET80211_IEEE80211_DRAGONFLY_H_
34 * Per-node power-save queue definitions.
36 #define IEEE80211_NODE_SAVEQ_INIT(_ni, _name) do { \
37 (_ni)->ni_savedq.ifq_maxlen = IEEE80211_PS_MAX_QUEUE; \
38 } while (0)
39 #define IEEE80211_NODE_SAVEQ_DESTROY(_ni) ((void)0)
40 #define IEEE80211_NODE_SAVEQ_QLEN(_ni) IF_QLEN(&(_ni)->ni_savedq)
41 #define IEEE80211_NODE_SAVEQ_DEQUEUE(_ni, _m, _qlen) do { \
42 IF_DEQUEUE(&(_ni)->ni_savedq, _m); \
43 (_qlen) = IEEE80211_NODE_SAVEQ_QLEN(_ni); \
44 } while (0)
45 #define IEEE80211_NODE_SAVEQ_DRAIN(_ni, _qlen) do { \
46 (_qlen) = IEEE80211_NODE_SAVEQ_QLEN(_ni); \
47 IF_DRAIN(&(_ni)->ni_savedq); \
48 } while (0)
49 /* XXX could be optimized */
50 #define _IEEE80211_NODE_SAVEQ_DEQUEUE_HEAD(_ni, _m) do { \
51 IF_DEQUEUE(&(_ni)->ni_savedq, m); \
52 } while (0)
53 #define _IEEE80211_NODE_SAVEQ_ENQUEUE(_ni, _m, _qlen, _age) do {\
54 (_m)->m_nextpkt = NULL; \
55 if ((_ni)->ni_savedq.ifq_tail != NULL) { \
56 _age -= M_AGE_GET((_ni)->ni_savedq.ifq_tail); \
57 (_ni)->ni_savedq.ifq_tail->m_nextpkt = (_m); \
58 } else { \
59 (_ni)->ni_savedq.ifq_head = (_m); \
60 } \
61 M_AGE_SET(_m, _age); \
62 (_ni)->ni_savedq.ifq_tail = (_m); \
63 (_qlen) = ++(_ni)->ni_savedq.ifq_len; \
64 } while (0)
67 * Node reference counting definitions.
69 * ieee80211_node_initref initialize the reference count to 1
70 * ieee80211_node_incref add a reference
71 * ieee80211_node_decref remove a reference
72 * ieee80211_node_dectestref remove a reference and return 1 if this
73 * is the last reference, otherwise 0
74 * ieee80211_node_refcnt reference count for printing (only)
76 #include <machine/atomic.h>
78 #define ieee80211_node_initref(_ni) \
79 do { ((_ni)->ni_refcnt = 1); } while (0)
80 #define ieee80211_node_incref(_ni) \
81 atomic_add_int(&(_ni)->ni_refcnt, 1)
82 #define ieee80211_node_decref(_ni) \
83 atomic_subtract_int(&(_ni)->ni_refcnt, 1)
84 struct ieee80211_node;
85 int ieee80211_node_dectestref(struct ieee80211_node *ni);
86 #define ieee80211_node_refcnt(_ni) (_ni)->ni_refcnt
88 struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, u_int pktlen);
89 /* M_PROTO1 unused */
90 #define M_PWR_SAV M_PROTO4 /* bypass PS handling */
91 #define M_MORE_DATA M_PROTO5 /* more data frames to follow */
93 * Encode WME access control bits in the PROTO flags.
94 * This is safe since it's passed directly in to the
95 * driver and there's no chance someone else will clobber
96 * them on us.
98 #define M_WME_AC_MASK (M_PROTO2|M_PROTO3)
99 /* XXX 5 is wrong if M_PROTO* are redefined */
100 #define M_WME_AC_SHIFT 5
102 #define M_WME_SETAC(m, ac) \
103 ((m)->m_flags = ((m)->m_flags &~ M_WME_AC_MASK) | \
104 ((ac) << M_WME_AC_SHIFT))
105 #define M_WME_GETAC(m) (((m)->m_flags >> M_WME_AC_SHIFT) & 0x3)
108 * Mbufs on the power save queue are tagged with an age and
109 * timed out. We reuse the hardware checksum field in the
110 * mbuf packet header to store this data.
112 #define M_AGE_SET(m,v) (m->m_pkthdr.csum_data = v)
113 #define M_AGE_GET(m) (m->m_pkthdr.csum_data)
114 #define M_AGE_SUB(m,adj) (m->m_pkthdr.csum_data -= adj)
116 void get_random_bytes(void *, size_t);
118 struct ieee80211com;
120 void ieee80211_sysctl_attach(struct ieee80211com *);
121 void ieee80211_sysctl_detach(struct ieee80211com *);
123 void ieee80211_load_module(const char *);
124 int ieee80211_mbuf_append(struct mbuf *, int, const uint8_t *);
125 struct mbuf *ieee80211_mbuf_clone(struct mbuf *, int);
126 void ieee80211_drain_mgtq(struct ifqueue *);
128 /* XXX this stuff belongs elsewhere */
130 * Message formats for messages from the net80211 layer to user
131 * applications via the routing socket. These messages are appended
132 * to an if_announcemsghdr structure.
134 struct ieee80211_join_event {
135 uint8_t iev_addr[6];
138 struct ieee80211_leave_event {
139 uint8_t iev_addr[6];
142 struct ieee80211_replay_event {
143 uint8_t iev_src[6]; /* src MAC */
144 uint8_t iev_dst[6]; /* dst MAC */
145 uint8_t iev_cipher; /* cipher type */
146 uint8_t iev_keyix; /* key id/index */
147 uint64_t iev_keyrsc; /* RSC from key */
148 uint64_t iev_rsc; /* RSC from frame */
151 struct ieee80211_michael_event {
152 uint8_t iev_src[6]; /* src MAC */
153 uint8_t iev_dst[6]; /* dst MAC */
154 uint8_t iev_cipher; /* cipher type */
155 uint8_t iev_keyix; /* key id/index */
158 #define RTM_IEEE80211_ASSOC 100 /* station associate (bss mode) */
159 #define RTM_IEEE80211_REASSOC 101 /* station re-associate (bss mode) */
160 #define RTM_IEEE80211_DISASSOC 102 /* station disassociate (bss mode) */
161 #define RTM_IEEE80211_JOIN 103 /* station join (ap mode) */
162 #define RTM_IEEE80211_LEAVE 104 /* station leave (ap mode) */
163 #define RTM_IEEE80211_SCAN 105 /* scan complete, results available */
164 #define RTM_IEEE80211_REPLAY 106 /* sequence counter replay detected */
165 #define RTM_IEEE80211_MICHAEL 107 /* Michael MIC failure detected */
166 #define RTM_IEEE80211_REJOIN 108 /* station re-associate (ap mode) */
168 #endif /* _NET80211_IEEE80211_DRAGONFLY_H_ */