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/net/if_ieee80211.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: if_ieee80211.h,v 1.23 2002/10/15 08:51:50 onoe Exp $   */
    2 /*      $FreeBSD: releng/5.1/sys/net/if_ieee80211.h 109319 2003-01-15 20:01:50Z sam $ */
    3 
    4 /*-
    5  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
    6  * All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. All advertising materials mentioning features or use of this software
   17  *    must display the following acknowledgement:
   18  *        This product includes software developed by the NetBSD
   19  *        Foundation, Inc. and its contributors.
   20  * 4. Neither the name of The NetBSD Foundation nor the names of its
   21  *    contributors may be used to endorse or promote products derived
   22  *    from this software without specific prior written permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   25  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   26  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   27  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   28  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   32  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   33  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   34  * POSSIBILITY OF SUCH DAMAGE.
   35  */
   36 
   37 #ifndef _NET_IF_IEEE80211_H_
   38 #define _NET_IF_IEEE80211_H_
   39 
   40 #include <net/ethernet.h>
   41 #include <net/if_arp.h>
   42 
   43 #define IEEE80211_ADDR_LEN                      ETHER_ADDR_LEN
   44 
   45 /*
   46  * generic definitions for IEEE 802.11 frames
   47  */
   48 struct ieee80211_frame {
   49         u_int8_t        i_fc[2];
   50         u_int8_t        i_dur[2];
   51         u_int8_t        i_addr1[IEEE80211_ADDR_LEN];
   52         u_int8_t        i_addr2[IEEE80211_ADDR_LEN];
   53         u_int8_t        i_addr3[IEEE80211_ADDR_LEN];
   54         u_int8_t        i_seq[2];
   55         /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
   56         /* see below */
   57 } __attribute__((__packed__));
   58 
   59 struct ieee80211_frame_addr4 {
   60         u_int8_t        i_fc[2];
   61         u_int8_t        i_dur[2];
   62         u_int8_t        i_addr1[IEEE80211_ADDR_LEN];
   63         u_int8_t        i_addr2[IEEE80211_ADDR_LEN];
   64         u_int8_t        i_addr3[IEEE80211_ADDR_LEN];
   65         u_int8_t        i_seq[2];
   66         u_int8_t        i_addr4[IEEE80211_ADDR_LEN];
   67 } __attribute__((__packed__));
   68 
   69 #define IEEE80211_FC0_VERSION_MASK              0x03
   70 #define IEEE80211_FC0_VERSION_SHIFT             0
   71 #define IEEE80211_FC0_VERSION_0                 0x00
   72 #define IEEE80211_FC0_TYPE_MASK                 0x0c
   73 #define IEEE80211_FC0_TYPE_SHIFT                2
   74 #define IEEE80211_FC0_TYPE_MGT                  0x00
   75 #define IEEE80211_FC0_TYPE_CTL                  0x04
   76 #define IEEE80211_FC0_TYPE_DATA                 0x08
   77 
   78 #define IEEE80211_FC0_SUBTYPE_MASK              0xf0
   79 #define IEEE80211_FC0_SUBTYPE_SHIFT             4
   80 /* for TYPE_MGT */
   81 #define IEEE80211_FC0_SUBTYPE_ASSOC_REQ         0x00
   82 #define IEEE80211_FC0_SUBTYPE_ASSOC_RESP        0x10
   83 #define IEEE80211_FC0_SUBTYPE_REASSOC_REQ       0x20
   84 #define IEEE80211_FC0_SUBTYPE_REASSOC_RESP      0x30
   85 #define IEEE80211_FC0_SUBTYPE_PROBE_REQ         0x40
   86 #define IEEE80211_FC0_SUBTYPE_PROBE_RESP        0x50
   87 #define IEEE80211_FC0_SUBTYPE_BEACON            0x80
   88 #define IEEE80211_FC0_SUBTYPE_ATIM              0x90
   89 #define IEEE80211_FC0_SUBTYPE_DISASSOC          0xa0
   90 #define IEEE80211_FC0_SUBTYPE_AUTH              0xb0
   91 #define IEEE80211_FC0_SUBTYPE_DEAUTH            0xc0
   92 /* for TYPE_CTL */
   93 #define IEEE80211_FC0_SUBTYPE_PS_POLL           0xa0
   94 #define IEEE80211_FC0_SUBTYPE_RTS               0xb0
   95 #define IEEE80211_FC0_SUBTYPE_CTS               0xc0
   96 #define IEEE80211_FC0_SUBTYPE_ACK               0xd0
   97 #define IEEE80211_FC0_SUBTYPE_CF_END            0xe0
   98 #define IEEE80211_FC0_SUBTYPE_CF_END_ACK        0xf0
   99 /* for TYPE_DATA (bit combination) */
  100 #define IEEE80211_FC0_SUBTYPE_DATA              0x00
  101 #define IEEE80211_FC0_SUBTYPE_CF_ACK            0x10
  102 #define IEEE80211_FC0_SUBTYPE_CF_POLL           0x20
  103 #define IEEE80211_FC0_SUBTYPE_CF_ACPL           0x30
  104 #define IEEE80211_FC0_SUBTYPE_NODATA            0x40
  105 #define IEEE80211_FC0_SUBTYPE_CFACK             0x50
  106 #define IEEE80211_FC0_SUBTYPE_CFPOLL            0x60
  107 #define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK     0x70
  108 
  109 #define IEEE80211_FC1_DIR_MASK                  0x03
  110 #define IEEE80211_FC1_DIR_NODS                  0x00    /* STA->STA */
  111 #define IEEE80211_FC1_DIR_TODS                  0x01    /* STA->AP  */
  112 #define IEEE80211_FC1_DIR_FROMDS                0x02    /* AP ->STA */
  113 #define IEEE80211_FC1_DIR_DSTODS                0x03    /* AP ->AP  */
  114 
  115 #define IEEE80211_FC1_MORE_FRAG                 0x04
  116 #define IEEE80211_FC1_RETRY                     0x08
  117 #define IEEE80211_FC1_PWR_MGT                   0x10
  118 #define IEEE80211_FC1_MORE_DATA                 0x20
  119 #define IEEE80211_FC1_WEP                       0x40
  120 #define IEEE80211_FC1_ORDER                     0x80
  121 
  122 #define IEEE80211_SEQ_FRAG_MASK                 0x000f
  123 #define IEEE80211_SEQ_FRAG_SHIFT                0
  124 #define IEEE80211_SEQ_SEQ_MASK                  0xfff0
  125 #define IEEE80211_SEQ_SEQ_SHIFT                 4
  126 
  127 #define IEEE80211_NWID_LEN                      32
  128 
  129 /*
  130  * BEACON management packets
  131  *
  132  *      octet timestamp[8]
  133  *      octet beacon interval[2]
  134  *      octet capability information[2]
  135  *      information element
  136  *              octet elemid
  137  *              octet length
  138  *              octet information[length]
  139  */
  140 
  141 typedef uint8_t *ieee80211_mgt_beacon_t;
  142 
  143 #define IEEE80211_BEACON_INTERVAL(beacon) \
  144         ((beacon)[8] | ((beacon)[9] << 8))
  145 #define IEEE80211_BEACON_CAPABILITY(beacon) \
  146         ((beacon)[10] | ((beacon)[11] << 8))
  147 
  148 #define IEEE80211_CAPINFO_ESS                   0x0001
  149 #define IEEE80211_CAPINFO_IBSS                  0x0002
  150 #define IEEE80211_CAPINFO_CF_POLLABLE           0x0004
  151 #define IEEE80211_CAPINFO_CF_POLLREQ            0x0008
  152 #define IEEE80211_CAPINFO_PRIVACY               0x0010
  153 #define IEEE80211_CAPINFO_SHORT_PREAMBLE        0x0020
  154 #define IEEE80211_CAPINFO_PBCC                  0x0040
  155 #define IEEE80211_CAPINFO_CHNL_AGILITY          0x0080
  156 
  157 #define IEEE80211_RATE_BASIC                    0x80
  158 #define IEEE80211_RATE_VAL                      0x7f
  159 
  160 /*
  161  * Management information elements
  162  */
  163 
  164 struct ieee80211_information {
  165         char    ssid[IEEE80211_NWID_LEN+1];
  166         struct rates {
  167                 u_int8_t        *p;
  168         } rates;
  169         struct fh {
  170                 u_int16_t       dwell;
  171                 u_int8_t        set;
  172                 u_int8_t        pattern;
  173                 u_int8_t        index;
  174         } fh;
  175         struct ds {
  176                 u_int8_t        channel;
  177         } ds;
  178         struct cf {
  179                 u_int8_t        count;
  180                 u_int8_t        period;
  181                 u_int8_t        maxdur[2];
  182                 u_int8_t        dur[2];
  183         } cf;
  184         struct tim {
  185                 u_int8_t        count;
  186                 u_int8_t        period;
  187                 u_int8_t        bitctl;
  188                 /* u_int8_t     pvt[251]; The driver needs to use this. */
  189         } tim;
  190         struct ibss {
  191                 u_int16_t       atim;
  192         } ibss;
  193         struct challenge {
  194                 u_int8_t        *p;
  195                 u_int8_t        len;
  196         } challenge;
  197 };
  198 
  199 #define IEEE80211_ELEMID_SSID                   0
  200 #define IEEE80211_ELEMID_RATES                  1
  201 #define IEEE80211_ELEMID_FHPARMS                2
  202 #define IEEE80211_ELEMID_DSPARMS                3
  203 #define IEEE80211_ELEMID_CFPARMS                4
  204 #define IEEE80211_ELEMID_TIM                    5
  205 #define IEEE80211_ELEMID_IBSSPARMS              6
  206 #define IEEE80211_ELEMID_CHALLENGE              16
  207 
  208 /*
  209  * AUTH management packets
  210  *
  211  *      octet algo[2]
  212  *      octet seq[2]
  213  *      octet status[2]
  214  *      octet chal.id
  215  *      octet chal.length
  216  *      octet chal.text[253]
  217  */
  218 
  219 typedef u_int8_t *ieee80211_mgt_auth_t;
  220 
  221 #define IEEE80211_AUTH_ALGORITHM(auth) \
  222         ((auth)[0] | ((auth)[1] << 8))
  223 #define IEEE80211_AUTH_TRANSACTION(auth) \
  224         ((auth)[2] | ((auth)[3] << 8))
  225 #define IEEE80211_AUTH_STATUS(auth) \
  226         ((auth)[4] | ((auth)[5] << 8))
  227 
  228 #define IEEE80211_AUTH_ALG_OPEN                 0x0000
  229 #define IEEE80211_AUTH_ALG_SHARED               0x0001
  230 
  231 #define IEEE80211_AUTH_OPEN_REQUEST             1
  232 #define IEEE80211_AUTH_OPEN_RESPONSE            2
  233 
  234 #define IEEE80211_AUTH_SHARED_REQUEST           1
  235 #define IEEE80211_AUTH_SHARED_CHALLENGE         2
  236 #define IEEE80211_AUTH_SHARED_RESPONSE          3
  237 #define IEEE80211_AUTH_SHARED_PASS              4
  238 
  239 /*
  240  * Reason codes
  241  *
  242  * Unlisted codes are reserved
  243  */
  244 
  245 #define IEEE80211_REASON_UNSPECIFIED            1
  246 #define IEEE80211_REASON_AUTH_EXPIRE            2
  247 #define IEEE80211_REASON_AUTH_LEAVE             3
  248 #define IEEE80211_REASON_ASSOC_EXPIRE           4
  249 #define IEEE80211_REASON_ASSOC_TOOMANY          5
  250 #define IEEE80211_REASON_NOT_AUTHED             6  
  251 #define IEEE80211_REASON_NOT_ASSOCED            7
  252 #define IEEE80211_REASON_ASSOC_LEAVE            8
  253 #define IEEE80211_REASON_ASSOC_NOT_AUTHED       9
  254 
  255 #define IEEE80211_STATUS_SUCCESS                0
  256 #define IEEE80211_STATUS_UNSPECIFIED            1
  257 #define IEEE80211_STATUS_CAPINFO                10
  258 #define IEEE80211_STATUS_NOT_ASSOCED            11
  259 #define IEEE80211_STATUS_OTHER                  12
  260 #define IEEE80211_STATUS_ALG                    13
  261 #define IEEE80211_STATUS_SEQUENCE               14
  262 #define IEEE80211_STATUS_CHALLENGE              15
  263 #define IEEE80211_STATUS_TIMEOUT                16
  264 #define IEEE80211_STATUS_TOOMANY                17
  265 #define IEEE80211_STATUS_BASIC_RATE             18
  266 #define IEEE80211_STATUS_SP_REQUIRED            19
  267 #define IEEE80211_STATUS_PBCC_REQUIRED          20
  268 #define IEEE80211_STATUS_CA_REQUIRED            21
  269 #define IEEE80211_STATUS_TOO_MANY_STATIONS      22
  270 #define IEEE80211_STATUS_RATES                  23
  271 
  272 #define IEEE80211_WEP_KEYLEN                    5       /* 40bit */
  273 #define IEEE80211_WEP_IVLEN                     3       /* 24bit */
  274 #define IEEE80211_WEP_KIDLEN                    1       /* 1 octet */
  275 #define IEEE80211_WEP_CRCLEN                    4       /* CRC-32 */
  276 #define IEEE80211_WEP_NKID                      4       /* number of key ids */
  277 
  278 #define IEEE80211_CRC_LEN                       4
  279 
  280 #define IEEE80211_MTU                           1500
  281 #define IEEE80211_MAX_LEN                       (2300 + IEEE80211_CRC_LEN + \
  282     (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
  283 
  284 /*
  285  * ioctls
  286  */
  287 
  288 /* nwid is pointed at by ifr.ifr_data */
  289 struct ieee80211_nwid {
  290         u_int8_t        i_len;
  291         u_int8_t        i_nwid[IEEE80211_NWID_LEN];
  292 };
  293 
  294 #define SIOCS80211NWID          _IOWR('i', 230, struct ifreq)
  295 #define SIOCG80211NWID          _IOWR('i', 231, struct ifreq)
  296 
  297 /* the first member must be matched with struct ifreq */
  298 struct ieee80211_nwkey {
  299         char            i_name[IFNAMSIZ];       /* if_name, e.g. "wi0" */
  300         int             i_wepon;                /* wep enabled flag */
  301         int             i_defkid;               /* default encrypt key id */
  302         struct {
  303                 int             i_keylen;
  304                 u_int8_t        *i_keydat;
  305         }               i_key[IEEE80211_WEP_NKID];
  306 };
  307 #define SIOCS80211NWKEY          _IOW('i', 232, struct ieee80211_nwkey)
  308 #define SIOCG80211NWKEY         _IOWR('i', 233, struct ieee80211_nwkey)
  309 /* i_wepon */
  310 #define IEEE80211_NWKEY_OPEN    0               /* No privacy */
  311 #define IEEE80211_NWKEY_WEP     1               /* WEP enabled */
  312 #define IEEE80211_NWKEY_EAP     2               /* EAP enabled */
  313 #define IEEE80211_NWKEY_PERSIST 0x100           /* designate persist keyset */
  314 
  315 /* power management parameters */
  316 struct ieee80211_power {
  317         char            i_name[IFNAMSIZ];       /* if_name, e.g. "wi0" */
  318         int             i_enabled;              /* 1 == on, 0 == off */
  319         int             i_maxsleep;             /* max sleep in ms */
  320 };
  321 #ifdef __NetBSD__
  322 #define SIOCS80211POWER          _IOW('i', 234, struct ieee80211_power)
  323 #define SIOCG80211POWER         _IOWR('i', 235, struct ieee80211_power)
  324 #else
  325 #define SIOCS80211POWER          _IOW('i', 242, struct ieee80211_power)
  326 #define SIOCG80211POWER         _IOWR('i', 243, struct ieee80211_power)
  327 #endif
  328 
  329 struct ieee80211_auth {
  330         char            i_name[IFNAMSIZ];       /* if_name, e.g. "wi0" */
  331         int             i_authtype;
  332 };
  333 
  334 #define IEEE80211_AUTH_NONE     0
  335 #define IEEE80211_AUTH_OPEN     1
  336 #define IEEE80211_AUTH_SHARED   2
  337 
  338 #define SIOCS80211AUTH           _IOW('i', 236, struct ieee80211_auth)
  339 #define SIOCG80211AUTH          _IOWR('i', 237, struct ieee80211_auth)
  340 
  341 struct ieee80211_channel {
  342         char            i_name[IFNAMSIZ];       /* if_name, e.g. "wi0" */
  343         u_int16_t       i_channel;
  344 };
  345 
  346 #define IEEE80211_CHAN_ANY      0xffff
  347 
  348 #define SIOCS80211CHANNEL        _IOW('i', 238, struct ieee80211_channel)
  349 #define SIOCG80211CHANNEL       _IOWR('i', 239, struct ieee80211_channel)
  350 
  351 struct ieee80211_bssid {
  352         char            i_name[IFNAMSIZ];       /* if_name, e.g. "wi0" */
  353         u_int8_t        i_bssid[IEEE80211_ADDR_LEN];
  354 };
  355 
  356 #define SIOCS80211BSSID          _IOW('i', 240, struct ieee80211_bssid)
  357 #define SIOCG80211BSSID         _IOWR('i', 241, struct ieee80211_bssid)
  358 
  359 /*
  360  * FreeBSD-style ioctls.
  361  */
  362 /* the first member must be matched with struct ifreq */
  363 struct ieee80211req {
  364         char            i_name[IFNAMSIZ];       /* if_name, e.g. "wi0" */
  365         u_int16_t       i_type;                 /* req type */
  366         int16_t         i_val;                  /* Index or simple value */
  367         int16_t         i_len;                  /* Index or simple value */
  368         void            *i_data;                /* Extra data */
  369 };
  370 #ifdef __FreeBSD__
  371 #define SIOCS80211               _IOW('i', 234, struct ieee80211req)
  372 #define SIOCG80211              _IOWR('i', 235, struct ieee80211req)
  373 #else
  374 #define SIOCS80211               _IOW('i', 242, struct ieee80211req)
  375 #define SIOCG80211              _IOWR('i', 243, struct ieee80211req)
  376 #endif
  377 
  378 #define IEEE80211_IOC_SSID              1
  379 #define IEEE80211_IOC_NUMSSIDS          2
  380 #define IEEE80211_IOC_WEP               3
  381 #define         IEEE80211_WEP_NOSUP     -1
  382 #define         IEEE80211_WEP_OFF       0
  383 #define         IEEE80211_WEP_ON        1
  384 #define         IEEE80211_WEP_MIXED     2
  385 #define IEEE80211_IOC_WEPKEY            4
  386 #define IEEE80211_IOC_NUMWEPKEYS        5
  387 #define IEEE80211_IOC_WEPTXKEY          6
  388 #define IEEE80211_IOC_AUTHMODE          7
  389 #define IEEE80211_IOC_STATIONNAME       8
  390 #define IEEE80211_IOC_CHANNEL           9
  391 #define IEEE80211_IOC_POWERSAVE         10
  392 #define         IEEE80211_POWERSAVE_NOSUP       -1
  393 #define         IEEE80211_POWERSAVE_OFF         0
  394 #define         IEEE80211_POWERSAVE_CAM         1
  395 #define         IEEE80211_POWERSAVE_PSP         2
  396 #define         IEEE80211_POWERSAVE_PSP_CAM     3
  397 #define         IEEE80211_POWERSAVE_ON          IEEE80211_POWERSAVE_CAM
  398 #define IEEE80211_IOC_POWERSAVESLEEP    11
  399 
  400 #ifdef _KERNEL
  401 
  402 #define IEEE80211_ASCAN_WAIT    2               /* active scan wait */
  403 #define IEEE80211_PSCAN_WAIT    5               /* passive scan wait */
  404 #define IEEE80211_TRANS_WAIT    5               /* transition wait */
  405 #define IEEE80211_INACT_WAIT    5               /* inactivity timer interval */
  406 #define IEEE80211_INACT_MAX     (300/IEEE80211_INACT_WAIT)
  407 
  408 /*
  409  * Structure for IEEE 802.11 drivers.
  410  */
  411 
  412 #define IEEE80211_CHAN_MAX      255
  413 #define IEEE80211_RATE_SIZE     12
  414 #define IEEE80211_KEYBUF_SIZE   16
  415 #define IEEE80211_NODE_HASHSIZE 32
  416 /* simple hash is enough for variation of macaddr */
  417 #define IEEE80211_NODE_HASH(addr)       \
  418         (((u_int8_t *)(addr))[IEEE80211_ADDR_LEN - 1] % IEEE80211_NODE_HASHSIZE)
  419 
  420 enum ieee80211_phytype {
  421         IEEE80211_T_DS,                 /* direct sequence spread spectrum */
  422         IEEE80211_T_FH,                 /* frequency hopping */
  423         IEEE80211_T_OFDM,               /* frequency division multiplexing */
  424         IEEE80211_T_HRDS                /* high rate DS */
  425 };
  426 
  427 enum ieee80211_opmode {
  428         IEEE80211_M_STA = 1,            /* infrastructure station */
  429         IEEE80211_M_IBSS = 0,           /* IBSS (adhoc) station */
  430         IEEE80211_M_AHDEMO = 3,         /* Old lucent compatible adhoc demo */
  431         IEEE80211_M_HOSTAP = 6          /* Software Access Point */
  432 };
  433 
  434 enum ieee80211_state {
  435         IEEE80211_S_INIT,               /* default state */
  436         IEEE80211_S_SCAN,               /* scanning */
  437         IEEE80211_S_AUTH,               /* try to authenticate */
  438         IEEE80211_S_ASSOC,              /* try to assoc */
  439         IEEE80211_S_RUN                 /* associated */
  440 };
  441 
  442 /*
  443  * Node specific information.
  444  */
  445 struct ieee80211_node {
  446         TAILQ_ENTRY(ieee80211_node)     ni_list;
  447         LIST_ENTRY(ieee80211_node)      ni_hash;
  448 
  449         /* hardware */
  450         u_int8_t                ni_rssi;
  451         u_int32_t               ni_rstamp;
  452 
  453         /* header */
  454         u_int8_t                ni_macaddr[IEEE80211_ADDR_LEN];
  455         u_int8_t                ni_bssid[IEEE80211_ADDR_LEN];
  456 
  457         /* beacon, probe response */
  458         u_int8_t                ni_tstamp[8];
  459         u_int16_t               ni_intval;
  460         u_int16_t               ni_capinfo;
  461         u_int8_t                ni_esslen;
  462         u_int8_t                ni_essid[IEEE80211_NWID_LEN];
  463         int                     ni_nrate;
  464         u_int8_t                ni_rates[IEEE80211_RATE_SIZE];
  465         u_int8_t                ni_chan;
  466         u_int16_t               ni_fhdwell;     /* FH only */
  467         u_int8_t                ni_fhindex;     /* FH only */
  468 
  469         /* DTIM and contention free period (CFP) */
  470         u_int8_t                ni_dtimperiod;
  471         u_int8_t                ni_cfpperiod;   /* # of DTIMs between CFPs */
  472         u_int16_t               ni_cfpmaxduration;/* max CFP duration in TU */
  473         u_int16_t               ni_cfpduremain; /* remaining duration */
  474         u_int16_t               ni_timoffset;
  475 
  476         /* others */
  477         u_int16_t               ni_associd;     /* assoc response */
  478         u_int16_t               ni_txseq;       /* seq to be transmitted */
  479         u_int16_t               ni_rxseq;       /* seq previous received */
  480         int                     ni_fails;       /* failure count to associate */
  481         int                     ni_inact;       /* inactivity mark count */
  482         int                     ni_txrate;      /* index to ni_rates[] */
  483         void                    *ni_private;    /* driver private */
  484 };
  485 
  486 /* ni_chan encoding for FH phy */
  487 #define IEEE80211_FH_CHANMOD    80
  488 #define IEEE80211_FH_CHAN(set,pat)      (((set)-1)*IEEE80211_FH_CHANMOD+(pat))
  489 #define IEEE80211_FH_CHANSET(chan)      ((chan)/IEEE80211_FH_CHANMOD+1)
  490 #define IEEE80211_FH_CHANPAT(chan)      ((chan)%IEEE80211_FH_CHANMOD)
  491 
  492 struct ieee80211_wepkey {
  493         int                     wk_len;
  494         u_int8_t                wk_key[IEEE80211_KEYBUF_SIZE];
  495 };
  496 
  497 struct ieee80211com {
  498 #ifdef __NetBSD__
  499         struct ethercom         ic_ec;
  500 #endif
  501 #ifdef __FreeBSD__
  502         struct arpcom           ic_ac;
  503         struct mtx              ic_mtx;
  504 #endif
  505         void                    (*ic_recv_mgmt[16])(struct ieee80211com *,
  506                                     struct mbuf *, int, u_int32_t);
  507         int                     (*ic_send_mgmt[16])(struct ieee80211com *,
  508                                     struct ieee80211_node *, int, int);
  509         int                     (*ic_newstate)(void *, enum ieee80211_state);
  510         int                     (*ic_chancheck)(void *, u_char *);
  511         u_int8_t                ic_myaddr[IEEE80211_ADDR_LEN];
  512         u_int8_t                ic_sup_rates[IEEE80211_RATE_SIZE];
  513         u_char                  ic_chan_avail[roundup(IEEE80211_CHAN_MAX,NBBY)];
  514         u_char                  ic_chan_active[roundup(IEEE80211_CHAN_MAX, NBBY)];
  515         struct ifqueue          ic_mgtq;
  516         int                     ic_flags;
  517         enum ieee80211_phytype  ic_phytype;
  518         enum ieee80211_opmode   ic_opmode;
  519         enum ieee80211_state    ic_state;
  520         struct bpf_if           *ic_rawbpf;     /* packet filter structure */
  521         struct ieee80211_node   ic_bss;         /* information for this node */
  522         int                     ic_node_privlen;/* size for ni_private */
  523         void                    (*ic_node_free)(struct ieee80211com *,
  524                                     struct ieee80211_node *);   /* callback */
  525         u_int8_t                ic_ibss_chan;
  526         int                     ic_fixed_rate;  /* index to ic_sup_rates[] */
  527         TAILQ_HEAD(, ieee80211_node) ic_node;   /* information of all nodes */
  528         LIST_HEAD(, ieee80211_node) ic_hash[IEEE80211_NODE_HASHSIZE];
  529         u_int16_t               ic_lintval;     /* listen interval */
  530         int                     ic_mgt_timer;   /* mgmt timeout */
  531         int                     ic_scan_timer;  /* scant wait */
  532         int                     ic_inact_timer; /* inactivity timer wait */
  533         int                     ic_des_esslen;
  534         u_int8_t                ic_des_essid[IEEE80211_NWID_LEN];
  535         int                     ic_des_chan;    /* desired channel */
  536         u_int8_t                ic_des_bssid[IEEE80211_ADDR_LEN];
  537         struct ieee80211_wepkey ic_nw_keys[IEEE80211_WEP_NKID];
  538         int                     ic_wep_txkey;   /* default tx key index */
  539         void                    *ic_wep_ctx;    /* wep crypt context */
  540         u_int32_t               ic_iv;          /* initial vector for wep */
  541 };
  542 #ifdef __NetBSD__
  543 #define ic_if           ic_ec.ec_if
  544 #define IEEE80211_LOCK(_ic)     do { s = splnet(); } while (0)
  545 #define IEEE80211_UNLOCK(_ic)   splx(s)
  546 #endif
  547 #ifdef __FreeBSD__
  548 #define ic_if           ic_ac.ac_if
  549 #define IEEE80211_LOCK(_ic)     mtx_lock(&(_ic)->ic_mtx)
  550 #define IEEE80211_UNLOCK(_ic)   mtx_unlock(&(_ic)->ic_mtx)
  551 #endif
  552 #define ic_softc        ic_if.if_softc
  553 
  554 #define IEEE80211_SEND_MGMT(ic,ni,type,arg)     do {                          \
  555         if ((ic)->ic_send_mgmt[(type)>>IEEE80211_FC0_SUBTYPE_SHIFT] != NULL)  \
  556                 (*(ic)->ic_send_mgmt[(type)>>IEEE80211_FC0_SUBTYPE_SHIFT])    \
  557                     (ic,ni,type,arg);                                         \
  558 } while (0)
  559 
  560 #define IEEE80211_ADDR_EQ(a1,a2)        (memcmp(a1,a2,IEEE80211_ADDR_LEN) == 0)
  561 #define IEEE80211_ADDR_COPY(dst,src)    memcpy(dst,src,IEEE80211_ADDR_LEN)
  562 
  563 #define IEEE80211_IS_MULTICAST(a)       ETHER_IS_MULTICAST(a)
  564 
  565 /* ic_flags */
  566 #define IEEE80211_F_ASCAN       0x00000001      /* STATUS: active scan */
  567 #define IEEE80211_F_SIBSS       0x00000002      /* STATUS: start IBSS */
  568 #define IEEE80211_F_WEPON       0x00000100      /* CONF: WEP enabled */
  569 #define IEEE80211_F_IBSSON      0x00000200      /* CONF: IBSS creation enable */
  570 #define IEEE80211_F_PMGTON      0x00000400      /* CONF: Power mgmt enable */
  571 #define IEEE80211_F_DESBSSID    0x00000800      /* CONF: des_bssid is set */
  572 #define IEEE80211_F_SCANAP      0x00001000      /* CONF: Scanning AP */
  573 #define IEEE80211_F_HASWEP      0x00010000      /* CAPABILITY: WEP available */
  574 #define IEEE80211_F_HASIBSS     0x00020000      /* CAPABILITY: IBSS available */
  575 #define IEEE80211_F_HASPMGT     0x00040000      /* CAPABILITY: Power mgmt */
  576 #define IEEE80211_F_HASHOSTAP   0x00080000      /* CAPABILITY: HOSTAP avail */
  577 #define IEEE80211_F_HASAHDEMO   0x00100000      /* CAPABILITY: Old Adhoc Demo */
  578 
  579 /* flags for ieee80211_fix_rate() */
  580 #define IEEE80211_F_DOSORT      0x00000001      /* sort rate list */
  581 #define IEEE80211_F_DOFRATE     0x00000002      /* use fixed rate */
  582 #define IEEE80211_F_DONEGO      0x00000004      /* calc negotiated rate */
  583 #define IEEE80211_F_DODEL       0x00000008      /* delete ignore rate */
  584 
  585 void    ieee80211_ifattach(struct ifnet *);
  586 void    ieee80211_ifdetach(struct ifnet *);
  587 void    ieee80211_input(struct ifnet *, struct mbuf *, int, u_int32_t);
  588 int     ieee80211_mgmt_output(struct ifnet *, struct ieee80211_node *,
  589     struct mbuf *, int);
  590 struct mbuf *ieee80211_encap(struct ifnet *, struct mbuf *);
  591 struct mbuf *ieee80211_decap(struct ifnet *, struct mbuf *);
  592 int     ieee80211_ioctl(struct ifnet *, u_long, caddr_t);
  593 void    ieee80211_print_essid(u_int8_t *, int);
  594 void    ieee80211_dump_pkt(u_int8_t *, int, int, int);
  595 void    ieee80211_watchdog(struct ifnet *);
  596 void    ieee80211_next_scan(struct ifnet *);
  597 void    ieee80211_end_scan(struct ifnet *);
  598 struct ieee80211_node *ieee80211_alloc_node(struct ieee80211com *, u_int8_t *,
  599     int);
  600 struct ieee80211_node *ieee80211_find_node(struct ieee80211com *, u_int8_t *);
  601 void    ieee80211_free_node(struct ieee80211com *, struct ieee80211_node *);
  602 void    ieee80211_free_allnodes(struct ieee80211com *);
  603 int     ieee80211_fix_rate(struct ieee80211com *, struct ieee80211_node *, int);
  604 int     ieee80211_new_state(struct ifnet *, enum ieee80211_state, int);
  605 struct mbuf *ieee80211_wep_crypt(struct ifnet *, struct mbuf *, int);
  606 int     ieee80211_rate2media(int, enum ieee80211_phytype);
  607 int     ieee80211_media2rate(int, enum ieee80211_phytype);
  608 
  609 int     ieee80211_cfgget(struct ifnet *, u_long, caddr_t);
  610 int     ieee80211_cfgset(struct ifnet *, u_long, caddr_t);
  611 
  612 #endif /* _KERNEL */
  613 
  614 #endif /* _NET_IF_IEEE80211_H_ */

Cache object: 65d077027e7108c5be4759a67ab052c8


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