2024-09-09 08:52:07 +00:00
|
|
|
/*
|
|
|
|
* BSS table
|
|
|
|
* Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
|
|
|
|
*
|
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BSS_H
|
|
|
|
#define BSS_H
|
|
|
|
|
|
|
|
struct wpa_scan_res;
|
|
|
|
|
|
|
|
#define WPA_BSS_QUAL_INVALID BIT(0)
|
|
|
|
#define WPA_BSS_NOISE_INVALID BIT(1)
|
|
|
|
#define WPA_BSS_LEVEL_INVALID BIT(2)
|
|
|
|
#define WPA_BSS_LEVEL_DBM BIT(3)
|
|
|
|
#define WPA_BSS_AUTHENTICATED BIT(4)
|
|
|
|
#define WPA_BSS_ASSOCIATED BIT(5)
|
|
|
|
#define WPA_BSS_ANQP_FETCH_TRIED BIT(6)
|
|
|
|
|
2024-09-09 08:57:42 +00:00
|
|
|
/**
|
|
|
|
* struct wpa_bss_anqp - ANQP data for a BSS entry (struct wpa_bss)
|
|
|
|
*/
|
2024-09-09 08:52:07 +00:00
|
|
|
struct wpa_bss_anqp {
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Number of BSS entries referring to this ANQP data instance */
|
2024-09-09 08:52:07 +00:00
|
|
|
unsigned int users;
|
|
|
|
#ifdef CONFIG_INTERWORKING
|
|
|
|
struct wpabuf *venue_name;
|
|
|
|
struct wpabuf *network_auth_type;
|
|
|
|
struct wpabuf *roaming_consortium;
|
|
|
|
struct wpabuf *ip_addr_type_availability;
|
|
|
|
struct wpabuf *nai_realm;
|
|
|
|
struct wpabuf *anqp_3gpp;
|
|
|
|
struct wpabuf *domain_name;
|
|
|
|
#endif /* CONFIG_INTERWORKING */
|
|
|
|
#ifdef CONFIG_HS20
|
|
|
|
struct wpabuf *hs20_operator_friendly_name;
|
|
|
|
struct wpabuf *hs20_wan_metrics;
|
|
|
|
struct wpabuf *hs20_connection_capability;
|
|
|
|
struct wpabuf *hs20_operating_class;
|
2024-09-09 08:57:42 +00:00
|
|
|
struct wpabuf *hs20_osu_providers_list;
|
2024-09-09 08:52:07 +00:00
|
|
|
#endif /* CONFIG_HS20 */
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct wpa_bss - BSS table
|
|
|
|
*
|
|
|
|
* This structure is used to store information about neighboring BSSes in
|
|
|
|
* generic format. It is mainly updated based on scan results from the driver.
|
|
|
|
*/
|
|
|
|
struct wpa_bss {
|
2024-09-09 08:57:42 +00:00
|
|
|
/** List entry for struct wpa_supplicant::bss */
|
2024-09-09 08:52:07 +00:00
|
|
|
struct dl_list list;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** List entry for struct wpa_supplicant::bss_id */
|
2024-09-09 08:52:07 +00:00
|
|
|
struct dl_list list_id;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Unique identifier for this BSS entry */
|
2024-09-09 08:52:07 +00:00
|
|
|
unsigned int id;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Number of counts without seeing this BSS */
|
2024-09-09 08:52:07 +00:00
|
|
|
unsigned int scan_miss_count;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Index of the last scan update */
|
2024-09-09 08:52:07 +00:00
|
|
|
unsigned int last_update_idx;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Information flags about the BSS/IBSS (WPA_BSS_*) */
|
2024-09-09 08:52:07 +00:00
|
|
|
unsigned int flags;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** BSSID */
|
2024-09-09 08:52:07 +00:00
|
|
|
u8 bssid[ETH_ALEN];
|
2024-09-09 08:57:42 +00:00
|
|
|
/** HESSID */
|
2024-09-09 08:52:07 +00:00
|
|
|
u8 hessid[ETH_ALEN];
|
2024-09-09 08:57:42 +00:00
|
|
|
/** SSID */
|
2024-09-09 08:52:07 +00:00
|
|
|
u8 ssid[32];
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Length of SSID */
|
2024-09-09 08:52:07 +00:00
|
|
|
size_t ssid_len;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Frequency of the channel in MHz (e.g., 2412 = channel 1) */
|
2024-09-09 08:52:07 +00:00
|
|
|
int freq;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Beacon interval in TUs (host byte order) */
|
2024-09-09 08:52:07 +00:00
|
|
|
u16 beacon_int;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Capability information field in host byte order */
|
2024-09-09 08:52:07 +00:00
|
|
|
u16 caps;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Signal quality */
|
2024-09-09 08:52:07 +00:00
|
|
|
int qual;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Noise level */
|
2024-09-09 08:52:07 +00:00
|
|
|
int noise;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Signal level */
|
2024-09-09 08:52:07 +00:00
|
|
|
int level;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Timestamp of last Beacon/Probe Response frame */
|
2024-09-09 08:52:07 +00:00
|
|
|
u64 tsf;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Time of the last update (i.e., Beacon or Probe Response RX) */
|
|
|
|
struct os_reltime last_update;
|
|
|
|
/** ANQP data */
|
2024-09-09 08:52:07 +00:00
|
|
|
struct wpa_bss_anqp *anqp;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Length of the following IE field in octets (from Probe Response) */
|
2024-09-09 08:52:07 +00:00
|
|
|
size_t ie_len;
|
2024-09-09 08:57:42 +00:00
|
|
|
/** Length of the following Beacon IE field in octets */
|
2024-09-09 08:52:07 +00:00
|
|
|
size_t beacon_ie_len;
|
|
|
|
/* followed by ie_len octets of IEs */
|
|
|
|
/* followed by beacon_ie_len octets of IEs */
|
|
|
|
};
|
|
|
|
|
|
|
|
void wpa_bss_update_start(struct wpa_supplicant *wpa_s);
|
|
|
|
void wpa_bss_update_scan_res(struct wpa_supplicant *wpa_s,
|
2024-09-09 08:57:42 +00:00
|
|
|
struct wpa_scan_res *res,
|
|
|
|
struct os_reltime *fetch_time);
|
2024-09-09 08:52:07 +00:00
|
|
|
void wpa_bss_update_end(struct wpa_supplicant *wpa_s, struct scan_info *info,
|
|
|
|
int new_scan);
|
|
|
|
int wpa_bss_init(struct wpa_supplicant *wpa_s);
|
|
|
|
void wpa_bss_deinit(struct wpa_supplicant *wpa_s);
|
|
|
|
void wpa_bss_flush(struct wpa_supplicant *wpa_s);
|
|
|
|
void wpa_bss_flush_by_age(struct wpa_supplicant *wpa_s, int age);
|
|
|
|
struct wpa_bss * wpa_bss_get(struct wpa_supplicant *wpa_s, const u8 *bssid,
|
|
|
|
const u8 *ssid, size_t ssid_len);
|
|
|
|
struct wpa_bss * wpa_bss_get_bssid(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *bssid);
|
2024-09-09 08:57:42 +00:00
|
|
|
struct wpa_bss * wpa_bss_get_bssid_latest(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *bssid);
|
2024-09-09 08:52:07 +00:00
|
|
|
struct wpa_bss * wpa_bss_get_p2p_dev_addr(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *dev_addr);
|
|
|
|
struct wpa_bss * wpa_bss_get_id(struct wpa_supplicant *wpa_s, unsigned int id);
|
2024-09-09 08:57:42 +00:00
|
|
|
struct wpa_bss * wpa_bss_get_id_range(struct wpa_supplicant *wpa_s,
|
|
|
|
unsigned int idf, unsigned int idl);
|
2024-09-09 08:52:07 +00:00
|
|
|
const u8 * wpa_bss_get_ie(const struct wpa_bss *bss, u8 ie);
|
|
|
|
const u8 * wpa_bss_get_vendor_ie(const struct wpa_bss *bss, u32 vendor_type);
|
2024-09-09 08:57:42 +00:00
|
|
|
const u8 * wpa_bss_get_vendor_ie_beacon(const struct wpa_bss *bss,
|
|
|
|
u32 vendor_type);
|
2024-09-09 08:52:07 +00:00
|
|
|
struct wpabuf * wpa_bss_get_vendor_ie_multi(const struct wpa_bss *bss,
|
|
|
|
u32 vendor_type);
|
|
|
|
struct wpabuf * wpa_bss_get_vendor_ie_multi_beacon(const struct wpa_bss *bss,
|
|
|
|
u32 vendor_type);
|
|
|
|
int wpa_bss_get_max_rate(const struct wpa_bss *bss);
|
|
|
|
int wpa_bss_get_bit_rates(const struct wpa_bss *bss, u8 **rates);
|
|
|
|
struct wpa_bss_anqp * wpa_bss_anqp_alloc(void);
|
|
|
|
int wpa_bss_anqp_unshare_alloc(struct wpa_bss *bss);
|
|
|
|
|
2024-09-09 08:57:42 +00:00
|
|
|
static inline int bss_is_dmg(const struct wpa_bss *bss)
|
|
|
|
{
|
|
|
|
return bss->freq > 45000;
|
|
|
|
}
|
|
|
|
|
2024-09-09 08:52:07 +00:00
|
|
|
#endif /* BSS_H */
|