network: add network info accessors

This adds the accessors for the hidden field in network
info. In addition, it provides a lookup of the network infos
by ssid and security type.
This commit is contained in:
Tim Kourt 2018-07-10 15:46:54 -07:00 committed by Denis Kenzior
parent d2feb535a5
commit 72c6862255
2 changed files with 29 additions and 0 deletions

View File

@ -1306,3 +1306,28 @@ bool network_info_has_hidden(void)
{
return num_known_hidden_networks ? true : false;
}
void network_info_set_hidden(struct network *network)
{
if (network->info->is_hidden)
return;
network->info->is_hidden = true;
num_known_hidden_networks += 1;
}
bool network_info_is_hidden(struct network *network)
{
return network->info->is_hidden;
}
const struct network_info *network_info_find(const char *ssid,
enum security security)
{
struct network_info query;
query.type = security;
strcpy(query.ssid, ssid);
return l_queue_find(networks, network_info_match, &query);
}

View File

@ -85,3 +85,7 @@ void network_info_foreach(network_info_foreach_func_t function,
void *user_data);
const struct l_queue *network_info_get_known();
bool network_info_has_hidden(void);
void network_info_set_hidden(struct network *network);
bool network_info_is_hidden(struct network *network);
const struct network_info *network_info_find(const char *ssid,
enum security security);