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_scan.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) 2005-2007 Sam Leffler, Errno Consulting
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   24  *
   25  * $FreeBSD: releng/7.4/sys/net80211/ieee80211_scan.h 181802 2008-08-17 23:00:47Z sam $
   26  */
   27 #ifndef _NET80211_IEEE80211_SCAN_H_
   28 #define _NET80211_IEEE80211_SCAN_H_
   29 
   30 #define IEEE80211_SCAN_MAX      IEEE80211_CHAN_MAX
   31 
   32 struct ieee80211_scanner;
   33 
   34 struct ieee80211_scan_ssid {
   35         int             len;                            /* length in bytes */
   36         uint8_t         ssid[IEEE80211_NWID_LEN];       /* ssid contents */
   37 };
   38 #define IEEE80211_SCAN_MAX_SSID 1
   39 
   40 struct ieee80211_scan_state {
   41         struct ieee80211com *ss_ic;
   42         const struct ieee80211_scanner *ss_ops; /* policy hookup, see below */
   43         void            *ss_priv;               /* scanner private state */
   44         uint16_t        ss_flags;
   45 #define IEEE80211_SCAN_NOPICK   0x0001          /* scan only, no selection */
   46 #define IEEE80211_SCAN_ACTIVE   0x0002          /* active scan (probe req) */
   47 #define IEEE80211_SCAN_PICK1ST  0x0004          /* ``hey sailor'' mode */
   48 #define IEEE80211_SCAN_BGSCAN   0x0008          /* bg scan, exit ps at end */
   49 #define IEEE80211_SCAN_ONCE     0x0010          /* do one complete pass */
   50 #define IEEE80211_SCAN_GOTPICK  0x1000          /* got candidate, can stop */
   51         uint8_t         ss_nssid;               /* # ssid's to probe/match */
   52         struct ieee80211_scan_ssid ss_ssid[IEEE80211_SCAN_MAX_SSID];
   53                                                 /* ssid's to probe/match */
   54                                                 /* ordered channel set */
   55         struct ieee80211_channel *ss_chans[IEEE80211_SCAN_MAX];
   56         uint16_t        ss_next;                /* ix of next chan to scan */
   57         uint16_t        ss_last;                /* ix+1 of last chan to scan */
   58         unsigned long   ss_mindwell;            /* min dwell on channel */
   59         unsigned long   ss_maxdwell;            /* max dwell on channel */
   60 };
   61 
   62 /*
   63  * The upper 16 bits of the flags word is used to communicate
   64  * information to the scanning code that is NOT recorded in
   65  * ss_flags.  It might be better to split this stuff out into
   66  * a separate variable to avoid confusion.
   67  */
   68 #define IEEE80211_SCAN_FLUSH    0x10000         /* flush candidate table */
   69 #define IEEE80211_SCAN_NOSSID   0x20000         /* don't update ssid list */
   70 
   71 struct ieee80211com;
   72 void    ieee80211_scan_attach(struct ieee80211com *);
   73 void    ieee80211_scan_detach(struct ieee80211com *);
   74 
   75 void    ieee80211_scan_dump_channels(const struct ieee80211_scan_state *);
   76 
   77 int     ieee80211_scan_update(struct ieee80211com *);
   78 #define IEEE80211_SCAN_FOREVER  0x7fffffff
   79 int     ieee80211_start_scan(struct ieee80211com *, int flags, u_int duration,
   80                 u_int nssid, const struct ieee80211_scan_ssid ssids[]);
   81 int     ieee80211_check_scan(struct ieee80211com *, int flags, u_int duration,
   82                 u_int nssid, const struct ieee80211_scan_ssid ssids[]);
   83 int     ieee80211_bg_scan(struct ieee80211com *);
   84 void    ieee80211_cancel_scan(struct ieee80211com *);
   85 void    ieee80211_scan_next(struct ieee80211com *);
   86 void    ieee80211_scan_done(struct ieee80211com *);
   87 
   88 struct ieee80211_scanparams;
   89 void    ieee80211_add_scan(struct ieee80211com *,
   90                 const struct ieee80211_scanparams *,
   91                 const struct ieee80211_frame *,
   92                 int subtype, int rssi, int noise, int rstamp);
   93 void    ieee80211_scan_timeout(struct ieee80211com *);
   94 
   95 void    ieee80211_scan_assoc_success(struct ieee80211com *,
   96                 const uint8_t mac[IEEE80211_ADDR_LEN]);
   97 enum {
   98         IEEE80211_SCAN_FAIL_TIMEOUT     = 1,    /* no response to mgmt frame */
   99         IEEE80211_SCAN_FAIL_STATUS      = 2     /* negative response to " " */
  100 };
  101 void    ieee80211_scan_assoc_fail(struct ieee80211com *,
  102                 const uint8_t mac[IEEE80211_ADDR_LEN], int reason);
  103 void    ieee80211_scan_flush(struct ieee80211com *);
  104 
  105 struct ieee80211_scan_entry;
  106 typedef void ieee80211_scan_iter_func(void *,
  107                 const struct ieee80211_scan_entry *);
  108 void    ieee80211_scan_iterate(struct ieee80211com *,
  109                 ieee80211_scan_iter_func, void *);
  110 
  111 /*
  112  * Parameters supplied when adding/updating an entry in a
  113  * scan cache.  Pointer variables should be set to NULL
  114  * if no data is available.  Pointer references can be to
  115  * local data; any information that is saved will be copied.
  116  * All multi-byte values must be in host byte order.
  117  */
  118 struct ieee80211_scanparams {
  119         uint16_t        capinfo;        /* 802.11 capabilities */
  120         uint16_t        fhdwell;        /* FHSS dwell interval */
  121         struct ieee80211_channel *curchan;
  122         uint8_t         bchan;          /* chan# advertised inside beacon */
  123         uint8_t         fhindex;
  124         uint8_t         erp;
  125         uint16_t        bintval;
  126         uint8_t         timoff;
  127         uint8_t         *ies;           /* all captured ies */
  128         size_t          ies_len;        /* length of all captured ies */
  129         uint8_t         *tim;
  130         uint8_t         *tstamp;
  131         uint8_t         *country;
  132         uint8_t         *ssid;
  133         uint8_t         *rates;
  134         uint8_t         *xrates;
  135         uint8_t         *doth;
  136         uint8_t         *wpa;
  137         uint8_t         *rsn;
  138         uint8_t         *wme;
  139         uint8_t         *htcap;
  140         uint8_t         *htinfo;
  141         uint8_t         *ath;
  142 };
  143 
  144 /*
  145  * Scan cache entry format used when exporting data from a policy
  146  * module; this data may be represented some other way internally.
  147  */
  148 struct ieee80211_scan_entry {
  149         uint8_t         se_macaddr[IEEE80211_ADDR_LEN];
  150         uint8_t         se_bssid[IEEE80211_ADDR_LEN];
  151         /* XXX can point inside se_ies */
  152         uint8_t         se_ssid[2+IEEE80211_NWID_LEN];
  153         uint8_t         se_rates[2+IEEE80211_RATE_MAXSIZE];
  154         uint8_t         se_xrates[2+IEEE80211_RATE_MAXSIZE];
  155         uint32_t        se_rstamp;      /* recv timestamp */
  156         union {
  157                 uint8_t         data[8];
  158                 uint64_t        tsf;
  159         } se_tstamp;                    /* from last rcv'd beacon */
  160         uint16_t        se_intval;      /* beacon interval (host byte order) */
  161         uint16_t        se_capinfo;     /* capabilities (host byte order) */
  162         struct ieee80211_channel *se_chan;/* channel where sta found */
  163         uint16_t        se_timoff;      /* byte offset to TIM ie */
  164         uint16_t        se_fhdwell;     /* FH only (host byte order) */
  165         uint8_t         se_fhindex;     /* FH only */
  166         uint8_t         se_erp;         /* ERP from beacon/probe resp */
  167         int8_t          se_rssi;        /* avg'd recv ssi */
  168         int8_t          se_noise;       /* noise floor */
  169         uint8_t         se_dtimperiod;  /* DTIM period */
  170         struct ieee80211_ies se_ies;    /* captured ie's */
  171         u_int           se_age;         /* age of entry (0 on create) */
  172 };
  173 MALLOC_DECLARE(M_80211_SCAN);
  174 
  175 /*
  176  * Template for an in-kernel scan policy module.
  177  * Modules register with the scanning code and are
  178  * typically loaded as needed.
  179  */
  180 struct ieee80211_scanner {
  181         const char *scan_name;          /* printable name */
  182         int     (*scan_attach)(struct ieee80211_scan_state *);
  183         int     (*scan_detach)(struct ieee80211_scan_state *);
  184         int     (*scan_start)(struct ieee80211_scan_state *,
  185                         struct ieee80211com *);
  186         int     (*scan_restart)(struct ieee80211_scan_state *,
  187                         struct ieee80211com *);
  188         int     (*scan_cancel)(struct ieee80211_scan_state *,
  189                         struct ieee80211com *);
  190         int     (*scan_end)(struct ieee80211_scan_state *,
  191                         struct ieee80211com *);
  192         int     (*scan_flush)(struct ieee80211_scan_state *);
  193         /* add an entry to the cache */
  194         int     (*scan_add)(struct ieee80211_scan_state *,
  195                         const struct ieee80211_scanparams *,
  196                         const struct ieee80211_frame *,
  197                         int subtype, int rssi, int noise, int rstamp);
  198         /* age and/or purge entries in the cache */
  199         void    (*scan_age)(struct ieee80211_scan_state *);
  200         /* note that association failed for an entry */
  201         void    (*scan_assoc_fail)(struct ieee80211_scan_state *,
  202                         const uint8_t macaddr[IEEE80211_ADDR_LEN],
  203                         int reason);
  204         /* note that association succeed for an entry */
  205         void    (*scan_assoc_success)(struct ieee80211_scan_state *,
  206                         const uint8_t macaddr[IEEE80211_ADDR_LEN]);
  207         /* iterate over entries in the scan cache */
  208         void    (*scan_iterate)(struct ieee80211_scan_state *,
  209                         ieee80211_scan_iter_func *, void *);
  210 };
  211 void    ieee80211_scanner_register(enum ieee80211_opmode,
  212                 const struct ieee80211_scanner *);
  213 void    ieee80211_scanner_unregister(enum ieee80211_opmode,
  214                 const struct ieee80211_scanner *);
  215 void    ieee80211_scanner_unregister_all(const struct ieee80211_scanner *);
  216 const struct ieee80211_scanner *ieee80211_scanner_get(enum ieee80211_opmode);
  217 #endif /* _NET80211_IEEE80211_SCAN_H_ */

Cache object: 7b49d13c9b1befa91f136762686dae8e


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