feature: wapi add encode parse when scan
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
parent
5e22b6f564
commit
e0e41c5d7f
@ -147,6 +147,21 @@ enum wapi_mode_e
|
|||||||
WAPI_MODE_MESH = IW_MODE_MESH /* Mesh (IEEE 802.11s) network */
|
WAPI_MODE_MESH = IW_MODE_MESH /* Mesh (IEEE 802.11s) network */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Flags for encoding */
|
||||||
|
|
||||||
|
enum wapi_encode_e
|
||||||
|
{
|
||||||
|
WAPI_ENCODE_INDEX = IW_ENCODE_INDEX, /* Token index (if needed) */
|
||||||
|
WAPI_ENCODE_FLAGS = IW_ENCODE_FLAGS, /* Flags defined below */
|
||||||
|
WAPI_ENCODE_MODE = IW_ENCODE_MODE, /* Modes defined below */
|
||||||
|
WAPI_ENCODE_DISABLED = IW_ENCODE_DISABLED, /* Encoding disabled */
|
||||||
|
WAPI_ENCODE_ENABLED = IW_ENCODE_ENABLED, /* Encoding enabled */
|
||||||
|
WAPI_ENCODE_RESTRICTED = IW_ENCODE_RESTRICTED, /* Refuse non-encoded packets */
|
||||||
|
WAPI_ENCODE_OPEN = IW_ENCODE_OPEN, /* Accept non-encoded packets */
|
||||||
|
WAPI_ENCODE_NOKEY = IW_ENCODE_NOKEY, /* Key is write only, so not present */
|
||||||
|
WAPI_ENCODE_TEMP = IW_ENCODE_TEMP /* Temporary key */
|
||||||
|
};
|
||||||
|
|
||||||
/* Bitrate flags.
|
/* Bitrate flags.
|
||||||
*
|
*
|
||||||
* At the moment, unicast (IW_BITRATE_UNICAST) and broadcast
|
* At the moment, unicast (IW_BITRATE_UNICAST) and broadcast
|
||||||
@ -193,6 +208,8 @@ struct wapi_scan_info_s
|
|||||||
int bitrate;
|
int bitrate;
|
||||||
int has_rssi;
|
int has_rssi;
|
||||||
int rssi;
|
int rssi;
|
||||||
|
int has_encode;
|
||||||
|
int encode;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Linked list container for routing table rows. */
|
/* Linked list container for routing table rows. */
|
||||||
|
@ -708,14 +708,14 @@ static int wapi_scan_results_cmd(int sock, int argc, FAR char **argv)
|
|||||||
|
|
||||||
/* Print found aps */
|
/* Print found aps */
|
||||||
|
|
||||||
printf("bssid / frequency / signal level / ssid\n");
|
printf("bssid / frequency / signal level / encode / ssid\n");
|
||||||
for (info = list.head.scan; info; info = info->next)
|
for (info = list.head.scan; info; info = info->next)
|
||||||
{
|
{
|
||||||
printf("%02x:%02x:%02x:%02x:%02x:%02x\t%g\t%d\t%s\n",
|
printf("%02x:%02x:%02x:%02x:%02x:%02x\t%g\t%d\t%04x\t%s\n",
|
||||||
info->ap.ether_addr_octet[0], info->ap.ether_addr_octet[1],
|
info->ap.ether_addr_octet[0], info->ap.ether_addr_octet[1],
|
||||||
info->ap.ether_addr_octet[2], info->ap.ether_addr_octet[3],
|
info->ap.ether_addr_octet[2], info->ap.ether_addr_octet[3],
|
||||||
info->ap.ether_addr_octet[4], info->ap.ether_addr_octet[5],
|
info->ap.ether_addr_octet[4], info->ap.ether_addr_octet[5],
|
||||||
info->freq, info->rssi, info->essid);
|
info->freq, info->rssi, info->encode, info->essid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free ap list */
|
/* Free ap list */
|
||||||
|
@ -263,6 +263,7 @@ static int wapi_event_stream_extract(FAR struct wapi_event_stream_s *stream,
|
|||||||
switch (iwe_stream->cmd)
|
switch (iwe_stream->cmd)
|
||||||
{
|
{
|
||||||
case SIOCGIWESSID:
|
case SIOCGIWESSID:
|
||||||
|
case SIOCGIWENCODE:
|
||||||
case IWEVGENIE:
|
case IWEVGENIE:
|
||||||
iwe->cmd = iwe_stream->cmd;
|
iwe->cmd = iwe_stream->cmd;
|
||||||
iwe->len = offsetof(struct iw_event, u) + sizeof(struct iw_point);
|
iwe->len = offsetof(struct iw_event, u) + sizeof(struct iw_point);
|
||||||
@ -329,6 +330,7 @@ static int wapi_scan_event(FAR struct iw_event *event,
|
|||||||
/* Reset it. */
|
/* Reset it. */
|
||||||
|
|
||||||
bzero(temp, sizeof(struct wapi_scan_info_s));
|
bzero(temp, sizeof(struct wapi_scan_info_s));
|
||||||
|
temp->encode = 0xffff;
|
||||||
|
|
||||||
/* Save cell identifier. */
|
/* Save cell identifier. */
|
||||||
|
|
||||||
@ -438,6 +440,13 @@ static int wapi_scan_event(FAR struct iw_event *event,
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case SIOCGIWENCODE:
|
||||||
|
{
|
||||||
|
info->has_encode = 1;
|
||||||
|
info->encode = event->u.data.flags;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user