Add support for removing networks

This commit is contained in:
Pierre Pronchery 2017-09-26 21:45:48 +02:00
parent 0c9d82ff72
commit 46307e3d12
2 changed files with 10 additions and 4 deletions

View File

@ -72,6 +72,7 @@ typedef enum _WPACommand
WC_LIST_NETWORKS,
WC_REASSOCIATE,
WC_RECONFIGURE,
WC_REMOVE_NETWORK, /* unsigned int id */
WC_SAVE_CONFIGURATION,
WC_SCAN,
WC_SCAN_RESULTS,
@ -750,6 +751,10 @@ static int _wpa_queue(WPA * wpa, WPAChannel * channel, WPACommand command, ...)
case WC_RECONFIGURE:
cmd = strdup("RECONFIGURE");
break;
case WC_REMOVE_NETWORK:
u = va_arg(ap, unsigned int);
cmd = g_strdup_printf("REMOVE_NETWORK %u", u);
break;
case WC_SAVE_CONFIGURATION:
cmd = strdup("SAVE_CONFIG");
break;

View File

@ -64,14 +64,15 @@ int main(void)
|| _wpa_queue(NULL, &channel, WC_LIST_NETWORKS) != 0
|| _wpa_queue(NULL, &channel, WC_REASSOCIATE) != 0
|| _wpa_queue(NULL, &channel, WC_RECONFIGURE) != 0
|| _wpa_queue(NULL, &channel, WC_ENABLE_NETWORK, 1) != 0
|| _wpa_queue(NULL, &channel,
WC_SAVE_CONFIGURATION) != 0
WC_REMOVE_NETWORK, 2) != 0
|| _wpa_queue(NULL, &channel, WC_SCAN) != 0
|| _wpa_queue(NULL, &channel, WC_SCAN_RESULTS) != 0
|| _wpa_queue(NULL, &channel, WC_SELECT_NETWORK, 2) != 0
|| _wpa_queue(NULL, &channel, WC_SET_NETWORK, 3, FALSE,
|| _wpa_queue(NULL, &channel, WC_SELECT_NETWORK, 3) != 0
|| _wpa_queue(NULL, &channel, WC_SET_NETWORK, 4, FALSE,
"key_mgmt", "NONE") != 0
|| _wpa_queue(NULL, &channel, WC_SET_NETWORK, 4, TRUE,
|| _wpa_queue(NULL, &channel, WC_SET_NETWORK, 5, TRUE,
"ssid", "default") != 0
|| _wpa_queue(NULL, &channel, WC_STATUS) != 0
|| _wpa_queue(NULL, &channel, WC_TERMINATE) != 0)