The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/net80211/ieee80211_netbsd.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* $NetBSD: ieee80211_netbsd.h,v 1.24 2022/03/18 23:32:25 riastradh Exp $ */
    2 /*-
    3  * Copyright (c) 2003-2005 Sam Leffler, Errno Consulting
    4  * All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  * 3. The name of the author may not be used to endorse or promote products
   15  *    derived from this software without specific prior written permission.
   16  *
   17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   27  *
   28  * $FreeBSD: src/sys/net80211/ieee80211_freebsd.h,v 1.6 2005/08/08 18:46:36 sam Exp $
   29  */
   30 #ifndef _NET80211_IEEE80211_NETBSD_H_
   31 #define _NET80211_IEEE80211_NETBSD_H_
   32 
   33 #ifdef _KERNEL
   34 #define IASSERT(__cond, __complaint)            \
   35         do {                                    \
   36                 if (!(__cond))                  \
   37                         panic __complaint ;     \
   38         } while (/*CONSTCOND*/0)
   39 
   40 void if_printf(struct ifnet *, const char *, ...)
   41     __attribute__((__format__(__printf__,2,3)));
   42 
   43 #define IEEE80211_LOCK_INIT_IMPL(_ic, _name, _member)   \
   44         mutex_init(&(_ic)->_member, MUTEX_DEFAULT, IPL_NET)
   45 #define IEEE80211_LOCK_IMPL(_ic, _member)               \
   46         mutex_enter(&(_ic)->_member)
   47 #define IEEE80211_IS_LOCKED_IMPL(_ic, _member)          \
   48         mutex_owned(&(_ic)->_member)
   49 #define IEEE80211_UNLOCK_IMPL(_ic, _member)             \
   50         mutex_exit(&(_ic)->_member)
   51 #define IEEE80211_LOCK_ASSERT_IMPL(_ic, _member)        \
   52         IASSERT(mutex_owned(&(_ic)->_member),           \
   53             ("%s: IEEE80211_LOCK not held", __func__))
   54 #define IEEE80211_LOCK_DESTROY_IMPL(_ic, _member)          \
   55         mutex_destroy(&(_ic)->_member)
   56 
   57 /*
   58  * Beacon locking definitions.
   59  */
   60 typedef kmutex_t ieee80211_beacon_lock_t;
   61 #define IEEE80211_BEACON_LOCK_INIT(_ic, _name)          \
   62         IEEE80211_LOCK_INIT_IMPL(_ic, _name, ic_beaconlock)
   63 #define IEEE80211_BEACON_LOCK_DESTROY(_ic)              \
   64         IEEE80211_LOCK_DESTROY_IMPL(_ic, ic_beaconlock)
   65 #define IEEE80211_BEACON_LOCK(_ic)                      \
   66         IEEE80211_LOCK_IMPL(_ic, ic_beaconlock)
   67 #define IEEE80211_BEACON_UNLOCK(_ic)                    \
   68         IEEE80211_UNLOCK_IMPL(_ic, ic_beaconlock)
   69 #define IEEE80211_BEACON_LOCK_ASSERT(_ic)               \
   70         IEEE80211_LOCK_ASSERT_IMPL(_ic, ic_beaconlock)
   71 
   72 /*
   73  * Node locking definitions.
   74  * NB: MTX_DUPOK is because we don't generate per-interface strings.
   75  */
   76 typedef kmutex_t ieee80211_node_lock_t;
   77 #define IEEE80211_NODE_LOCK_INIT(_nt, _name)            \
   78         IEEE80211_LOCK_INIT_IMPL(_nt, _name, nt_nodelock)
   79 #define IEEE80211_NODE_LOCK_DESTROY(_nt)                \
   80         IEEE80211_LOCK_DESTROY_IMPL(_nt, nt_nodelock)
   81 #define IEEE80211_NODE_LOCK(_nt)                        \
   82         IEEE80211_LOCK_IMPL(_nt, nt_nodelock)
   83 #define IEEE80211_NODE_IS_LOCKED(_nt)                   \
   84         IEEE80211_IS_LOCKED_IMPL(_nt, nt_nodelock)
   85 #define IEEE80211_NODE_UNLOCK(_nt)                      \
   86         IEEE80211_UNLOCK_IMPL(_nt, nt_nodelock)
   87 #define IEEE80211_NODE_LOCK_ASSERT(_nt)                 \
   88         IEEE80211_LOCK_ASSERT_IMPL(_nt, nt_nodelock)
   89 
   90 /*
   91  * Node table scangen locking definitions.
   92  */
   93 typedef kmutex_t ieee80211_scan_lock_t;
   94 #define IEEE80211_SCAN_LOCK_INIT(_nt, _name)            \
   95         IEEE80211_LOCK_INIT_IMPL(_nt, _name, nt_scanlock)
   96 #define IEEE80211_SCAN_LOCK_DESTROY(_nt)                \
   97         IEEE80211_LOCK_DESTROY_IMPL(_nt, nt_scanlock)
   98 #define IEEE80211_SCAN_LOCK(_nt)                        \
   99         IEEE80211_LOCK_IMPL(_nt, nt_scanlock)
  100 #define IEEE80211_SCAN_UNLOCK(_nt)                      \
  101         IEEE80211_UNLOCK_IMPL(_nt, nt_scanlock)
  102 #define IEEE80211_SCAN_LOCK_ASSERT(_nt)                 \
  103         IEEE80211_LOCK_ASSERT_IMPL(_nt, nt_scanlock)
  104 
  105 /*
  106  * Per-node power-save queue definitions. 
  107  */
  108 #define IEEE80211_NODE_SAVEQ_INIT(_ni, _name) do {              \
  109         (_ni)->ni_savedq.ifq_maxlen = IEEE80211_PS_MAX_QUEUE;   \
  110 } while (0)
  111 #define IEEE80211_NODE_SAVEQ_DESTROY(_ni)
  112 #define IEEE80211_NODE_SAVEQ_QLEN(_ni)  ((_ni)->ni_savedq.ifq_len)
  113 #define IEEE80211_NODE_SAVEQ_LOCK(_ni)
  114 #define IEEE80211_NODE_SAVEQ_UNLOCK(_ni)
  115 #define IEEE80211_NODE_SAVEQ_DEQUEUE(_ni, _m, _qlen) do {       \
  116         IEEE80211_NODE_SAVEQ_LOCK(_ni);                         \
  117         IF_DEQUEUE(&(_ni)->ni_savedq, _m);                      \
  118         (_qlen) = IEEE80211_NODE_SAVEQ_QLEN(_ni);               \
  119         IEEE80211_NODE_SAVEQ_UNLOCK(_ni);                       \
  120 } while (0)
  121 #define IEEE80211_NODE_SAVEQ_DRAIN(_ni, _qlen) do {             \
  122         IEEE80211_NODE_SAVEQ_LOCK(_ni);                         \
  123         (_qlen) = IEEE80211_NODE_SAVEQ_QLEN(_ni);               \
  124         IF_PURGE(&(_ni)->ni_savedq);                            \
  125         IEEE80211_NODE_SAVEQ_UNLOCK(_ni);                       \
  126 } while (0)
  127 /* XXX could be optimized */
  128 #define _IEEE80211_NODE_SAVEQ_DEQUEUE_HEAD(_ni, _m) do {        \
  129         IF_DEQUEUE(&(_ni)->ni_savedq, m);                       \
  130 } while (0)
  131 #define _IEEE80211_NODE_SAVEQ_ENQUEUE(_ni, _m, _qlen, _age) do {\
  132         (_m)->m_nextpkt = NULL;                                 \
  133         if ((_ni)->ni_savedq.ifq_tail != NULL) {                \
  134                 _age -= M_AGE_GET((_ni)->ni_savedq.ifq_tail);   \
  135                 (_ni)->ni_savedq.ifq_tail->m_nextpkt = (_m);    \
  136         } else {                                                \
  137                 (_ni)->ni_savedq.ifq_head = (_m);               \
  138         }                                                       \
  139         M_AGE_SET(_m, _age);                                    \
  140         (_ni)->ni_savedq.ifq_tail = (_m);                       \
  141         (_qlen) = ++(_ni)->ni_savedq.ifq_len;                   \
  142 } while (0)
  143 
  144 /*
  145  * 802.1x MAC ACL database locking definitions.
  146  */
  147 typedef kmutex_t acl_lock_t;
  148 #define ACL_LOCK_INIT(_as, _name)       \
  149         IEEE80211_LOCK_INIT_IMPL(_as, _name, as_lock)
  150 #define ACL_LOCK_DESTROY(_as)           \
  151         IEEE80211_LOCK_DESTROY_IMPL(_as, as_lock)
  152 #define ACL_LOCK(_as)                   IEEE80211_LOCK_IMPL(_as, as_lock)
  153 #define ACL_UNLOCK(_as)                 IEEE80211_UNLOCK_IMPL(_as, as_lock)
  154 #define ACL_LOCK_ASSERT(_as)            IEEE80211_LOCK_ASSERT_IMPL(_as, as_lock)
  155 
  156 /*
  157  * Media locking definitions.
  158  */
  159 typedef kmutex_t ieee80211_media_lock_t;
  160 
  161 struct ifqueue;
  162 void    ieee80211_drain_ifq(struct ifqueue *);
  163 
  164 struct mbuf *ieee80211_getmgtframe(u_int8_t **frm, u_int pktlen);
  165 #define M_PWR_SAV       M_PROTO1                /* bypass PS handling */
  166 #define M_MORE_DATA     M_LINK3                 /* more data frames to follow */
  167 #define M_FRAG          M_LINK4                 /* 802.11 fragment */
  168 #define M_FIRSTFRAG     M_LINK5                 /* first 802.11 fragment */
  169 #define M_FF            M_LINK6                 /* "fast frames" */
  170 /*
  171  * Encode WME access control bits in the PROTO flags.
  172  * This is safe since it's passed directly in to the
  173  * driver and there's no chance someone else will clobber
  174  * them on us.
  175  */
  176 #define M_WME_AC_MASK   (M_LINK1|M_LINK2)
  177 /* XXX 5 is wrong if M_LINK* are redefined */
  178 #define M_WME_AC_SHIFT  13
  179 
  180 #define M_WME_SETAC(m, ac) \
  181         ((m)->m_flags = ((m)->m_flags &~ M_WME_AC_MASK) | \
  182                 ((ac) << M_WME_AC_SHIFT))
  183 #define M_WME_GETAC(m)  (((m)->m_flags >> M_WME_AC_SHIFT) & 0x3)
  184 
  185 /*
  186  * Mbufs on the power save queue are tagged with an age and
  187  * timed out.  We reuse the hardware checksum field in the
  188  * mbuf packet header to store this data.
  189  */
  190 #define M_AGE_SET(m,v)          (m->m_pkthdr.csum_data = v)
  191 #define M_AGE_GET(m)            (m->m_pkthdr.csum_data)
  192 #define M_AGE_SUB(m,adj)        (m->m_pkthdr.csum_data -= adj)
  193 
  194 struct ieee80211com;
  195 #endif /* _KERNEL */
  196 
  197 /* XXX this stuff belongs elsewhere */
  198 /*
  199  * Message formats for messages from the net80211 layer to user
  200  * applications via the routing socket.  These messages are appended
  201  * to an if_announcemsghdr structure.
  202  */
  203 struct ieee80211_join_event {
  204         uint8_t         iev_addr[6];
  205 };
  206 
  207 struct ieee80211_leave_event {
  208         uint8_t         iev_addr[6];
  209 };
  210 
  211 struct ieee80211_replay_event {
  212         uint8_t         iev_src[6];     /* src MAC */
  213         uint8_t         iev_dst[6];     /* dst MAC */
  214         uint8_t         iev_cipher;     /* cipher type */
  215         uint8_t         iev_keyix;      /* key id/index */
  216         uint64_t        iev_keyrsc;     /* RSC from key */
  217         uint64_t        iev_rsc;        /* RSC from frame */
  218 };
  219 
  220 struct ieee80211_michael_event {
  221         uint8_t         iev_src[6];     /* src MAC */
  222         uint8_t         iev_dst[6];     /* dst MAC */
  223         uint8_t         iev_cipher;     /* cipher type */
  224         uint8_t         iev_keyix;      /* key id/index */
  225 };
  226 
  227 #define RTM_IEEE80211_ASSOC     100     /* station associate (bss mode) */
  228 #define RTM_IEEE80211_REASSOC   101     /* station re-associate (bss mode) */
  229 #define RTM_IEEE80211_DISASSOC  102     /* station disassociate (bss mode) */
  230 #define RTM_IEEE80211_JOIN      103     /* station join (ap mode) */
  231 #define RTM_IEEE80211_LEAVE     104     /* station leave (ap mode) */
  232 #define RTM_IEEE80211_SCAN      105     /* scan complete, results available */
  233 #define RTM_IEEE80211_REPLAY    106     /* sequence counter replay detected */
  234 #define RTM_IEEE80211_MICHAEL   107     /* Michael MIC failure detected */
  235 #define RTM_IEEE80211_REJOIN    108     /* station re-associate (ap mode) */
  236 
  237 #ifdef _KERNEL
  238 #define ticks   getticks()
  239 
  240 void    if_printf(struct ifnet *, const char *, ...);
  241 void    get_random_bytes(void *, size_t);
  242 
  243 void    ieee80211_sysctl_attach(struct ieee80211com *);
  244 void    ieee80211_sysctl_detach(struct ieee80211com *);
  245 void    ieee80211_load_module(const char *);
  246 
  247 void    ieee80211_rssadapt_sysctl_setup(struct sysctllog **);
  248 
  249 void    ieee80211_init(void);
  250 #define IEEE80211_CRYPTO_SETUP(name)                            \
  251         static void name(void);                                 \
  252         __link_set_add_text(ieee80211_funcs, name);             \
  253         static void name(void)
  254 #endif
  255 
  256 int     m_append(struct mbuf *, int, const void *);
  257 
  258 #endif /* !_NET80211_IEEE80211_NETBSD_H_ */

Cache object: 8432cc7bf4c4d6c3c4e4fdfd2a05ff11


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.