replace some function names
[linux-2.6/zen-sources.git] / drivers / net / wireless / madwifi / net80211 / ieee80211_scan.h
blobbb676c221756d7b2a4de1c89d93e7e5c816eed56
1 /*-
2 * Copyright (c) 2005 Sam Leffler, Errno Consulting
3 * All rights reserved.
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 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * Alternatively, this software may be distributed under the terms of the
17 * GNU General Public License ("GPL") version 2 as published by the Free
18 * Software Foundation.
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * $Id: ieee80211_scan.h 2513 2007-06-25 03:48:07Z mentor $
33 #ifndef _NET80211_IEEE80211_SCAN_H_
34 #define _NET80211_IEEE80211_SCAN_H_
36 #define IEEE80211_SCAN_MAX IEEE80211_CHAN_MAX
38 struct ieee80211_scanner;
39 struct ieee80211_scan_entry;
41 struct ieee80211_scan_ssid {
42 int len; /* length in bytes */
43 u_int8_t ssid[IEEE80211_NWID_LEN]; /* ssid contents */
45 #define IEEE80211_SCAN_MAX_SSID 1
47 struct ieee80211_scan_state {
48 struct ieee80211vap *ss_vap;
49 const struct ieee80211_scanner *ss_ops; /* policy hookup, see below */
50 void *ss_priv; /* scanner private state */
51 u_int16_t ss_flags;
52 #define IEEE80211_SCAN_NOPICK 0x0001 /* scan only, no selection */
53 #define IEEE80211_SCAN_ACTIVE 0x0002 /* active scan (probe req) */
54 #define IEEE80211_SCAN_PICK1ST 0x0004 /* ``hey sailor'' mode */
55 #define IEEE80211_SCAN_BGSCAN 0x0008 /* bg scan, exit ps at end */
56 #define IEEE80211_SCAN_ONCE 0x0010 /* do one complete pass */
57 #define IEEE80211_SCAN_GOTPICK 0x1000 /* got candidate, can stop */
59 u_int8_t ss_nssid; /* # SSIDs to probe/match */
60 struct ieee80211_scan_ssid ss_ssid[IEEE80211_SCAN_MAX_SSID];
61 /* SSIDs to probe/match */
62 /* ordered channel set */
63 struct ieee80211_channel *ss_chans[IEEE80211_SCAN_MAX];
64 u_int16_t ss_next; /* ix of next chan to scan */
65 u_int16_t ss_last; /* ix + 1 of last chan to scan */
66 unsigned long ss_mindwell; /* min dwell on channel */
67 unsigned long ss_maxdwell; /* max dwell on channel */
68 u_int ss_duration; /* used for calling ieee80211_start_scan() */
72 * The upper 16 bits of the flags word is used to communicate
73 * information to the scanning code that is NOT recorded in
74 * ss_flags. It might be better to split this stuff out into
75 * a separate variable to avoid confusion.
77 #define IEEE80211_SCAN_FLUSH 0x10000 /* flush candidate table */
78 #define IEEE80211_SCAN_NOSSID 0x20000 /* don't update ssid list */
79 #define IEEE80211_SCAN_USECACHE 0x40000 /* Must use a result from the cache */
80 #define IEEE80211_SCAN_KEEPMODE 0x80000 /* Must keep the same wireless mode (11a, 11g, or 11at, etc) */
82 struct ieee80211com;
83 void ieee80211_scan_attach(struct ieee80211com *);
84 void ieee80211_scan_detach(struct ieee80211com *);
85 void ieee80211_scan_vattach(struct ieee80211vap *);
86 void ieee80211_scan_vdetach(struct ieee80211vap *);
88 void ieee80211_scan_dump_channels(const struct ieee80211_scan_state *);
90 #define IEEE80211_SCAN_FOREVER 0x7fffffff
91 int ieee80211_start_scan_madwifi(struct ieee80211vap *, int, u_int, u_int,
92 const struct ieee80211_scan_ssid ssids[]);
93 int ieee80211_check_scan(struct ieee80211vap *, int, u_int, u_int,
94 const struct ieee80211_scan_ssid ssids[],
95 int (*action)(struct ieee80211vap *, const struct ieee80211_scan_entry *));
96 int ieee80211_bg_scan(struct ieee80211vap *);
97 void ieee80211_cancel_scan(struct ieee80211vap *);
99 int ieee80211_scan_dfs_action(struct ieee80211vap *, const struct ieee80211_scan_entry *);
101 struct ieee80211_scanparams;
102 void ieee80211_add_scan(struct ieee80211vap *, const struct ieee80211_scanparams *,
103 const struct ieee80211_frame *, int, int, u_int64_t);
104 void ieee80211_scan_timeout(struct ieee80211com *);
106 void ieee80211_scan_assoc_success(struct ieee80211com *,
107 const u_int8_t mac[IEEE80211_ADDR_LEN]);
108 enum {
109 IEEE80211_SCAN_FAIL_TIMEOUT = 1, /* no response to mgmt frame */
110 IEEE80211_SCAN_FAIL_STATUS = 2 /* negative response to " " */
112 void ieee80211_scan_assoc_fail(struct ieee80211com *,
113 const u_int8_t mac[IEEE80211_ADDR_LEN], int);
114 void ieee80211_scan_flush(struct ieee80211com *);
116 struct ieee80211_scan_entry;
117 typedef int ieee80211_scan_iter_func(void *, const struct ieee80211_scan_entry *);
118 int ieee80211_scan_iterate(struct ieee80211com *, ieee80211_scan_iter_func *, void *);
121 * Parameters supplied when adding/updating an entry in a
122 * scan cache. Pointer variables should be set to NULL
123 * if no data is available. Pointer references can be to
124 * local data; any information that is saved will be copied.
125 * All multi-byte values must be in host byte order.
127 struct ieee80211_scanparams {
128 u_int16_t capinfo; /* 802.11 capabilities */
129 u_int16_t fhdwell; /* FHSS dwell interval */
130 u_int8_t chan; /* */
131 u_int8_t bchan;
132 u_int8_t fhindex;
133 u_int8_t erp;
134 u_int16_t bintval;
135 u_int8_t timoff;
136 u_int8_t *tim;
137 u_int8_t *tstamp;
138 u_int8_t *country;
139 u_int8_t *ssid;
140 u_int8_t *rates;
141 u_int8_t *xrates;
142 u_int8_t *csa;
143 u_int8_t *wpa;
144 u_int8_t *rsn;
145 u_int8_t *wme;
146 u_int8_t *ath;
150 * Scan cache entry format used when exporting data from a policy
151 * module; this data may be represented some other way internally.
153 struct ieee80211_scan_entry {
154 u_int8_t se_macaddr[IEEE80211_ADDR_LEN];
155 u_int8_t se_bssid[IEEE80211_ADDR_LEN];
156 u_int8_t se_ssid[2 + IEEE80211_NWID_LEN];
157 u_int8_t se_rates[2 + IEEE80211_RATE_MAXSIZE];
158 u_int8_t se_xrates[2 + IEEE80211_RATE_MAXSIZE];
159 u_int64_t se_rtsf; /* recv timestamp */
160 union {
161 u_int8_t data[8];
162 __le64 tsf;
163 } se_tstamp; /* from last rcv'd beacon */
164 u_int16_t se_intval; /* beacon interval (host byte order) */
165 u_int16_t se_capinfo; /* capabilities (host byte order) */
166 struct ieee80211_channel *se_chan;/* channel where sta found */
167 u_int16_t se_timoff; /* byte offset to TIM ie */
168 u_int16_t se_fhdwell; /* FH only (host byte order) */
169 u_int8_t se_fhindex; /* FH only */
170 u_int8_t se_erp; /* ERP from beacon/probe resp */
171 int8_t se_rssi; /* avg'd recv ssi */
172 u_int8_t se_dtimperiod; /* DTIM period */
173 u_int8_t *se_wpa_ie; /* captured WPA ie */
174 u_int8_t *se_rsn_ie; /* captured RSN ie */
175 u_int8_t *se_wme_ie; /* captured WME ie */
176 u_int8_t *se_ath_ie; /* captured Atheros ie */
177 u_int se_age; /* age of entry (0 on create) */
181 * Template for an in-kernel scan policy module.
182 * Modules register with the scanning code and are
183 * typically loaded as needed.
185 struct ieee80211_scanner {
186 const char *scan_name; /* printable name */
187 int (*scan_attach)(struct ieee80211_scan_state *);
188 int (*scan_detach)(struct ieee80211_scan_state *);
189 int (*scan_start)(struct ieee80211_scan_state *, struct ieee80211vap *);
190 int (*scan_restart)(struct ieee80211_scan_state *, struct ieee80211vap *);
191 int (*scan_cancel)(struct ieee80211_scan_state *, struct ieee80211vap *);
192 int (*scan_end)(struct ieee80211_scan_state *, struct ieee80211vap *,
193 int (*action)(struct ieee80211vap *, const struct ieee80211_scan_entry *),
194 u_int32_t);
195 int (*scan_flush)(struct ieee80211_scan_state *);
196 /* add an entry to the cache */
197 int (*scan_add)(struct ieee80211_scan_state *,
198 const struct ieee80211_scanparams *,
199 const struct ieee80211_frame *, int, int, u_int64_t);
200 /* age and/or purge entries in the cache */
201 void (*scan_age)(struct ieee80211_scan_state *);
202 /* note that association failed for an entry */
203 void (*scan_assoc_fail)(struct ieee80211_scan_state *,
204 const u_int8_t macaddr[IEEE80211_ADDR_LEN], int);
205 /* note that association succeed for an entry */
206 void (*scan_assoc_success)(struct ieee80211_scan_state *,
207 const u_int8_t macaddr[IEEE80211_ADDR_LEN]);
208 /* iterate over entries in the scan cache */
209 int (*scan_iterate)(struct ieee80211_scan_state *,
210 ieee80211_scan_iter_func *, void *);
211 /* default action to take when found scan match */
212 int (*scan_default)(struct ieee80211vap *,
213 const struct ieee80211_scan_entry *);
215 const struct ieee80211_scanner *ieee80211_scanner_get(enum ieee80211_opmode,
216 int);
217 void ieee80211_scanner_register(enum ieee80211_opmode,
218 const struct ieee80211_scanner *);
219 void ieee80211_scanner_unregister(enum ieee80211_opmode,
220 const struct ieee80211_scanner *);
221 void ieee80211_scanner_unregister_all(const struct ieee80211_scanner *);
222 #endif /* _NET80211_IEEE80211_SCAN_H_ */