xref: /dflybsd-src/sys/netproto/802_11/ieee80211_scan.h (revision 805c8e8e4093ceca2e27510ad3a66d4de8060a55)
132176cfdSRui Paulo /*-
232176cfdSRui Paulo  * Copyright (c) 2005-2009 Sam Leffler, Errno Consulting
332176cfdSRui Paulo  * All rights reserved.
432176cfdSRui Paulo  *
532176cfdSRui Paulo  * Redistribution and use in source and binary forms, with or without
632176cfdSRui Paulo  * modification, are permitted provided that the following conditions
732176cfdSRui Paulo  * are met:
832176cfdSRui Paulo  * 1. Redistributions of source code must retain the above copyright
932176cfdSRui Paulo  *    notice, this list of conditions and the following disclaimer.
1032176cfdSRui Paulo  * 2. Redistributions in binary form must reproduce the above copyright
1132176cfdSRui Paulo  *    notice, this list of conditions and the following disclaimer in the
1232176cfdSRui Paulo  *    documentation and/or other materials provided with the distribution.
1332176cfdSRui Paulo  *
1432176cfdSRui Paulo  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1532176cfdSRui Paulo  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1632176cfdSRui Paulo  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1732176cfdSRui Paulo  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1832176cfdSRui Paulo  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1932176cfdSRui Paulo  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2032176cfdSRui Paulo  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2132176cfdSRui Paulo  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2232176cfdSRui Paulo  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2332176cfdSRui Paulo  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2432176cfdSRui Paulo  *
25085ff963SMatthew Dillon  * $FreeBSD$
2632176cfdSRui Paulo  */
2732176cfdSRui Paulo #ifndef _NET80211_IEEE80211_SCAN_H_
2832176cfdSRui Paulo #define _NET80211_IEEE80211_SCAN_H_
2932176cfdSRui Paulo 
3032176cfdSRui Paulo /*
3132176cfdSRui Paulo  * 802.11 scanning support.
3232176cfdSRui Paulo  *
3332176cfdSRui Paulo  * Scanning is the procedure by which a station locates a bss to join
3432176cfdSRui Paulo  * (infrastructure/ibss mode), or a channel to use (when operating as
3532176cfdSRui Paulo  * an ap or ibss master).  Scans are either "active" or "passive".  An
3632176cfdSRui Paulo  * active scan causes one or more probe request frames to be sent on
3732176cfdSRui Paulo  * visiting each channel.  A passive request causes each channel in the
3832176cfdSRui Paulo  * scan set to be visited but no frames to be transmitted; the station
3932176cfdSRui Paulo  * only listens for traffic.  Note that active scanning may still need
4032176cfdSRui Paulo  * to listen for traffic before sending probe request frames depending
4132176cfdSRui Paulo  * on regulatory constraints; the 802.11 layer handles this by generating
4232176cfdSRui Paulo  * a callback when scanning on a ``passive channel'' when the
4332176cfdSRui Paulo  * IEEE80211_FEXT_PROBECHAN flag is set.
4432176cfdSRui Paulo  *
4532176cfdSRui Paulo  * A scan operation involves constructing a set of channels to inspect
4632176cfdSRui Paulo  * (the scan set), visiting each channel and collecting information
4732176cfdSRui Paulo  * (e.g. what bss are present), and then analyzing the results to make
4832176cfdSRui Paulo  * decisions like which bss to join.  This process needs to be as fast
4932176cfdSRui Paulo  * as possible so we do things like intelligently construct scan sets
5032176cfdSRui Paulo  * and dwell on a channel only as long as necessary.  The scan code also
5132176cfdSRui Paulo  * maintains a cache of recent scan results and uses it to bypass scanning
5232176cfdSRui Paulo  * whenever possible.  The scan cache is also used to enable roaming
5332176cfdSRui Paulo  * between access points when operating in infrastructure mode.
5432176cfdSRui Paulo  *
5532176cfdSRui Paulo  * Scanning is handled with pluggable modules that implement "policy"
5632176cfdSRui Paulo  * per-operating mode.  The core scanning support provides an
5732176cfdSRui Paulo  * instrastructure to support these modules and exports a common api
5832176cfdSRui Paulo  * to the rest of the 802.11 layer.  Policy modules decide what
5932176cfdSRui Paulo  * channels to visit, what state to record to make decisions (e.g. ap
6032176cfdSRui Paulo  * mode scanning for auto channel selection keeps significantly less
6132176cfdSRui Paulo  * state than sta mode scanning for an ap to associate to), and selects
6232176cfdSRui Paulo  * the final station/channel to return as the result of a scan.
6332176cfdSRui Paulo  *
6432176cfdSRui Paulo  * Scanning is done synchronously when initially bringing a vap to an
6532176cfdSRui Paulo  * operational state and optionally in the background to maintain the
6632176cfdSRui Paulo  * scan cache for doing roaming and rogue ap monitoring.  Scanning is
6732176cfdSRui Paulo  * not tied to the 802.11 state machine that governs vaps though there
6832176cfdSRui Paulo  * is linkage to the IEEE80211_SCAN state.  Only one vap at a time may
6932176cfdSRui Paulo  * be scanning; this scheduling policy is handled in ieee80211_new_state
7032176cfdSRui Paulo  * and is invisible to the scanning code.
7132176cfdSRui Paulo */
7232176cfdSRui Paulo #define	IEEE80211_SCAN_MAX	IEEE80211_CHAN_MAX
7332176cfdSRui Paulo 
7432176cfdSRui Paulo struct ieee80211_scanner;			/* scan policy state */
7532176cfdSRui Paulo 
7632176cfdSRui Paulo struct ieee80211_scan_ssid {
7732176cfdSRui Paulo 	int	 len;				/* length in bytes */
7832176cfdSRui Paulo 	uint8_t ssid[IEEE80211_NWID_LEN];	/* ssid contents */
7932176cfdSRui Paulo };
8032176cfdSRui Paulo #define	IEEE80211_SCAN_MAX_SSID	1		/* max # ssid's to probe */
8132176cfdSRui Paulo 
8232176cfdSRui Paulo /*
834f898719SImre Vadász  * High-level implementation visible to ieee80211_scan.[ch].
844f898719SImre Vadász  *
854f898719SImre Vadász  * The default scanner (ieee80211_scan_sw.[ch]) implements a software
864f898719SImre Vadász  * driven scanner.  Firmware driven scanning needs a different set of
874f898719SImre Vadász  * behaviours.
884f898719SImre Vadász  */
894f898719SImre Vadász struct ieee80211_scan_methods {
904f898719SImre Vadász 	void (*sc_attach)(struct ieee80211com *);
914f898719SImre Vadász 	void (*sc_detach)(struct ieee80211com *);
924f898719SImre Vadász 	void (*sc_vattach)(struct ieee80211vap *);
934f898719SImre Vadász 	void (*sc_vdetach)(struct ieee80211vap *);
944f898719SImre Vadász 	void (*sc_set_scan_duration)(struct ieee80211vap *, u_int);
954f898719SImre Vadász 	int (*sc_start_scan)(const struct ieee80211_scanner *,
964f898719SImre Vadász 	    struct ieee80211vap *, int, u_int, u_int, u_int, u_int,
974f898719SImre Vadász 	    const struct ieee80211_scan_ssid ssids[]);
984f898719SImre Vadász 	int (*sc_check_scan)(const struct ieee80211_scanner *,
994f898719SImre Vadász 	    struct ieee80211vap *, int, u_int, u_int, u_int, u_int,
1004f898719SImre Vadász 	    const struct ieee80211_scan_ssid ssids[]);
1014f898719SImre Vadász 	int (*sc_bg_scan)(const struct ieee80211_scanner *,
1024f898719SImre Vadász 	    struct ieee80211vap *, int);
1034f898719SImre Vadász 	void (*sc_cancel_scan)(struct ieee80211vap *);
1044f898719SImre Vadász 	void (*sc_cancel_anyscan)(struct ieee80211vap *);
1054f898719SImre Vadász 	void (*sc_scan_next)(struct ieee80211vap *);
1064f898719SImre Vadász 	void (*sc_scan_done)(struct ieee80211vap *);
1074f898719SImre Vadász 	void (*sc_scan_probe_curchan)(struct ieee80211vap *, int);
1084f898719SImre Vadász 	void (*sc_add_scan)(struct ieee80211vap *,
1094f898719SImre Vadász 	    struct ieee80211_channel *,
1104f898719SImre Vadász 	    const struct ieee80211_scanparams *,
1114f898719SImre Vadász 	    const struct ieee80211_frame *,
1124f898719SImre Vadász 	    int, int, int);
1134f898719SImre Vadász };
1144f898719SImre Vadász 
1154f898719SImre Vadász /*
11632176cfdSRui Paulo  * Scan state visible to the 802.11 layer.  Scan parameters and
11732176cfdSRui Paulo  * results are stored in this data structure.  The ieee80211_scan_state
11832176cfdSRui Paulo  * structure is extended with space that is maintained private to
11932176cfdSRui Paulo  * the core scanning support.  We allocate one instance and link it
12032176cfdSRui Paulo  * to the ieee80211com structure; then share it between all associated
12132176cfdSRui Paulo  * vaps.  We could allocate multiple of these, e.g. to hold multiple
12232176cfdSRui Paulo  * scan results, but this is sufficient for current needs.
12332176cfdSRui Paulo  */
12432176cfdSRui Paulo struct ieee80211_scan_state {
12532176cfdSRui Paulo 	struct ieee80211vap *ss_vap;
12632176cfdSRui Paulo 	struct ieee80211com *ss_ic;
12732176cfdSRui Paulo 	const struct ieee80211_scanner *ss_ops;	/* policy hookup, see below */
12832176cfdSRui Paulo 	void		*ss_priv;		/* scanner private state */
12932176cfdSRui Paulo 	uint16_t	ss_flags;
13032176cfdSRui Paulo #define	IEEE80211_SCAN_NOPICK	0x0001		/* scan only, no selection */
13132176cfdSRui Paulo #define	IEEE80211_SCAN_ACTIVE	0x0002		/* active scan (probe req) */
13232176cfdSRui Paulo #define	IEEE80211_SCAN_PICK1ST	0x0004		/* ``hey sailor'' mode */
13332176cfdSRui Paulo #define	IEEE80211_SCAN_BGSCAN	0x0008		/* bg scan, exit ps at end */
13432176cfdSRui Paulo #define	IEEE80211_SCAN_ONCE	0x0010		/* do one complete pass */
13532176cfdSRui Paulo #define	IEEE80211_SCAN_NOBCAST	0x0020		/* no broadcast probe req */
13632176cfdSRui Paulo #define	IEEE80211_SCAN_NOJOIN	0x0040		/* no auto-sequencing */
13732176cfdSRui Paulo #define	IEEE80211_SCAN_GOTPICK	0x1000		/* got candidate, can stop */
13832176cfdSRui Paulo 	uint8_t		ss_nssid;		/* # ssid's to probe/match */
13932176cfdSRui Paulo 	struct ieee80211_scan_ssid ss_ssid[IEEE80211_SCAN_MAX_SSID];
14032176cfdSRui Paulo 						/* ssid's to probe/match */
14132176cfdSRui Paulo 						/* ordered channel set */
14232176cfdSRui Paulo 	struct ieee80211_channel *ss_chans[IEEE80211_SCAN_MAX];
14332176cfdSRui Paulo 	uint16_t	ss_next;		/* ix of next chan to scan */
14432176cfdSRui Paulo 	uint16_t	ss_last;		/* ix+1 of last chan to scan */
14532176cfdSRui Paulo 	unsigned long	ss_mindwell;		/* min dwell on channel */
14632176cfdSRui Paulo 	unsigned long	ss_maxdwell;		/* max dwell on channel */
14732176cfdSRui Paulo };
14832176cfdSRui Paulo 
14932176cfdSRui Paulo /*
15032176cfdSRui Paulo  * The upper 16 bits of the flags word is used to communicate
15132176cfdSRui Paulo  * information to the scanning code that is NOT recorded in
15232176cfdSRui Paulo  * ss_flags.  It might be better to split this stuff out into
15332176cfdSRui Paulo  * a separate variable to avoid confusion.
15432176cfdSRui Paulo  */
15532176cfdSRui Paulo #define	IEEE80211_SCAN_FLUSH	0x00010000	/* flush candidate table */
15632176cfdSRui Paulo #define	IEEE80211_SCAN_NOSSID	0x80000000	/* don't update ssid list */
15732176cfdSRui Paulo 
15832176cfdSRui Paulo struct ieee80211com;
15932176cfdSRui Paulo void	ieee80211_scan_attach(struct ieee80211com *);
16032176cfdSRui Paulo void	ieee80211_scan_detach(struct ieee80211com *);
16132176cfdSRui Paulo void	ieee80211_scan_vattach(struct ieee80211vap *);
16232176cfdSRui Paulo void	ieee80211_scan_vdetach(struct ieee80211vap *);
16332176cfdSRui Paulo 
16432176cfdSRui Paulo void	ieee80211_scan_dump_channels(const struct ieee80211_scan_state *);
16532176cfdSRui Paulo 
16632176cfdSRui Paulo #define	IEEE80211_SCAN_FOREVER	0x7fffffff
16732176cfdSRui Paulo int	ieee80211_start_scan(struct ieee80211vap *, int flags,
16832176cfdSRui Paulo 		u_int duration, u_int mindwell, u_int maxdwell,
16932176cfdSRui Paulo 		u_int nssid, const struct ieee80211_scan_ssid ssids[]);
17032176cfdSRui Paulo int	ieee80211_check_scan(struct ieee80211vap *, int flags,
17132176cfdSRui Paulo 		u_int duration, u_int mindwell, u_int maxdwell,
17232176cfdSRui Paulo 		u_int nssid, const struct ieee80211_scan_ssid ssids[]);
17332176cfdSRui Paulo int	ieee80211_check_scan_current(struct ieee80211vap *);
17432176cfdSRui Paulo int	ieee80211_bg_scan(struct ieee80211vap *, int);
17532176cfdSRui Paulo void	ieee80211_cancel_scan(struct ieee80211vap *);
17632176cfdSRui Paulo void	ieee80211_cancel_anyscan(struct ieee80211vap *);
17732176cfdSRui Paulo void	ieee80211_scan_next(struct ieee80211vap *);
17832176cfdSRui Paulo void	ieee80211_scan_done(struct ieee80211vap *);
17932176cfdSRui Paulo void	ieee80211_probe_curchan(struct ieee80211vap *, int);
18032176cfdSRui Paulo struct ieee80211_channel *ieee80211_scan_pickchannel(struct ieee80211com *, int);
18132176cfdSRui Paulo 
18232176cfdSRui Paulo struct ieee80211_scanparams;
18332176cfdSRui Paulo void	ieee80211_add_scan(struct ieee80211vap *,
1844f898719SImre Vadász 		struct ieee80211_channel *,
18532176cfdSRui Paulo 		const struct ieee80211_scanparams *,
18632176cfdSRui Paulo 		const struct ieee80211_frame *,
18732176cfdSRui Paulo 		int subtype, int rssi, int noise);
18832176cfdSRui Paulo void	ieee80211_scan_timeout(struct ieee80211com *);
18932176cfdSRui Paulo 
19032176cfdSRui Paulo void	ieee80211_scan_assoc_success(struct ieee80211vap *,
19132176cfdSRui Paulo 		const uint8_t mac[IEEE80211_ADDR_LEN]);
19232176cfdSRui Paulo enum {
19332176cfdSRui Paulo 	IEEE80211_SCAN_FAIL_TIMEOUT	= 1,	/* no response to mgmt frame */
19432176cfdSRui Paulo 	IEEE80211_SCAN_FAIL_STATUS	= 2	/* negative response to " " */
19532176cfdSRui Paulo };
19632176cfdSRui Paulo void	ieee80211_scan_assoc_fail(struct ieee80211vap *,
19732176cfdSRui Paulo 		const uint8_t mac[IEEE80211_ADDR_LEN], int reason);
19832176cfdSRui Paulo void	ieee80211_scan_flush(struct ieee80211vap *);
19932176cfdSRui Paulo 
20032176cfdSRui Paulo struct ieee80211_scan_entry;
20132176cfdSRui Paulo typedef void ieee80211_scan_iter_func(void *,
20232176cfdSRui Paulo 		const struct ieee80211_scan_entry *);
20332176cfdSRui Paulo void	ieee80211_scan_iterate(struct ieee80211vap *,
20432176cfdSRui Paulo 		ieee80211_scan_iter_func, void *);
20532176cfdSRui Paulo enum {
20632176cfdSRui Paulo 	IEEE80211_BPARSE_BADIELEN	= 0x01,	/* ie len past end of frame */
20732176cfdSRui Paulo 	IEEE80211_BPARSE_RATES_INVALID	= 0x02,	/* invalid RATES ie */
20832176cfdSRui Paulo 	IEEE80211_BPARSE_XRATES_INVALID	= 0x04,	/* invalid XRATES ie */
20932176cfdSRui Paulo 	IEEE80211_BPARSE_SSID_INVALID	= 0x08,	/* invalid SSID ie */
21032176cfdSRui Paulo 	IEEE80211_BPARSE_CHAN_INVALID	= 0x10,	/* invalid FH/DSPARMS chan */
21132176cfdSRui Paulo 	IEEE80211_BPARSE_OFFCHAN	= 0x20,	/* DSPARMS chan != curchan */
21232176cfdSRui Paulo 	IEEE80211_BPARSE_BINTVAL_INVALID= 0x40,	/* invalid beacon interval */
21332176cfdSRui Paulo 	IEEE80211_BPARSE_CSA_INVALID	= 0x80,	/* invalid CSA ie */
21432176cfdSRui Paulo };
21532176cfdSRui Paulo 
21632176cfdSRui Paulo /*
21732176cfdSRui Paulo  * Parameters supplied when adding/updating an entry in a
21832176cfdSRui Paulo  * scan cache.  Pointer variables should be set to NULL
21932176cfdSRui Paulo  * if no data is available.  Pointer references can be to
22032176cfdSRui Paulo  * local data; any information that is saved will be copied.
22132176cfdSRui Paulo  * All multi-byte values must be in host byte order.
22232176cfdSRui Paulo  */
22332176cfdSRui Paulo struct ieee80211_scanparams {
22432176cfdSRui Paulo 	uint8_t		status;		/* bitmask of IEEE80211_BPARSE_* */
22532176cfdSRui Paulo 	uint8_t		chan;		/* channel # from FH/DSPARMS */
22632176cfdSRui Paulo 	uint8_t		bchan;		/* curchan's channel # */
22732176cfdSRui Paulo 	uint8_t		fhindex;
22832176cfdSRui Paulo 	uint16_t	fhdwell;	/* FHSS dwell interval */
22932176cfdSRui Paulo 	uint16_t	capinfo;	/* 802.11 capabilities */
23032176cfdSRui Paulo 	uint16_t	erp;		/* NB: 0x100 indicates ie present */
23132176cfdSRui Paulo 	uint16_t	bintval;
23232176cfdSRui Paulo 	uint8_t		timoff;
23332176cfdSRui Paulo 	uint8_t		*ies;		/* all captured ies */
23432176cfdSRui Paulo 	size_t		ies_len;	/* length of all captured ies */
23532176cfdSRui Paulo 	uint8_t		*tim;
23632176cfdSRui Paulo 	uint8_t		*tstamp;
23732176cfdSRui Paulo 	uint8_t		*country;
23832176cfdSRui Paulo 	uint8_t		*ssid;
23932176cfdSRui Paulo 	uint8_t		*rates;
24032176cfdSRui Paulo 	uint8_t		*xrates;
24132176cfdSRui Paulo 	uint8_t		*doth;
24232176cfdSRui Paulo 	uint8_t		*wpa;
24332176cfdSRui Paulo 	uint8_t		*rsn;
24432176cfdSRui Paulo 	uint8_t		*wme;
24532176cfdSRui Paulo 	uint8_t		*htcap;
24632176cfdSRui Paulo 	uint8_t		*htinfo;
24732176cfdSRui Paulo 	uint8_t		*ath;
24832176cfdSRui Paulo 	uint8_t		*tdma;
24932176cfdSRui Paulo 	uint8_t		*csa;
250085ff963SMatthew Dillon 	uint8_t		*quiet;
25132176cfdSRui Paulo 	uint8_t		*meshid;
25232176cfdSRui Paulo 	uint8_t		*meshconf;
25332176cfdSRui Paulo 	uint8_t		*spare[3];
25432176cfdSRui Paulo };
25532176cfdSRui Paulo 
25632176cfdSRui Paulo /*
25732176cfdSRui Paulo  * Scan cache entry format used when exporting data from a policy
25832176cfdSRui Paulo  * module; this data may be represented some other way internally.
25932176cfdSRui Paulo  */
26032176cfdSRui Paulo struct ieee80211_scan_entry {
26132176cfdSRui Paulo 	uint8_t		se_macaddr[IEEE80211_ADDR_LEN];
26232176cfdSRui Paulo 	uint8_t		se_bssid[IEEE80211_ADDR_LEN];
26332176cfdSRui Paulo 	/* XXX can point inside se_ies */
26432176cfdSRui Paulo 	uint8_t		se_ssid[2+IEEE80211_NWID_LEN];
26532176cfdSRui Paulo 	uint8_t		se_rates[2+IEEE80211_RATE_MAXSIZE];
26632176cfdSRui Paulo 	uint8_t		se_xrates[2+IEEE80211_RATE_MAXSIZE];
26732176cfdSRui Paulo 	union {
26832176cfdSRui Paulo 		uint8_t		data[8];
26932176cfdSRui Paulo 		u_int64_t	tsf;
27032176cfdSRui Paulo 	} se_tstamp;			/* from last rcv'd beacon */
27132176cfdSRui Paulo 	uint16_t	se_intval;	/* beacon interval (host byte order) */
27232176cfdSRui Paulo 	uint16_t	se_capinfo;	/* capabilities (host byte order) */
27332176cfdSRui Paulo 	struct ieee80211_channel *se_chan;/* channel where sta found */
27432176cfdSRui Paulo 	uint16_t	se_timoff;	/* byte offset to TIM ie */
27532176cfdSRui Paulo 	uint16_t	se_fhdwell;	/* FH only (host byte order) */
27632176cfdSRui Paulo 	uint8_t		se_fhindex;	/* FH only */
27732176cfdSRui Paulo 	uint8_t		se_dtimperiod;	/* DTIM period */
27832176cfdSRui Paulo 	uint16_t	se_erp;		/* ERP from beacon/probe resp */
27932176cfdSRui Paulo 	int8_t		se_rssi;	/* avg'd recv ssi */
28032176cfdSRui Paulo 	int8_t		se_noise;	/* noise floor */
28132176cfdSRui Paulo 	uint8_t		se_cc[2];	/* captured country code */
28232176cfdSRui Paulo 	uint8_t		se_meshid[2+IEEE80211_MESHID_LEN];
28332176cfdSRui Paulo 	struct ieee80211_ies se_ies;	/* captured ie's */
28432176cfdSRui Paulo 	u_int		se_age;		/* age of entry (0 on create) */
28532176cfdSRui Paulo };
286*805c8e8eSzrj #ifdef MALLOC_DECLARE
28732176cfdSRui Paulo MALLOC_DECLARE(M_80211_SCAN);
288*805c8e8eSzrj #endif
28932176cfdSRui Paulo 
29032176cfdSRui Paulo /*
29132176cfdSRui Paulo  * Template for an in-kernel scan policy module.
29232176cfdSRui Paulo  * Modules register with the scanning code and are
29332176cfdSRui Paulo  * typically loaded as needed.
29432176cfdSRui Paulo  */
29532176cfdSRui Paulo struct ieee80211_scanner {
29632176cfdSRui Paulo 	const char *scan_name;		/* printable name */
29732176cfdSRui Paulo 	int	(*scan_attach)(struct ieee80211_scan_state *);
29832176cfdSRui Paulo 	int	(*scan_detach)(struct ieee80211_scan_state *);
29932176cfdSRui Paulo 	int	(*scan_start)(struct ieee80211_scan_state *,
30032176cfdSRui Paulo 			struct ieee80211vap *);
30132176cfdSRui Paulo 	int	(*scan_restart)(struct ieee80211_scan_state *,
30232176cfdSRui Paulo 			struct ieee80211vap *);
30332176cfdSRui Paulo 	int	(*scan_cancel)(struct ieee80211_scan_state *,
30432176cfdSRui Paulo 			struct ieee80211vap *);
30532176cfdSRui Paulo 	int	(*scan_end)(struct ieee80211_scan_state *,
30632176cfdSRui Paulo 			struct ieee80211vap *);
30732176cfdSRui Paulo 	int	(*scan_flush)(struct ieee80211_scan_state *);
30832176cfdSRui Paulo 	struct ieee80211_channel *(*scan_pickchan)(
30932176cfdSRui Paulo 			struct ieee80211_scan_state *, int);
31032176cfdSRui Paulo 	/* add an entry to the cache */
31132176cfdSRui Paulo 	int	(*scan_add)(struct ieee80211_scan_state *,
3124f898719SImre Vadász 			struct ieee80211_channel *,
31332176cfdSRui Paulo 			const struct ieee80211_scanparams *,
31432176cfdSRui Paulo 			const struct ieee80211_frame *,
31532176cfdSRui Paulo 			int subtype, int rssi, int noise);
31632176cfdSRui Paulo 	/* age and/or purge entries in the cache */
31732176cfdSRui Paulo 	void	(*scan_age)(struct ieee80211_scan_state *);
31832176cfdSRui Paulo 	/* note that association failed for an entry */
31932176cfdSRui Paulo 	void	(*scan_assoc_fail)(struct ieee80211_scan_state *,
32032176cfdSRui Paulo 			const uint8_t macaddr[IEEE80211_ADDR_LEN],
32132176cfdSRui Paulo 			int reason);
32232176cfdSRui Paulo 	/* note that association succeed for an entry */
32332176cfdSRui Paulo 	void	(*scan_assoc_success)(struct ieee80211_scan_state *,
32432176cfdSRui Paulo 			const uint8_t macaddr[IEEE80211_ADDR_LEN]);
32532176cfdSRui Paulo 	/* iterate over entries in the scan cache */
32632176cfdSRui Paulo 	void	(*scan_iterate)(struct ieee80211_scan_state *,
32732176cfdSRui Paulo 			ieee80211_scan_iter_func *, void *);
32832176cfdSRui Paulo 	void	(*scan_spare0)(void);
32932176cfdSRui Paulo 	void	(*scan_spare1)(void);
33032176cfdSRui Paulo 	void	(*scan_spare2)(void);
33132176cfdSRui Paulo 	void	(*scan_spare4)(void);
33232176cfdSRui Paulo };
33332176cfdSRui Paulo void	ieee80211_scanner_register(enum ieee80211_opmode,
33432176cfdSRui Paulo 		const struct ieee80211_scanner *);
33532176cfdSRui Paulo void	ieee80211_scanner_unregister(enum ieee80211_opmode,
33632176cfdSRui Paulo 		const struct ieee80211_scanner *);
33732176cfdSRui Paulo void	ieee80211_scanner_unregister_all(const struct ieee80211_scanner *);
33832176cfdSRui Paulo const struct ieee80211_scanner *ieee80211_scanner_get(enum ieee80211_opmode);
3394f898719SImre Vadász void    ieee80211_scan_update_locked(struct ieee80211vap *vap,
3404f898719SImre Vadász 		const struct ieee80211_scanner *scan);
3414f898719SImre Vadász void    ieee80211_scan_copy_ssid(struct ieee80211vap *vap,
3424f898719SImre Vadász 		struct ieee80211_scan_state *ss,
3434f898719SImre Vadász 		int nssid, const struct ieee80211_scan_ssid ssids[]);
3444f898719SImre Vadász void    ieee80211_scan_dump_probe_beacon(uint8_t subtype, int isnew,
3454f898719SImre Vadász 		const uint8_t mac[IEEE80211_ADDR_LEN],
3464f898719SImre Vadász 		const struct ieee80211_scanparams *sp, int rssi);
3474f898719SImre Vadász void    ieee80211_scan_dump(struct ieee80211_scan_state *ss);
3484f898719SImre Vadász 
34932176cfdSRui Paulo #endif /* _NET80211_IEEE80211_SCAN_H_ */
350