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 /*-
    2  * Copyright (c) 2001 Atsushi Onoe
    3  * Copyright (c) 2002, 2003 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  * Alternatively, this software may be distributed under the terms of the
   18  * GNU General Public License ("GPL") version 2 as published by the Free
   19  * Software Foundation.
   20  *
   21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   31  *
   32  * $FreeBSD: releng/5.4/sys/net80211/ieee80211_var.h 127916 2004-04-05 22:10:26Z sam $
   33  */
   34 #ifndef _NET80211_IEEE80211_VAR_H_
   35 #define _NET80211_IEEE80211_VAR_H_
   36 
   37 /*
   38  * Definitions for IEEE 802.11 drivers.
   39  */
   40 
   41 #include <net80211/ieee80211.h>
   42 #include <net80211/ieee80211_crypto.h>
   43 #include <net80211/ieee80211_ioctl.h>           /* for ieee80211_stats */
   44 #include <net80211/ieee80211_node.h>
   45 #include <net80211/ieee80211_proto.h>
   46 
   47 #define IEEE80211_CHAN_MAX      255
   48 #define IEEE80211_CHAN_ANY      0xffff          /* token for ``any channel'' */
   49 #define IEEE80211_CHAN_ANYC \
   50         ((struct ieee80211_channel *) IEEE80211_CHAN_ANY)
   51 
   52 #define IEEE80211_TXPOWER_MAX   100     /* max power */
   53 #define IEEE80211_TXPOWER_MIN   0       /* kill radio (if possible) */
   54 
   55 enum ieee80211_phytype {
   56         IEEE80211_T_DS,                 /* direct sequence spread spectrum */
   57         IEEE80211_T_FH,                 /* frequency hopping */
   58         IEEE80211_T_OFDM,               /* frequency division multiplexing */
   59         IEEE80211_T_TURBO,              /* high rate OFDM, aka turbo mode */
   60 };
   61 #define IEEE80211_T_CCK IEEE80211_T_DS  /* more common nomenclature */
   62 
   63 /* XXX not really a mode; there are really multiple PHY's */
   64 enum ieee80211_phymode {
   65         IEEE80211_MODE_AUTO     = 0,    /* autoselect */
   66         IEEE80211_MODE_11A      = 1,    /* 5GHz, OFDM */
   67         IEEE80211_MODE_11B      = 2,    /* 2GHz, CCK */
   68         IEEE80211_MODE_11G      = 3,    /* 2GHz, OFDM */
   69         IEEE80211_MODE_FH       = 4,    /* 2GHz, GFSK */
   70         IEEE80211_MODE_TURBO    = 5,    /* 5GHz, OFDM, 2x clock */
   71 };
   72 #define IEEE80211_MODE_MAX      (IEEE80211_MODE_TURBO+1)
   73 
   74 enum ieee80211_opmode {
   75         IEEE80211_M_STA         = 1,    /* infrastructure station */
   76         IEEE80211_M_IBSS        = 0,    /* IBSS (adhoc) station */
   77         IEEE80211_M_AHDEMO      = 3,    /* Old lucent compatible adhoc demo */
   78         IEEE80211_M_HOSTAP      = 6,    /* Software Access Point */
   79         IEEE80211_M_MONITOR     = 8     /* Monitor mode */
   80 };
   81 
   82 /*
   83  * 802.11g protection mode.
   84  */
   85 enum ieee80211_protmode {
   86         IEEE80211_PROT_NONE     = 0,    /* no protection */
   87         IEEE80211_PROT_CTSONLY  = 1,    /* CTS to self */
   88         IEEE80211_PROT_RTSCTS   = 2,    /* RTS-CTS */
   89 };
   90 
   91 /*
   92  * Channels are specified by frequency and attributes.
   93  */
   94 struct ieee80211_channel {
   95         u_int16_t       ic_freq;        /* setting in Mhz */
   96         u_int16_t       ic_flags;       /* see below */
   97 };
   98 
   99 /* bits 0-3 are for private use by drivers */
  100 /* channel attributes */
  101 #define IEEE80211_CHAN_TURBO    0x0010  /* Turbo channel */
  102 #define IEEE80211_CHAN_CCK      0x0020  /* CCK channel */
  103 #define IEEE80211_CHAN_OFDM     0x0040  /* OFDM channel */
  104 #define IEEE80211_CHAN_2GHZ     0x0080  /* 2 GHz spectrum channel. */
  105 #define IEEE80211_CHAN_5GHZ     0x0100  /* 5 GHz spectrum channel */
  106 #define IEEE80211_CHAN_PASSIVE  0x0200  /* Only passive scan allowed */
  107 #define IEEE80211_CHAN_DYN      0x0400  /* Dynamic CCK-OFDM channel */
  108 #define IEEE80211_CHAN_GFSK     0x0800  /* GFSK channel (FHSS PHY) */
  109 
  110 /*
  111  * Useful combinations of channel characteristics.
  112  */
  113 #define IEEE80211_CHAN_FHSS \
  114         (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
  115 #define IEEE80211_CHAN_A \
  116         (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
  117 #define IEEE80211_CHAN_B \
  118         (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
  119 #define IEEE80211_CHAN_PUREG \
  120         (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
  121 #define IEEE80211_CHAN_G \
  122         (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
  123 #define IEEE80211_CHAN_T \
  124         (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
  125 
  126 #define IEEE80211_IS_CHAN_FHSS(_c) \
  127         (((_c)->ic_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS)
  128 #define IEEE80211_IS_CHAN_A(_c) \
  129         (((_c)->ic_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A)
  130 #define IEEE80211_IS_CHAN_B(_c) \
  131         (((_c)->ic_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B)
  132 #define IEEE80211_IS_CHAN_PUREG(_c) \
  133         (((_c)->ic_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG)
  134 #define IEEE80211_IS_CHAN_G(_c) \
  135         (((_c)->ic_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G)
  136 #define IEEE80211_IS_CHAN_T(_c) \
  137         (((_c)->ic_flags & IEEE80211_CHAN_T) == IEEE80211_CHAN_T)
  138 
  139 #define IEEE80211_IS_CHAN_2GHZ(_c) \
  140         (((_c)->ic_flags & IEEE80211_CHAN_2GHZ) != 0)
  141 #define IEEE80211_IS_CHAN_5GHZ(_c) \
  142         (((_c)->ic_flags & IEEE80211_CHAN_5GHZ) != 0)
  143 #define IEEE80211_IS_CHAN_OFDM(_c) \
  144         (((_c)->ic_flags & IEEE80211_CHAN_OFDM) != 0)
  145 #define IEEE80211_IS_CHAN_CCK(_c) \
  146         (((_c)->ic_flags & IEEE80211_CHAN_CCK) != 0)
  147 #define IEEE80211_IS_CHAN_GFSK(_c) \
  148         (((_c)->ic_flags & IEEE80211_CHAN_GFSK) != 0)
  149 
  150 /* ni_chan encoding for FH phy */
  151 #define IEEE80211_FH_CHANMOD    80
  152 #define IEEE80211_FH_CHAN(set,pat)      (((set)-1)*IEEE80211_FH_CHANMOD+(pat))
  153 #define IEEE80211_FH_CHANSET(chan)      ((chan)/IEEE80211_FH_CHANMOD+1)
  154 #define IEEE80211_FH_CHANPAT(chan)      ((chan)%IEEE80211_FH_CHANMOD)
  155 
  156 struct ieee80211com {
  157         struct arpcom           ic_ac;
  158         void                    (*ic_recv_mgmt)(struct ieee80211com *,
  159                                     struct mbuf *, struct ieee80211_node *,
  160                                     int, int, u_int32_t);
  161         int                     (*ic_send_mgmt)(struct ieee80211com *,
  162                                     struct ieee80211_node *, int, int);
  163         int                     (*ic_newstate)(struct ieee80211com *,
  164                                     enum ieee80211_state, int);
  165         void                    (*ic_newassoc)(struct ieee80211com *,
  166                                     struct ieee80211_node *, int);
  167         u_int8_t                ic_myaddr[IEEE80211_ADDR_LEN];
  168         struct ieee80211_rateset ic_sup_rates[IEEE80211_MODE_MAX];
  169         struct ieee80211_channel ic_channels[IEEE80211_CHAN_MAX+1];
  170         u_char                  ic_chan_avail[roundup(IEEE80211_CHAN_MAX,NBBY)];
  171         u_char                  ic_chan_active[roundup(IEEE80211_CHAN_MAX, NBBY)];
  172         u_char                  ic_chan_scan[roundup(IEEE80211_CHAN_MAX,NBBY)];
  173         struct ifqueue          ic_mgtq;
  174         u_int32_t               ic_flags;       /* state flags */
  175         u_int32_t               ic_caps;        /* capabilities */
  176         u_int16_t               ic_modecaps;    /* set of mode capabilities */
  177         u_int16_t               ic_curmode;     /* current mode */
  178         enum ieee80211_phytype  ic_phytype;     /* XXX wrong for multi-mode */
  179         enum ieee80211_opmode   ic_opmode;      /* operation mode */
  180         enum ieee80211_state    ic_state;       /* 802.11 state */
  181         enum ieee80211_protmode ic_protmode;    /* 802.11g protection mode */
  182         struct ifmedia          ic_media;       /* interface media config */
  183         struct bpf_if           *ic_rawbpf;     /* packet filter structure */
  184         struct ieee80211_node   *ic_bss;        /* information for this node */
  185         struct ieee80211_channel *ic_ibss_chan;
  186         int                     ic_fixed_rate;  /* index to ic_sup_rates[] */
  187         u_int16_t               ic_rtsthreshold;
  188         u_int16_t               ic_fragthreshold;
  189         struct mtx              ic_nodelock;    /* on node table */
  190         u_int                   ic_scangen;     /* gen# for timeout scan */
  191         struct ieee80211_node   *(*ic_node_alloc)(struct ieee80211com *);
  192         void                    (*ic_node_free)(struct ieee80211com *,
  193                                         struct ieee80211_node *);
  194         void                    (*ic_node_copy)(struct ieee80211com *,
  195                                         struct ieee80211_node *,
  196                                         const struct ieee80211_node *);
  197         u_int8_t                (*ic_node_getrssi)(struct ieee80211com *,
  198                                         struct ieee80211_node *);
  199         TAILQ_HEAD(, ieee80211_node) ic_node;   /* information of all nodes */
  200         LIST_HEAD(, ieee80211_node) ic_hash[IEEE80211_NODE_HASHSIZE];
  201         u_int16_t               ic_lintval;     /* listen interval */
  202         u_int16_t               ic_holdover;    /* PM hold over duration */
  203         u_int16_t               ic_txmin;       /* min tx retry count */
  204         u_int16_t               ic_txmax;       /* max tx retry count */
  205         u_int16_t               ic_txlifetime;  /* tx lifetime */
  206         u_int16_t               ic_txpower;     /* tx power setting (dbM) */
  207         u_int16_t               ic_bmisstimeout;/* beacon miss threshold (ms) */
  208         int                     ic_mgt_timer;   /* mgmt timeout */
  209         int                     ic_inact_timer; /* inactivity timer wait */
  210         int                     ic_des_esslen;
  211         u_int8_t                ic_des_essid[IEEE80211_NWID_LEN];
  212         struct ieee80211_channel *ic_des_chan;  /* desired channel */
  213         u_int8_t                ic_des_bssid[IEEE80211_ADDR_LEN];
  214         struct ieee80211_wepkey ic_nw_keys[IEEE80211_WEP_NKID];
  215         int                     ic_wep_txkey;   /* default tx key index */
  216         void                    *ic_wep_ctx;    /* wep crypt context */
  217         u_int32_t               ic_iv;          /* initial vector for wep */
  218         struct ieee80211_stats  ic_stats;       /* statistics */
  219 };
  220 #define ic_if           ic_ac.ac_if
  221 #define ic_softc        ic_if.if_softc
  222 
  223 #define IEEE80211_ADDR_EQ(a1,a2)        (memcmp(a1,a2,IEEE80211_ADDR_LEN) == 0)
  224 #define IEEE80211_ADDR_COPY(dst,src)    memcpy(dst,src,IEEE80211_ADDR_LEN)
  225 
  226 /* ic_flags */
  227 #define IEEE80211_F_ASCAN       0x00000001      /* STATUS: active scan */
  228 #define IEEE80211_F_SIBSS       0x00000002      /* STATUS: start IBSS */
  229 #define IEEE80211_F_WEPON       0x00000100      /* CONF: WEP enabled */
  230 #define IEEE80211_F_IBSSON      0x00000200      /* CONF: IBSS creation enable */
  231 #define IEEE80211_F_PMGTON      0x00000400      /* CONF: Power mgmt enable */
  232 #define IEEE80211_F_DESBSSID    0x00000800      /* CONF: des_bssid is set */
  233 #define IEEE80211_F_SCANAP      0x00001000      /* CONF: Scanning AP */
  234 #define IEEE80211_F_ROAMING     0x00002000      /* CONF: roaming enabled */
  235 #define IEEE80211_F_SWRETRY     0x00004000      /* CONF: sw tx retry enabled */
  236 #define IEEE80211_F_TXPMGT      0x00018000      /* STATUS: tx power */
  237 #define IEEE80211_F_TXPOW_OFF   0x00000000      /* TX Power: radio disabled */
  238 #define IEEE80211_F_TXPOW_FIXED 0x00008000      /* TX Power: fixed rate */
  239 #define IEEE80211_F_TXPOW_AUTO  0x00010000      /* TX Power: undefined */
  240 #define IEEE80211_F_SHSLOT      0x00020000      /* CONF: short slot time */
  241 #define IEEE80211_F_SHPREAMBLE  0x00040000      /* CONF: short preamble */
  242 #define IEEE80211_F_USEPROT     0x00100000      /* STATUS: protection enabled */
  243 #define IEEE80211_F_USEBARKER   0x00200000      /* STATUS: use barker preamble*/
  244 
  245 /* ic_caps */
  246 #define IEEE80211_C_WEP         0x00000001      /* CAPABILITY: WEP available */
  247 #define IEEE80211_C_IBSS        0x00000002      /* CAPABILITY: IBSS available */
  248 #define IEEE80211_C_PMGT        0x00000004      /* CAPABILITY: Power mgmt */
  249 #define IEEE80211_C_HOSTAP      0x00000008      /* CAPABILITY: HOSTAP avail */
  250 #define IEEE80211_C_AHDEMO      0x00000010      /* CAPABILITY: Old Adhoc Demo */
  251 #define IEEE80211_C_SWRETRY     0x00000020      /* CAPABILITY: sw tx retry */
  252 #define IEEE80211_C_TXPMGT      0x00000040      /* CAPABILITY: tx power mgmt */
  253 #define IEEE80211_C_SHSLOT      0x00000080      /* CAPABILITY: short slottime */
  254 #define IEEE80211_C_SHPREAMBLE  0x00000100      /* CAPABILITY: short preamble */
  255 #define IEEE80211_C_MONITOR     0x00000200      /* CAPABILITY: monitor mode */
  256 
  257 /* flags for ieee80211_fix_rate() */
  258 #define IEEE80211_F_DOSORT      0x00000001      /* sort rate list */
  259 #define IEEE80211_F_DOFRATE     0x00000002      /* use fixed rate */
  260 #define IEEE80211_F_DONEGO      0x00000004      /* calc negotiated rate */
  261 #define IEEE80211_F_DODEL       0x00000008      /* delete ignore rate */
  262 
  263 void    ieee80211_ifattach(struct ifnet *);
  264 void    ieee80211_ifdetach(struct ifnet *);
  265 void    ieee80211_media_init(struct ifnet *, ifm_change_cb_t, ifm_stat_cb_t);
  266 int     ieee80211_media_change(struct ifnet *);
  267 void    ieee80211_media_status(struct ifnet *, struct ifmediareq *);
  268 int     ieee80211_ioctl(struct ifnet *, u_long, caddr_t);
  269 int     ieee80211_cfgget(struct ifnet *, u_long, caddr_t);
  270 int     ieee80211_cfgset(struct ifnet *, u_long, caddr_t);
  271 void    ieee80211_watchdog(struct ifnet *);
  272 int     ieee80211_fix_rate(struct ieee80211com *, struct ieee80211_node *, int);
  273 int     ieee80211_rate2media(struct ieee80211com *, int,
  274                 enum ieee80211_phymode);
  275 int     ieee80211_media2rate(int);
  276 u_int   ieee80211_mhz2ieee(u_int, u_int);
  277 u_int   ieee80211_chan2ieee(struct ieee80211com *, struct ieee80211_channel *);
  278 u_int   ieee80211_ieee2mhz(u_int, u_int);
  279 int     ieee80211_setmode(struct ieee80211com *, enum ieee80211_phymode);
  280 enum ieee80211_phymode ieee80211_chan2mode(struct ieee80211com *,
  281                 struct ieee80211_channel *);
  282 
  283 #define IEEE80211_DEBUG
  284 #ifdef IEEE80211_DEBUG
  285 extern  int ieee80211_debug;
  286 #define IEEE80211_DPRINTF(X)    if (ieee80211_debug) printf X
  287 #define IEEE80211_DPRINTF2(X)   if (ieee80211_debug>1) printf X
  288 #else
  289 #define IEEE80211_DPRINTF(X)
  290 #define IEEE80211_DPRINTF2(X)
  291 #endif
  292 
  293 #endif /* _NET80211_IEEE80211_VAR_H_ */

Cache object: 83aad34543a9a49a49de04521d78c273


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