nl80211: Add parsing of NL80211_BSS_SEEN_MS_AGO into scan results

This commit is contained in:
Jouni Malinen 2009-10-01 17:53:22 +03:00 committed by Jouni Malinen
parent d942a79e6a
commit b3ad11bb80
3 changed files with 8 additions and 0 deletions

View File

@ -1277,6 +1277,7 @@ enum nl80211_channel_type {
* @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon
* in unspecified units, scaled to 0..100 (u8) * in unspecified units, scaled to 0..100 (u8)
* @NL80211_BSS_STATUS: status, if this BSS is "used" * @NL80211_BSS_STATUS: status, if this BSS is "used"
* @NL80211_BSS_SEEN_MS_AGO: age of this BSS entry in ms
* @__NL80211_BSS_AFTER_LAST: internal * @__NL80211_BSS_AFTER_LAST: internal
* @NL80211_BSS_MAX: highest BSS attribute * @NL80211_BSS_MAX: highest BSS attribute
*/ */
@ -1291,6 +1292,7 @@ enum nl80211_bss {
NL80211_BSS_SIGNAL_MBM, NL80211_BSS_SIGNAL_MBM,
NL80211_BSS_SIGNAL_UNSPEC, NL80211_BSS_SIGNAL_UNSPEC,
NL80211_BSS_STATUS, NL80211_BSS_STATUS,
NL80211_BSS_SEEN_MS_AGO,
/* keep last */ /* keep last */
__NL80211_BSS_AFTER_LAST, __NL80211_BSS_AFTER_LAST,

View File

@ -134,6 +134,8 @@ struct wpa_scan_result {
* @noise: noise level * @noise: noise level
* @level: signal level * @level: signal level
* @tsf: Timestamp * @tsf: Timestamp
* @age: Age of the information in milliseconds (i.e., how many milliseconds
* ago the last Beacon or Probe Response frame was received)
* @ie_len: length of the following IE field in octets * @ie_len: length of the following IE field in octets
* *
* This structure is used as a generic format for scan results from the * This structure is used as a generic format for scan results from the
@ -155,6 +157,7 @@ struct wpa_scan_res {
int noise; int noise;
int level; int level;
u64 tsf; u64 tsf;
unsigned int age;
size_t ie_len; size_t ie_len;
/* followed by ie_len octets of IEs */ /* followed by ie_len octets of IEs */
}; };

View File

@ -1654,6 +1654,7 @@ static int bss_info_handler(struct nl_msg *msg, void *arg)
[NL80211_BSS_INFORMATION_ELEMENTS] = { .type = NLA_UNSPEC }, [NL80211_BSS_INFORMATION_ELEMENTS] = { .type = NLA_UNSPEC },
[NL80211_BSS_SIGNAL_MBM] = { .type = NLA_U32 }, [NL80211_BSS_SIGNAL_MBM] = { .type = NLA_U32 },
[NL80211_BSS_SIGNAL_UNSPEC] = { .type = NLA_U8 }, [NL80211_BSS_SIGNAL_UNSPEC] = { .type = NLA_U8 },
[NL80211_BSS_SEEN_MS_AGO] = { .type = NLA_U32 },
}; };
struct wpa_scan_results *res = arg; struct wpa_scan_results *res = arg;
struct wpa_scan_res **tmp; struct wpa_scan_res **tmp;
@ -1700,6 +1701,8 @@ static int bss_info_handler(struct nl_msg *msg, void *arg)
r->flags |= WPA_SCAN_LEVEL_INVALID | WPA_SCAN_QUAL_INVALID; r->flags |= WPA_SCAN_LEVEL_INVALID | WPA_SCAN_QUAL_INVALID;
if (bss[NL80211_BSS_TSF]) if (bss[NL80211_BSS_TSF])
r->tsf = nla_get_u64(bss[NL80211_BSS_TSF]); r->tsf = nla_get_u64(bss[NL80211_BSS_TSF]);
if (bss[NL80211_BSS_SEEN_MS_AGO])
r->age = nla_get_u32(bss[NL80211_BSS_SEEN_MS_AGO]);
r->ie_len = ie_len; r->ie_len = ie_len;
if (ie) if (ie)
os_memcpy(r + 1, ie, ie_len); os_memcpy(r + 1, ie, ie_len);