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_proto.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-2007 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  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   25  *
   26  * $FreeBSD$
   27  */
   28 #ifndef _NET80211_IEEE80211_PROTO_H_
   29 #define _NET80211_IEEE80211_PROTO_H_
   30 
   31 /*
   32  * 802.11 protocol implementation definitions.
   33  */
   34 
   35 enum ieee80211_state {
   36         IEEE80211_S_INIT        = 0,    /* default state */
   37         IEEE80211_S_SCAN        = 1,    /* scanning */
   38         IEEE80211_S_AUTH        = 2,    /* try to authenticate */
   39         IEEE80211_S_ASSOC       = 3,    /* try to assoc */
   40         IEEE80211_S_CAC         = 4,    /* doing channel availability check */
   41         IEEE80211_S_RUN         = 5,    /* operational (e.g. associated) */
   42         IEEE80211_S_CSA         = 6,    /* channel switch announce pending */
   43         IEEE80211_S_SLEEP       = 7,    /* power save */
   44 };
   45 #define IEEE80211_S_MAX         (IEEE80211_S_SLEEP+1)
   46 
   47 #define IEEE80211_SEND_MGMT(_ic,_ni,_type,_arg) \
   48         ((*(_ic)->ic_send_mgmt)(_ic, _ni, _type, _arg))
   49 
   50 /*
   51  * The formation of some management frames requires guidance to
   52  * deal with legacy clients.  When the client is identified as
   53  * "legacy 11b" this parameter can be passed in the arg param of a
   54  * IEEE80211_SEND_MGMT call.
   55  */
   56 #define IEEE80211_SEND_LEGACY_11B       0x1     /* legacy 11b client */
   57 #define IEEE80211_SEND_LEGACY_11        0x2     /* other legacy client */
   58 #define IEEE80211_SEND_LEGACY           0x3     /* any legacy client */
   59 
   60 extern  const char *ieee80211_mgt_subtype_name[];
   61 extern  const char *ieee80211_phymode_name[];
   62 
   63 void    ieee80211_proto_attach(struct ieee80211com *);
   64 void    ieee80211_proto_detach(struct ieee80211com *);
   65 
   66 struct ieee80211_node;
   67 int     ieee80211_input(struct ieee80211com *, struct mbuf *,
   68                 struct ieee80211_node *, int, int, uint32_t);
   69 void    ieee80211_deliver_data(struct ieee80211com *,
   70                 struct ieee80211_node *, struct mbuf *);
   71 struct mbuf *ieee80211_decap1(struct mbuf *, int *);
   72 int     ieee80211_setup_rates(struct ieee80211_node *ni,
   73                 const uint8_t *rates, const uint8_t *xrates, int flags);
   74 void    ieee80211_recv_mgmt(struct ieee80211com *, struct mbuf *,
   75                 struct ieee80211_node *, int, int, int, uint32_t);
   76 int     ieee80211_mgmt_output(struct ieee80211com *, struct ieee80211_node *,
   77                 struct mbuf *, int type);
   78 struct ieee80211_bpf_params;
   79 int     ieee80211_raw_xmit(struct ieee80211_node *, struct mbuf *,
   80                 const struct ieee80211_bpf_params *);
   81 int     ieee80211_output(struct ifnet *, struct mbuf *,
   82                 struct sockaddr *, struct rtentry *);
   83 int     ieee80211_send_nulldata(struct ieee80211_node *);
   84 int     ieee80211_send_mgmt(struct ieee80211com *, struct ieee80211_node *,
   85                 int, int);
   86 int     ieee80211_send_probereq(struct ieee80211_node *ni,
   87                 const uint8_t sa[IEEE80211_ADDR_LEN],
   88                 const uint8_t da[IEEE80211_ADDR_LEN],
   89                 const uint8_t bssid[IEEE80211_ADDR_LEN],
   90                 const uint8_t *ssid, size_t ssidlen,
   91                 const void *optie, size_t optielen);
   92 int     ieee80211_classify(struct ieee80211com *, struct mbuf *,
   93                 struct ieee80211_node *);
   94 struct mbuf *ieee80211_encap(struct ieee80211com *, struct mbuf *,
   95                 struct ieee80211_node *);
   96 
   97 void    ieee80211_reset_erp(struct ieee80211com *);
   98 void    ieee80211_set_shortslottime(struct ieee80211com *, int onoff);
   99 int     ieee80211_iserp_rateset(struct ieee80211com *,
  100                 struct ieee80211_rateset *);
  101 void    ieee80211_set11gbasicrates(struct ieee80211_rateset *,
  102                 enum ieee80211_phymode);
  103 
  104 /*
  105  * Return the size of the 802.11 header for a management or data frame.
  106  */
  107 static __inline int
  108 ieee80211_hdrsize(const void *data)
  109 {
  110         const struct ieee80211_frame *wh = data;
  111         int size = sizeof(struct ieee80211_frame);
  112 
  113         /* NB: we don't handle control frames */
  114         KASSERT((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL,
  115                 ("%s: control frame", __func__));
  116         if ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS)
  117                 size += IEEE80211_ADDR_LEN;
  118         if (IEEE80211_QOS_HAS_SEQ(wh))
  119                 size += sizeof(uint16_t);
  120         return size;
  121 }
  122 
  123 /*
  124  * Like ieee80211_hdrsize, but handles any type of frame.
  125  */
  126 static __inline int
  127 ieee80211_anyhdrsize(const void *data)
  128 {
  129         const struct ieee80211_frame *wh = data;
  130 
  131         if ((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) {
  132                 switch (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) {
  133                 case IEEE80211_FC0_SUBTYPE_CTS:
  134                 case IEEE80211_FC0_SUBTYPE_ACK:
  135                         return sizeof(struct ieee80211_frame_ack);
  136                 case IEEE80211_FC0_SUBTYPE_BAR:
  137                         return sizeof(struct ieee80211_frame_bar);
  138                 }
  139                 return sizeof(struct ieee80211_frame_min);
  140         } else
  141                 return ieee80211_hdrsize(data);
  142 }
  143 
  144 /*
  145  * Template for an in-kernel authenticator.  Authenticators
  146  * register with the protocol code and are typically loaded
  147  * as separate modules as needed.
  148  */
  149 struct ieee80211_authenticator {
  150         const char *ia_name;            /* printable name */
  151         int     (*ia_attach)(struct ieee80211com *);
  152         void    (*ia_detach)(struct ieee80211com *);
  153         void    (*ia_node_join)(struct ieee80211com *,
  154                                 struct ieee80211_node *);
  155         void    (*ia_node_leave)(struct ieee80211com *,
  156                                 struct ieee80211_node *);
  157 };
  158 void    ieee80211_authenticator_register(int type,
  159                 const struct ieee80211_authenticator *);
  160 void    ieee80211_authenticator_unregister(int type);
  161 const struct ieee80211_authenticator *ieee80211_authenticator_get(int auth);
  162 
  163 struct ieee80211req;
  164 /*
  165  * Template for an MAC ACL policy module.  Such modules
  166  * register with the protocol code and are passed the sender's
  167  * address of each received frame for validation.
  168  */
  169 struct ieee80211_aclator {
  170         const char *iac_name;           /* printable name */
  171         int     (*iac_attach)(struct ieee80211com *);
  172         void    (*iac_detach)(struct ieee80211com *);
  173         int     (*iac_check)(struct ieee80211com *,
  174                         const uint8_t mac[IEEE80211_ADDR_LEN]);
  175         int     (*iac_add)(struct ieee80211com *,
  176                         const uint8_t mac[IEEE80211_ADDR_LEN]);
  177         int     (*iac_remove)(struct ieee80211com *,
  178                         const uint8_t mac[IEEE80211_ADDR_LEN]);
  179         int     (*iac_flush)(struct ieee80211com *);
  180         int     (*iac_setpolicy)(struct ieee80211com *, int);
  181         int     (*iac_getpolicy)(struct ieee80211com *);
  182         int     (*iac_setioctl)(struct ieee80211com *, struct ieee80211req *);
  183         int     (*iac_getioctl)(struct ieee80211com *, struct ieee80211req *);
  184 };
  185 void    ieee80211_aclator_register(const struct ieee80211_aclator *);
  186 void    ieee80211_aclator_unregister(const struct ieee80211_aclator *);
  187 const struct ieee80211_aclator *ieee80211_aclator_get(const char *name);
  188 
  189 /* flags for ieee80211_fix_rate() */
  190 #define IEEE80211_F_DOSORT      0x00000001      /* sort rate list */
  191 #define IEEE80211_F_DOFRATE     0x00000002      /* use fixed rate */
  192 #define IEEE80211_F_DONEGO      0x00000004      /* calc negotiated rate */
  193 #define IEEE80211_F_DODEL       0x00000008      /* delete ignore rate */
  194 #define IEEE80211_F_DOBRS       0x00000010      /* check basic rate set */
  195 #define IEEE80211_F_JOIN        0x00000020      /* sta joining our bss */
  196 int     ieee80211_fix_rate(struct ieee80211_node *,
  197                 struct ieee80211_rateset *, int);
  198 
  199 /*
  200  * WME/WMM support.
  201  */
  202 struct wmeParams {
  203         uint8_t         wmep_acm;
  204         uint8_t         wmep_aifsn;
  205         uint8_t         wmep_logcwmin;          /* log2(cwmin) */
  206         uint8_t         wmep_logcwmax;          /* log2(cwmax) */
  207         uint8_t         wmep_txopLimit;
  208         uint8_t         wmep_noackPolicy;       /* 0 (ack), 1 (no ack) */
  209 };
  210 #define IEEE80211_TXOP_TO_US(_txop)     ((_txop)<<5)
  211 #define IEEE80211_US_TO_TXOP(_us)       ((_us)>>5)
  212 
  213 struct chanAccParams {
  214         uint8_t         cap_info;               /* version of the current set */
  215         struct wmeParams cap_wmeParams[WME_NUM_AC];
  216 };
  217 
  218 struct ieee80211_wme_state {
  219         u_int   wme_flags;
  220 #define WME_F_AGGRMODE  0x00000001      /* STATUS: WME agressive mode */
  221         u_int   wme_hipri_traffic;      /* VI/VO frames in beacon interval */
  222         u_int   wme_hipri_switch_thresh;/* agressive mode switch thresh */
  223         u_int   wme_hipri_switch_hysteresis;/* agressive mode switch hysteresis */
  224 
  225         struct wmeParams wme_params[4];         /* from assoc resp for each AC*/
  226         struct chanAccParams wme_wmeChanParams; /* WME params applied to self */
  227         struct chanAccParams wme_wmeBssChanParams;/* WME params bcast to stations */
  228         struct chanAccParams wme_chanParams;    /* params applied to self */
  229         struct chanAccParams wme_bssChanParams; /* params bcast to stations */
  230 
  231         int     (*wme_update)(struct ieee80211com *);
  232 };
  233 
  234 void    ieee80211_wme_initparams(struct ieee80211com *);
  235 void    ieee80211_wme_updateparams(struct ieee80211com *);
  236 void    ieee80211_wme_updateparams_locked(struct ieee80211com *);
  237 
  238 #define ieee80211_new_state(_ic, _nstate, _arg) \
  239         (((_ic)->ic_newstate)((_ic), (_nstate), (_arg)))
  240 int     ieee80211_init(struct ieee80211com *, int forcescan);
  241 void    ieee80211_dturbo_switch(struct ieee80211com *, int newflags);
  242 void    ieee80211_beacon_miss(struct ieee80211com *);
  243 void    ieee80211_print_essid(const uint8_t *, int);
  244 void    ieee80211_dump_pkt(struct ieee80211com *,
  245                 const uint8_t *, int, int, int);
  246 
  247 extern  const char *ieee80211_opmode_name[];
  248 extern  const char *ieee80211_state_name[IEEE80211_S_MAX];
  249 extern  const char *ieee80211_wme_acnames[];
  250 
  251 /*
  252  * Beacon frames constructed by ieee80211_beacon_alloc
  253  * have the following structure filled in so drivers
  254  * can update the frame later w/ minimal overhead.
  255  */
  256 struct ieee80211_beacon_offsets {
  257         uint8_t         bo_flags[4];    /* update/state flags */
  258         uint16_t        *bo_caps;       /* capabilities */
  259         uint8_t         *bo_cfp;        /* start of CFParms element */
  260         uint8_t         *bo_tim;        /* start of atim/dtim */
  261         uint8_t         *bo_wme;        /* start of WME parameters */
  262         uint8_t         *bo_tim_trailer;/* start of fixed-size trailer */
  263         uint16_t        bo_tim_len;     /* atim/dtim length in bytes */
  264         uint16_t        bo_tim_trailer_len;/* tim trailer length in bytes */
  265         uint8_t         *bo_erp;        /* start of ERP element */
  266         uint8_t         *bo_htinfo;     /* start of HT info element */
  267         uint8_t         *bo_appie;      /* start of AppIE element */
  268         uint16_t        bo_appie_len;   /* AppIE length in bytes */
  269         uint16_t        bo_csa_trailer_len;;
  270         uint8_t         *bo_csa;        /* start of CSA element */
  271 };
  272 struct mbuf *ieee80211_beacon_alloc(struct ieee80211_node *,
  273                 struct ieee80211_beacon_offsets *);
  274 
  275 /*
  276  * Beacon frame updates are signaled through calls to ic_update_beacon
  277  * with one of the IEEE80211_BEACON_* tokens defined below.  For devices
  278  * that construct beacon frames on the host this can trigger a rebuild
  279  * or defer the processing.  For devices that offload beacon frame
  280  * handling this callback can be used to signal a rebuild.  The bo_flags
  281  * array in the ieee80211_beacon_offsets structure is intended to record
  282  * deferred processing requirements; ieee80211_beacon_update uses the
  283  * state to optimize work.  Since this structure is owned by the driver
  284  * and not visible to the 802.11 layer drivers must supply an ic_update_beacon
  285  * callback that marks the flag bits and schedules (as necessary) an update.
  286  */
  287 enum {
  288         IEEE80211_BEACON_CAPS   = 0,    /* capabilities */
  289         IEEE80211_BEACON_TIM    = 1,    /* DTIM/ATIM */
  290         IEEE80211_BEACON_WME    = 2,
  291         IEEE80211_BEACON_ERP    = 3,    /* Extended Rate Phy */
  292         IEEE80211_BEACON_HTINFO = 4,    /* HT Information */
  293         IEEE80211_BEACON_APPIE  = 5,    /* Application IE's */
  294         IEEE80211_BEACON_CFP    = 6,    /* CFParms */
  295         IEEE80211_BEACON_CSA    = 7,    /* Channel Switch Announcement */
  296 };
  297 int     ieee80211_beacon_update(struct ieee80211_node *,
  298                 struct ieee80211_beacon_offsets *, struct mbuf *, int mcast);
  299 
  300 /*
  301  * Notification methods called from the 802.11 state machine.
  302  * Note that while these are defined here, their implementation
  303  * is OS-specific.
  304  */
  305 void    ieee80211_notify_node_join(struct ieee80211com *,
  306                 struct ieee80211_node *, int newassoc);
  307 void    ieee80211_notify_node_leave(struct ieee80211com *,
  308                 struct ieee80211_node *);
  309 void    ieee80211_notify_scan_done(struct ieee80211com *);
  310 #endif /* _NET80211_IEEE80211_PROTO_H_ */

Cache object: e3d867784df0503dff4027948645e354


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