network: Add network_set_psk

This commit is contained in:
Denis Kenzior 2016-09-21 16:20:09 -05:00
parent c380940b43
commit 3fd51c2d72
2 changed files with 11 additions and 0 deletions

View File

@ -317,6 +317,16 @@ const uint8_t *network_get_psk(const struct network *network)
return network->psk;
}
bool network_set_psk(struct network *network, const uint8_t *psk)
{
if (network->info->type != SECURITY_PSK)
return false;
l_free(network->psk);
network->psk = l_memdup(psk, 32);
return true;
}
int network_get_signal_strength(const struct network *network)
{
struct scan_bss *best_bss = l_queue_peek_head(network->bss_list);

View File

@ -43,6 +43,7 @@ const uint8_t *network_get_psk(const struct network *network);
int network_get_signal_strength(const struct network *network);
struct l_settings *network_get_settings(const struct network *network);
bool network_set_psk(struct network *network, const uint8_t *psk);
void network_sync_psk(struct network *network);
int network_autoconnect(struct network *network, struct scan_bss *bss);