wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
bss.h
Go to the documentation of this file.
1 
5 #ifndef BSS_H
6 #define BSS_H
7 
8 struct wpa_scan_res;
9 
10 #define WPA_BSS_QUAL_INVALID BIT(0)
11 #define WPA_BSS_NOISE_INVALID BIT(1)
12 #define WPA_BSS_LEVEL_INVALID BIT(2)
13 #define WPA_BSS_LEVEL_DBM BIT(3)
14 #define WPA_BSS_AUTHENTICATED BIT(4)
15 #define WPA_BSS_ASSOCIATED BIT(5)
16 #define WPA_BSS_ANQP_FETCH_TRIED BIT(6)
17 
22 struct wpa_bss_anqp {
24  unsigned int users;
25 #ifdef CONFIG_INTERWORKING
26  struct wpabuf *capability_list;
27  struct wpabuf *venue_name;
28  struct wpabuf *network_auth_type;
29  struct wpabuf *roaming_consortium;
30  struct wpabuf *ip_addr_type_availability;
31  struct wpabuf *nai_realm;
32  struct wpabuf *anqp_3gpp;
33  struct wpabuf *domain_name;
34 #endif /* CONFIG_INTERWORKING */
35 #ifdef CONFIG_HS20
36  struct wpabuf *hs20_capability_list;
37  struct wpabuf *hs20_operator_friendly_name;
38  struct wpabuf *hs20_wan_metrics;
39  struct wpabuf *hs20_connection_capability;
40  struct wpabuf *hs20_operating_class;
41  struct wpabuf *hs20_osu_providers_list;
42 #endif /* CONFIG_HS20 */
43 };
44 
52 struct wpa_bss {
54  struct dl_list list;
56  struct dl_list list_id;
58  unsigned int id;
60  unsigned int scan_miss_count;
62  unsigned int last_update_idx;
64  unsigned int flags;
66  u8 bssid[ETH_ALEN];
68  u8 hessid[ETH_ALEN];
70  u8 ssid[SSID_MAX_LEN];
72  size_t ssid_len;
74  int freq;
78  u16 caps;
80  int qual;
82  int noise;
84  int level;
86  u64 tsf;
90  unsigned int est_throughput;
92  int snr;
94  struct wpa_bss_anqp *anqp;
96  size_t ie_len;
98  size_t beacon_ie_len;
99  /* followed by ie_len octets of IEs */
100  /* followed by beacon_ie_len octets of IEs */
101 };
102 
103 void wpa_bss_update_start(struct wpa_supplicant *wpa_s);
104 void wpa_bss_update_scan_res(struct wpa_supplicant *wpa_s,
105  struct wpa_scan_res *res,
106  struct os_reltime *fetch_time);
107 void wpa_bss_update_end(struct wpa_supplicant *wpa_s, struct scan_info *info,
108  int new_scan);
109 int wpa_bss_init(struct wpa_supplicant *wpa_s);
110 void wpa_bss_deinit(struct wpa_supplicant *wpa_s);
111 void wpa_bss_flush(struct wpa_supplicant *wpa_s);
112 void wpa_bss_flush_by_age(struct wpa_supplicant *wpa_s, int age);
113 struct wpa_bss * wpa_bss_get(struct wpa_supplicant *wpa_s, const u8 *bssid,
114  const u8 *ssid, size_t ssid_len);
115 struct wpa_bss * wpa_bss_get_bssid(struct wpa_supplicant *wpa_s,
116  const u8 *bssid);
117 struct wpa_bss * wpa_bss_get_bssid_latest(struct wpa_supplicant *wpa_s,
118  const u8 *bssid);
119 struct wpa_bss * wpa_bss_get_p2p_dev_addr(struct wpa_supplicant *wpa_s,
120  const u8 *dev_addr);
121 struct wpa_bss * wpa_bss_get_id(struct wpa_supplicant *wpa_s, unsigned int id);
122 struct wpa_bss * wpa_bss_get_id_range(struct wpa_supplicant *wpa_s,
123  unsigned int idf, unsigned int idl);
124 const u8 * wpa_bss_get_ie(const struct wpa_bss *bss, u8 ie);
125 const u8 * wpa_bss_get_vendor_ie(const struct wpa_bss *bss, u32 vendor_type);
126 const u8 * wpa_bss_get_vendor_ie_beacon(const struct wpa_bss *bss,
127  u32 vendor_type);
128 struct wpabuf * wpa_bss_get_vendor_ie_multi(const struct wpa_bss *bss,
129  u32 vendor_type);
130 struct wpabuf * wpa_bss_get_vendor_ie_multi_beacon(const struct wpa_bss *bss,
131  u32 vendor_type);
132 int wpa_bss_get_max_rate(const struct wpa_bss *bss);
133 int wpa_bss_get_bit_rates(const struct wpa_bss *bss, u8 **rates);
134 struct wpa_bss_anqp * wpa_bss_anqp_alloc(void);
135 int wpa_bss_anqp_unshare_alloc(struct wpa_bss *bss);
136 
137 static inline int bss_is_dmg(const struct wpa_bss *bss)
138 {
139  return bss->freq > 45000;
140 }
141 
142 static inline void wpa_bss_update_level(struct wpa_bss *bss, int new_level)
143 {
144  if (bss != NULL && new_level < 0)
145  bss->level = new_level;
146 }
147 
148 #endif /* BSS_H */
unsigned int scan_miss_count
Number of counts without seeing this BSS.
Definition: bss.h:60
void wpa_bss_update_scan_res(struct wpa_supplicant *wpa_s, struct wpa_scan_res *res, struct os_reltime *fetch_time)
Update a BSS table entry based on a scan result.
Definition: bss.c:629
u16 caps
Capability information field in host byte order.
Definition: bss.h:78
void wpa_bss_deinit(struct wpa_supplicant *wpa_s)
Deinitialize BSS table.
Definition: bss.c:875
struct wpa_bss * wpa_bss_get(struct wpa_supplicant *wpa_s, const u8 *bssid, const u8 *ssid, size_t ssid_len)
Fetch a BSS table entry based on BSSID and SSID.
Definition: bss.c:234
struct wpa_bss * wpa_bss_get_id(struct wpa_supplicant *wpa_s, unsigned int id)
Fetch a BSS table entry based on identifier.
Definition: bss.c:958
void wpa_bss_update_start(struct wpa_supplicant *wpa_s)
Start a BSS table update from scan results.
Definition: bss.c:610
u8 bssid[ETH_ALEN]
BSSID.
Definition: bss.h:66
unsigned int last_update_idx
Index of the last scan update.
Definition: bss.h:62
unsigned int flags
Information flags about the BSS/IBSS (WPA_BSS_*)
Definition: bss.h:64
int qual
Signal quality.
Definition: bss.h:80
const u8 * wpa_bss_get_vendor_ie(const struct wpa_bss *bss, u32 vendor_type)
Fetch a vendor information element from a BSS entry.
Definition: bss.c:1029
struct wpabuf * wpa_bss_get_vendor_ie_multi_beacon(const struct wpa_bss *bss, u32 vendor_type)
Fetch vendor IE data from a BSS entry.
Definition: bss.c:1140
Definition: wpabuf.h:16
u16 beacon_int
Beacon interval in TUs (host byte order)
Definition: bss.h:76
Scan result for an BSS/IBSS.
Definition: driver.h:253
size_t ssid_len
Length of SSID.
Definition: bss.h:72
struct wpa_bss_anqp * wpa_bss_anqp_alloc(void)
Allocate ANQP data structure for a BSS entry.
Definition: bss.c:53
struct dl_list list_id
List entry for struct wpa_supplicant::bss_id.
Definition: bss.h:56
struct wpa_bss * wpa_bss_get_bssid(struct wpa_supplicant *wpa_s, const u8 *bssid)
Fetch a BSS table entry based on BSSID.
Definition: bss.c:887
ANQP data for a BSS entry (struct wpa_bss)
Definition: bss.h:22
int wpa_bss_get_max_rate(const struct wpa_bss *bss)
Get maximum legacy TX rate supported in a BSS.
Definition: bss.c:1177
struct wpabuf * wpa_bss_get_vendor_ie_multi(const struct wpa_bss *bss, u32 vendor_type)
Fetch vendor IE data from a BSS entry.
Definition: bss.c:1096
struct wpa_bss * wpa_bss_get_bssid_latest(struct wpa_supplicant *wpa_s, const u8 *bssid)
Fetch the latest BSS table entry based on BSSID.
Definition: bss.c:912
Definition: os.h:22
int wpa_bss_get_bit_rates(const struct wpa_bss *bss, u8 **rates)
Get legacy TX rates supported in a BSS.
Definition: bss.c:1208
struct wpa_bss_anqp * anqp
ANQP data.
Definition: bss.h:94
int freq
Frequency of the channel in MHz (e.g., 2412 = channel 1)
Definition: bss.h:74
u8 ssid[SSID_MAX_LEN]
SSID.
Definition: bss.h:70
const u8 * wpa_bss_get_ie(const struct wpa_bss *bss, u8 ie)
Fetch a specified information element from a BSS entry.
Definition: bss.c:1001
int level
Signal level.
Definition: bss.h:84
Doubly-linked list.
Definition: list.h:12
int wpa_bss_init(struct wpa_supplicant *wpa_s)
Initialize BSS table.
Definition: bss.c:842
void wpa_bss_flush(struct wpa_supplicant *wpa_s)
Flush all unused BSS entries.
Definition: bss.c:854
void wpa_bss_update_end(struct wpa_supplicant *wpa_s, struct scan_info *info, int new_scan)
End a BSS table update from scan results.
Definition: bss.c:777
size_t beacon_ie_len
Length of the following Beacon IE field in octets.
Definition: bss.h:98
unsigned int users
Number of BSS entries referring to this ANQP data instance.
Definition: bss.h:24
BSS table.
Definition: bss.h:52
int wpa_bss_anqp_unshare_alloc(struct wpa_bss *bss)
Unshare ANQP data (if shared) in a BSS entry.
Definition: bss.c:110
size_t ie_len
Length of the following IE field in octets (from Probe Response)
Definition: bss.h:96
struct wpa_bss * wpa_bss_get_p2p_dev_addr(struct wpa_supplicant *wpa_s, const u8 *dev_addr)
Fetch a BSS table entry based on P2P Device Addr.
Definition: bss.c:936
struct dl_list list
List entry for struct wpa_supplicant::bss.
Definition: bss.h:54
u64 tsf
Timestamp of last Beacon/Probe Response frame.
Definition: bss.h:86
u8 hessid[ETH_ALEN]
HESSID.
Definition: bss.h:68
int noise
Noise level.
Definition: bss.h:82
Internal data for wpa_supplicant interface.
Definition: wpa_supplicant_i.h:451
int snr
Signal-to-noise ratio in dB.
Definition: bss.h:92
struct wpa_bss * wpa_bss_get_id_range(struct wpa_supplicant *wpa_s, unsigned int idf, unsigned int idl)
Fetch a BSS table entry based on identifier range.
Definition: bss.c:980
struct os_reltime last_update
Time of the last update (i.e., Beacon or Probe Response RX)
Definition: bss.h:88
void wpa_bss_flush_by_age(struct wpa_supplicant *wpa_s, int age)
Flush old BSS entries.
Definition: bss.c:811
unsigned int id
Unique identifier for this BSS entry.
Definition: bss.h:58
unsigned int est_throughput
Estimated throughput in kbps.
Definition: bss.h:90
const u8 * wpa_bss_get_vendor_ie_beacon(const struct wpa_bss *bss, u32 vendor_type)
Fetch a vendor information from a BSS entry.
Definition: bss.c:1061
Definition: interworking.c:333