wpa_cli: Add completion routine for "get" command
Add tab completion function that includes all available "get" parameters. Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
This commit is contained in:
parent
5c6c315fba
commit
0fd9d95fde
1 changed files with 69 additions and 1 deletions
|
@ -670,6 +670,74 @@ static int wpa_cli_cmd_get(struct wpa_ctrl *ctrl, int argc, char *argv[])
|
|||
}
|
||||
|
||||
|
||||
static char ** wpa_cli_complete_get(const char *str, int pos)
|
||||
{
|
||||
int arg = get_cmd_arg_num(str, pos);
|
||||
const char *fields[] = {
|
||||
#ifdef CONFIG_CTRL_IFACE
|
||||
"ctrl_interface", "ctrl_interface_group",
|
||||
#endif /* CONFIG_CTRL_IFACE */
|
||||
"eapol_version", "ap_scan",
|
||||
#ifdef CONFIG_MESH
|
||||
"user_mpm", "max_peer_links", "mesh_max_inactivity",
|
||||
#endif /* CONFIG_MESH */
|
||||
"disable_scan_offload", "fast_reauth", "opensc_engine_path",
|
||||
"pkcs11_engine_path", "pkcs11_module_path", "openssl_ciphers",
|
||||
"pcsc_reader", "pcsc_pin", "external_sim", "driver_param",
|
||||
"dot11RSNAConfigPMKLifetime",
|
||||
"dot11RSNAConfigPMKReauthThreshold",
|
||||
"dot11RSNAConfigSATimeout",
|
||||
#ifndef CONFIG_NO_CONFIG_WRITE
|
||||
"update_config",
|
||||
#endif /* CONFIG_NO_CONFIG_WRITE */
|
||||
#ifdef CONFIG_WPS
|
||||
"device_name", "manufacturer", "model_name", "model_number",
|
||||
"serial_number", "config_methods", "wps_cred_processing",
|
||||
#endif /* CONFIG_WPS */
|
||||
#ifdef CONFIG_P2P
|
||||
"p2p_listen_reg_class", "p2p_listen_channel",
|
||||
"p2p_oper_reg_class", "p2p_oper_channel", "p2p_go_intent",
|
||||
"p2p_ssid_postfix", "persistent_reconnect", "p2p_intra_bss",
|
||||
"p2p_group_idle", "p2p_passphrase_len", "p2p_add_cli_chan",
|
||||
"p2p_optimize_listen_chan", "p2p_go_ht40", "p2p_go_vht",
|
||||
"p2p_disabled", "p2p_go_ctwindow", "p2p_no_group_iface",
|
||||
"p2p_ignore_shared_freq", "ip_addr_go", "ip_addr_mask",
|
||||
"ip_addr_start", "ip_addr_end",
|
||||
#endif /* CONFIG_P2P */
|
||||
"bss_max_count", "bss_expiration_age",
|
||||
"bss_expiration_scan_count", "filter_ssids", "filter_rssi",
|
||||
"max_num_sta", "disassoc_low_ack",
|
||||
#ifdef CONFIG_HS20
|
||||
"hs20",
|
||||
#endif /* CONFIG_HS20 */
|
||||
"interworking", "access_network_type", "pbc_in_m1", "autoscan",
|
||||
"wps_nfc_dev_pw_id", "ext_password_backend",
|
||||
"p2p_go_max_inactivity", "auto_interworking", "okc", "pmf",
|
||||
"dtim_period", "beacon_int", "ignore_old_scan_res",
|
||||
"scan_cur_freq", "sched_scan_interval",
|
||||
"tdls_external_control", "osu_dir", "wowlan_triggers",
|
||||
"p2p_search_delay", "mac_addr", "rand_addr_lifetime",
|
||||
"preassoc_mac_addr", "key_mgmt_offload", "passive_scan",
|
||||
"reassoc_same_bss_optim"
|
||||
};
|
||||
int i, num_fields = ARRAY_SIZE(fields);
|
||||
|
||||
if (arg == 1) {
|
||||
char **res = os_calloc(num_fields + 1, sizeof(char *));
|
||||
if (res == NULL)
|
||||
return NULL;
|
||||
for (i = 0; i < num_fields; i++) {
|
||||
res[i] = os_strdup(fields[i]);
|
||||
if (res[i] == NULL)
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static int wpa_cli_cmd_logoff(struct wpa_ctrl *ctrl, int argc, char *argv[])
|
||||
{
|
||||
return wpa_ctrl_command(ctrl, "LOGOFF");
|
||||
|
@ -2624,7 +2692,7 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
|
|||
{ "dump", wpa_cli_cmd_dump, NULL,
|
||||
cli_cmd_flag_none,
|
||||
"= dump config variables" },
|
||||
{ "get", wpa_cli_cmd_get, NULL,
|
||||
{ "get", wpa_cli_cmd_get, wpa_cli_complete_get,
|
||||
cli_cmd_flag_none,
|
||||
"<name> = get information" },
|
||||
{ "logon", wpa_cli_cmd_logon, NULL,
|
||||
|
|
Loading…
Reference in a new issue