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_var.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_var.h,v 1.18 2004/08/10 00:57:22 dyoung Exp $        */
    2 /*-
    3  * Copyright (c) 2001 Atsushi Onoe
    4  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. The name of the author may not be used to endorse or promote products
   16  *    derived from this software without specific prior written permission.
   17  *
   18  * Alternatively, this software may be distributed under the terms of the
   19  * GNU General Public License ("GPL") version 2 as published by the Free
   20  * Software Foundation.
   21  *
   22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   25  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   27  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   32  *
   33  * $FreeBSD: src/sys/net80211/ieee80211_var.h,v 1.15 2004/04/05 22:10:26 sam Exp $
   34  */
   35 #ifndef _NET80211_IEEE80211_VAR_H_
   36 #define _NET80211_IEEE80211_VAR_H_
   37 
   38 /*
   39  * Definitions for IEEE 802.11 drivers.
   40  */
   41 
   42 /* NB: portability glue must go first */
   43 #ifdef __NetBSD__
   44 #include <net80211/ieee80211_netbsd.h>
   45 #elif __FreeBSD__
   46 #include <net80211/ieee80211_freebsd.h>
   47 #elif __linux__
   48 #include <net80211/ieee80211_linux.h>
   49 #else
   50 #error  "No support for your operating system!"
   51 #endif
   52 
   53 #include <sys/queue.h>
   54 
   55 #include <net80211/ieee80211.h>
   56 #include <net80211/ieee80211_crypto.h>
   57 #include <net80211/ieee80211_ioctl.h>           /* for ieee80211_stats */
   58 #include <net80211/ieee80211_node.h>
   59 #include <net80211/ieee80211_proto.h>
   60 #include <net80211/ieee80211_channel.h>
   61 
   62 #define IEEE80211_CHAN_MAX      255
   63 #define IEEE80211_CHAN_ANY      0xffff          /* token for ``any channel'' */
   64 #define IEEE80211_CHAN_ANYC \
   65         ((struct ieee80211_channel *) IEEE80211_CHAN_ANY)
   66 
   67 #define IEEE80211_TXPOWER_MAX   100     /* max power */
   68 #define IEEE80211_TXPOWER_MIN   0       /* kill radio (if possible) */
   69 
   70 enum ieee80211_phytype {
   71         IEEE80211_T_DS,                 /* direct sequence spread spectrum */
   72         IEEE80211_T_FH,                 /* frequency hopping */
   73         IEEE80211_T_OFDM,               /* frequency division multiplexing */
   74         IEEE80211_T_TURBO,              /* high rate OFDM, aka turbo mode */
   75 };
   76 #define IEEE80211_T_CCK IEEE80211_T_DS  /* more common nomenclature */
   77 
   78 /* XXX not really a mode; there are really multiple PHY's */
   79 enum ieee80211_phymode {
   80         IEEE80211_MODE_AUTO     = 0,    /* autoselect */
   81         IEEE80211_MODE_11A      = 1,    /* 5GHz, OFDM */
   82         IEEE80211_MODE_11B      = 2,    /* 2GHz, CCK */
   83         IEEE80211_MODE_11G      = 3,    /* 2GHz, OFDM */
   84         IEEE80211_MODE_FH       = 4,    /* 2GHz, GFSK */
   85         IEEE80211_MODE_TURBO    = 5,    /* 5GHz, OFDM, 2x clock */
   86 };
   87 #define IEEE80211_MODE_MAX      (IEEE80211_MODE_TURBO+1)
   88 
   89 enum ieee80211_opmode {
   90         IEEE80211_M_STA         = 1,    /* infrastructure station */
   91         IEEE80211_M_IBSS        = 0,    /* IBSS (adhoc) station */
   92         IEEE80211_M_AHDEMO      = 3,    /* Old lucent compatible adhoc demo */
   93         IEEE80211_M_HOSTAP      = 6,    /* Software Access Point */
   94         IEEE80211_M_MONITOR     = 8     /* Monitor mode */
   95 };
   96 
   97 /*
   98  * 802.11g protection mode.
   99  */
  100 enum ieee80211_protmode {
  101         IEEE80211_PROT_NONE     = 0,    /* no protection */
  102         IEEE80211_PROT_CTSONLY  = 1,    /* CTS to self */
  103         IEEE80211_PROT_RTSCTS   = 2,    /* RTS-CTS */
  104 };
  105 
  106 /* ni_chan encoding for FH phy */
  107 #define IEEE80211_FH_CHANMOD    80
  108 #define IEEE80211_FH_CHAN(set,pat)      (((set)-1)*IEEE80211_FH_CHANMOD+(pat))
  109 #define IEEE80211_FH_CHANSET(chan)      ((chan)/IEEE80211_FH_CHANMOD+1)
  110 #define IEEE80211_FH_CHANPAT(chan)      ((chan)%IEEE80211_FH_CHANMOD)
  111 
  112 #define IEEE80211_PS_SLEEP      0x1     /* STA is in power saving mode */
  113 
  114 #define IEEE80211_PS_MAX_QUEUE  50      /* maximum saved packets */
  115 
  116 struct ieee80211com {
  117 #ifdef __NetBSD__
  118         struct ethercom         ic_ec;
  119 #else
  120         struct arpcom           ic_ac;
  121 #endif
  122         LIST_ENTRY(ieee80211com) ic_list;       /* chain of all ieee80211com */
  123         void                    (*ic_recv_mgmt)(struct ieee80211com *,
  124                                     struct mbuf *, struct ieee80211_node *,
  125                                     int, int, u_int32_t);
  126         int                     (*ic_send_mgmt)(struct ieee80211com *,
  127                                     struct ieee80211_node *, int, int);
  128         int                     (*ic_newstate)(struct ieee80211com *,
  129                                     enum ieee80211_state, int);
  130         void                    (*ic_newassoc)(struct ieee80211com *,
  131                                     struct ieee80211_node *, int);
  132         int                     (*ic_set_tim)(struct ieee80211com *, int, int);
  133         u_int8_t                ic_myaddr[IEEE80211_ADDR_LEN];
  134         struct ieee80211_rateset ic_sup_rates[IEEE80211_MODE_MAX];
  135         struct ieee80211_channel ic_channels[IEEE80211_CHAN_MAX+1];
  136         u_char                  ic_chan_avail[roundup(IEEE80211_CHAN_MAX,NBBY)];
  137         u_char                  ic_chan_active[roundup(IEEE80211_CHAN_MAX, NBBY)];
  138         u_char                  ic_chan_scan[roundup(IEEE80211_CHAN_MAX,NBBY)];
  139         struct ifqueue          ic_mgtq;
  140         struct ifqueue          ic_pwrsaveq;
  141         u_int32_t               ic_flags;       /* state flags */
  142         u_int32_t               ic_caps;        /* capabilities */
  143         u_int16_t               ic_modecaps;    /* set of mode capabilities */
  144         u_int16_t               ic_curmode;     /* current mode */
  145         enum ieee80211_phytype  ic_phytype;     /* XXX wrong for multi-mode */
  146         enum ieee80211_opmode   ic_opmode;      /* operation mode */
  147         enum ieee80211_state    ic_state;       /* 802.11 state */
  148         enum ieee80211_protmode ic_protmode;    /* 802.11g protection mode */
  149         u_int32_t               *ic_aid_bitmap;
  150         u_int16_t               ic_max_aid;
  151         struct ifmedia          ic_media;       /* interface media config */
  152 #ifdef __FreeBSD__
  153         struct bpf_if           *ic_rawbpf;     /* packet filter structure */
  154 #else
  155         caddr_t                 ic_rawbpf;      /* packet filter structure */
  156 #endif
  157         struct ieee80211_node   *ic_bss;        /* information for this node */
  158         struct ieee80211_channel *ic_ibss_chan;
  159         int                     ic_fixed_rate;  /* index to ic_sup_rates[] */
  160         u_int16_t               ic_rtsthreshold;
  161         u_int16_t               ic_fragthreshold;
  162         ieee80211_node_lock_t   ic_nodelock;    /* on node table */
  163         u_int                   ic_scangen;     /* gen# for timeout scan */
  164         struct ieee80211_node   *(*ic_node_alloc)(struct ieee80211com *);
  165         void                    (*ic_node_free)(struct ieee80211com *,
  166                                         struct ieee80211_node *);
  167         void                    (*ic_node_copy)(struct ieee80211com *,
  168                                         struct ieee80211_node *,
  169                                         const struct ieee80211_node *);
  170         u_int8_t                (*ic_node_getrssi)(struct ieee80211com *,
  171                                         struct ieee80211_node *);
  172         TAILQ_HEAD(, ieee80211_node) ic_node;   /* information of all nodes
  173                                                  * LRU at tail
  174                                                  */
  175         int                     ic_nnodes;      /* length of ic_nnodes */
  176         int                     ic_max_nnodes;  /* max length of ic_nnodes */
  177         LIST_HEAD(, ieee80211_node) ic_hash[IEEE80211_NODE_HASHSIZE];
  178         u_int16_t               ic_lintval;     /* listen interval */
  179         u_int16_t               ic_holdover;    /* PM hold over duration */
  180         u_int16_t               ic_txmin;       /* min tx retry count */
  181         u_int16_t               ic_txmax;       /* max tx retry count */
  182         u_int16_t               ic_txlifetime;  /* tx lifetime */
  183         u_int16_t               ic_txpower;     /* tx power setting (dbM) */
  184         u_int16_t               ic_bmisstimeout;/* beacon miss threshold (ms) */
  185         int                     ic_mgt_timer;   /* mgmt timeout */
  186         int                     ic_inact_timer; /* inactivity timer wait */
  187         int                     ic_des_esslen;
  188         u_int8_t                ic_des_essid[IEEE80211_NWID_LEN];
  189         struct ieee80211_channel *ic_des_chan;  /* desired channel */
  190         u_int8_t                ic_des_bssid[IEEE80211_ADDR_LEN];
  191         struct ieee80211_wepkey ic_nw_keys[IEEE80211_WEP_NKID];
  192         int                     ic_wep_txkey;   /* default tx key index */
  193         void                    *ic_wep_ctx;    /* wep crypt context */
  194         u_int32_t               ic_iv;          /* initial vector for wep */
  195         struct ieee80211_stats  ic_stats;       /* statistics */
  196         struct timeval          ic_last_merge_print;    /* for rate-limiting
  197                                                          * IBSS merge print-outs
  198                                                          */
  199 };
  200 #ifdef __NetBSD__
  201 #define ic_if           ic_ec.ec_if
  202 #else
  203 #define ic_if           ic_ac.ac_if
  204 #endif
  205 #define ic_softc        ic_if.if_softc
  206 
  207 LIST_HEAD(ieee80211com_head, ieee80211com);
  208 
  209 extern struct ieee80211com_head ieee80211com_head;
  210 
  211 #define IEEE80211_ADDR_EQ(a1,a2)        (memcmp(a1,a2,IEEE80211_ADDR_LEN) == 0)
  212 #define IEEE80211_ADDR_COPY(dst,src)    memcpy(dst,src,IEEE80211_ADDR_LEN)
  213 
  214 /* ic_flags */
  215 #define IEEE80211_F_ASCAN       0x00000001      /* STATUS: active scan */
  216 #define IEEE80211_F_SIBSS       0x00000002      /* STATUS: start IBSS */
  217 #define IEEE80211_F_PRIVACY     0x00000100      /* CONF: WEP enabled */
  218 #define IEEE80211_F_IBSSON      0x00000200      /* CONF: IBSS creation enable */
  219 #define IEEE80211_F_PMGTON      0x00000400      /* CONF: Power mgmt enable */
  220 #define IEEE80211_F_DESBSSID    0x00000800      /* CONF: des_bssid is set */
  221 #define IEEE80211_F_SCANAP      0x00001000      /* CONF: Scanning AP */
  222 #define IEEE80211_F_ROAMING     0x00002000      /* CONF: roaming enabled */
  223 #define IEEE80211_F_SWRETRY     0x00004000      /* CONF: sw tx retry enabled */
  224 #define IEEE80211_F_TXPMGT      0x00018000      /* STATUS: tx power */
  225 #define IEEE80211_F_TXPOW_OFF   0x00000000      /* TX Power: radio disabled */
  226 #define IEEE80211_F_TXPOW_FIXED 0x00008000      /* TX Power: fixed rate */
  227 #define IEEE80211_F_TXPOW_AUTO  0x00010000      /* TX Power: undefined */
  228 #define IEEE80211_F_SHSLOT      0x00020000      /* CONF: short slot time */
  229 #define IEEE80211_F_SHPREAMBLE  0x00040000      /* CONF: short preamble */
  230 #define IEEE80211_F_USEPROT     0x00100000      /* STATUS: protection enabled */
  231 #define IEEE80211_F_USEBARKER   0x00200000      /* STATUS: use barker preamble*/
  232 
  233 /* ic_caps */
  234 #define IEEE80211_C_WEP         0x00000001      /* CAPABILITY: WEP available */
  235 #define IEEE80211_C_IBSS        0x00000002      /* CAPABILITY: IBSS available */
  236 #define IEEE80211_C_PMGT        0x00000004      /* CAPABILITY: Power mgmt */
  237 #define IEEE80211_C_HOSTAP      0x00000008      /* CAPABILITY: HOSTAP avail */
  238 #define IEEE80211_C_AHDEMO      0x00000010      /* CAPABILITY: Old Adhoc Demo */
  239 #define IEEE80211_C_SWRETRY     0x00000020      /* CAPABILITY: sw tx retry */
  240 #define IEEE80211_C_TXPMGT      0x00000040      /* CAPABILITY: tx power mgmt */
  241 #define IEEE80211_C_SHSLOT      0x00000080      /* CAPABILITY: short slottime */
  242 #define IEEE80211_C_SHPREAMBLE  0x00000100      /* CAPABILITY: short preamble */
  243 #define IEEE80211_C_MONITOR     0x00000200      /* CAPABILITY: monitor mode */
  244 
  245 /* flags for ieee80211_fix_rate() */
  246 #define IEEE80211_F_DOSORT      0x00000001      /* sort rate list */
  247 #define IEEE80211_F_DOFRATE     0x00000002      /* use fixed rate */
  248 #define IEEE80211_F_DONEGO      0x00000004      /* calc negotiated rate */
  249 #define IEEE80211_F_DODEL       0x00000008      /* delete ignore rate */
  250 
  251 void    ieee80211_ifattach(struct ifnet *);
  252 void    ieee80211_ifdetach(struct ifnet *);
  253 void    ieee80211_media_init(struct ifnet *, ifm_change_cb_t, ifm_stat_cb_t);
  254 int     ieee80211_media_change(struct ifnet *);
  255 void    ieee80211_media_status(struct ifnet *, struct ifmediareq *);
  256 int     ieee80211_ioctl(struct ifnet *, u_long, caddr_t);
  257 int     ieee80211_get_rate(struct ieee80211com *);
  258 int     ieee80211_cfgget(struct ifnet *, u_long, caddr_t);
  259 int     ieee80211_cfgset(struct ifnet *, u_long, caddr_t);
  260 void    ieee80211_watchdog(struct ifnet *);
  261 int     ieee80211_fix_rate(struct ieee80211com *, struct ieee80211_node *, int);
  262 int     ieee80211_rate2media(struct ieee80211com *, int,
  263                 enum ieee80211_phymode);
  264 int     ieee80211_media2rate(int);
  265 u_int   ieee80211_mhz2ieee(u_int, u_int);
  266 u_int   ieee80211_chan2ieee(struct ieee80211com *, struct ieee80211_channel *);
  267 u_int   ieee80211_ieee2mhz(u_int, u_int);
  268 int     ieee80211_setmode(struct ieee80211com *, enum ieee80211_phymode);
  269 enum ieee80211_phymode ieee80211_chan2mode(struct ieee80211com *,
  270                 struct ieee80211_channel *);
  271 
  272 #define IEEE80211_MSG_DEBUG     0x40000000      /* IFF_DEBUG equivalent */
  273 #define IEEE80211_MSG_DUMPPKTS  0x20000000      /* IFF_LINK2 equivalant */
  274 #define IEEE80211_MSG_CRYPTO    0x10000000      /* crypto work */
  275 #define IEEE80211_MSG_INPUT     0x08000000      /* input handling */
  276 #define IEEE80211_MSG_XRATE     0x04000000      /* rate set handling */
  277 #define IEEE80211_MSG_ELEMID    0x02000000      /* element id parsing */
  278 #define IEEE80211_MSG_NODE      0x01000000      /* node handling */
  279 #define IEEE80211_MSG_ASSOC     0x00800000      /* association handling */
  280 #define IEEE80211_MSG_AUTH      0x00400000      /* authentication handling */
  281 #define IEEE80211_MSG_SCAN      0x00200000      /* scanning */
  282 #define IEEE80211_MSG_OUTPUT    0x00100000      /* output handling */
  283 #define IEEE80211_MSG_STATE     0x00080000      /* state machine */
  284 #define IEEE80211_MSG_POWER     0x00040000      /* power save handling */
  285 #define IEEE80211_MSG_DOT1X     0x00020000      /* 802.1x authenticator */
  286 #define IEEE80211_MSG_DOT1XSM   0x00010000      /* 802.1x state machine */
  287 #define IEEE80211_MSG_RADIUS    0x00008000      /* 802.1x radius client */
  288 #define IEEE80211_MSG_RADDUMP   0x00004000      /* dump 802.1x radius packets */
  289 #define IEEE80211_MSG_RADKEYS   0x00002000      /* dump 802.1x keys */
  290 #define IEEE80211_MSG_WPA       0x00001000      /* WPA/RSN protocol */
  291 #define IEEE80211_MSG_ACL       0x00000800      /* ACL handling */
  292 
  293 #define IEEE80211_MSG_ANY       0xffffffff      /* anything */
  294 
  295 #ifdef IEEE80211_DEBUG
  296 extern int ieee80211_debug;
  297 #define IEEE80211_DPRINTF(_ic, _m, _args) do {          \
  298         if (ieee80211_debug & (_m))                     \
  299                 printf _args;                           \
  300 } while (0)
  301 #define ieee80211_msg_debug(_ic) \
  302         (ieee80211_debug & IEEE80211_MSG_DEBUG)
  303 #define ieee80211_msg_dumppkts(_ic) \
  304         (ieee80211_debug & IEEE80211_MSG_DUMPPKTS)
  305 #define ieee80211_msg_input(_ic) \
  306         (ieee80211_debug & IEEE80211_MSG_INPUT)
  307 #define ieee80211_msg_radius(_ic) \
  308         (ieee80211_debug & IEEE80211_MSG_RADIUS)
  309 #define ieee80211_msg_dumpradius(_ic) \
  310         (ieee80211_debug & IEEE80211_MSG_RADDUMP)
  311 #define ieee80211_msg_dumpradkeys(_ic) \
  312         (ieee80211_debug & IEEE80211_MSG_RADKEYS)
  313 #define ieee80211_msg_scan(_ic) \
  314         (ieee80211_debug & IEEE80211_MSG_SCAN)
  315 #else
  316 #define IEEE80211_DPRINTF(_ic, _fmt, ...)
  317 #endif
  318 
  319 extern  int ieee80211_cache_size;
  320 
  321 #endif /* _NET80211_IEEE80211_VAR_H_ */

Cache object: b8a48d828e89963d346184ba560af200


[ 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.