Lines Matching refs:cmd
45 static void print_help(FILE *stream, const char *cmd);
193 static int _wpa_ctrl_command(struct wpa_ctrl *ctrl, const char *cmd, int print) in _wpa_ctrl_command() argument
204 ret = wpa_ctrl_request(ctrl, cmd, strlen(cmd), buf, &len, in _wpa_ctrl_command()
207 printf("'%s' command timed out.\n", cmd); in _wpa_ctrl_command()
210 printf("'%s' command failed.\n", cmd); in _wpa_ctrl_command()
221 static inline int wpa_ctrl_command(struct wpa_ctrl *ctrl, const char *cmd) in wpa_ctrl_command() argument
223 return _wpa_ctrl_command(ctrl, cmd, 1); in wpa_ctrl_command()
227 static int hostapd_cli_cmd(struct wpa_ctrl *ctrl, const char *cmd, in hostapd_cli_cmd() argument
234 cmd, min_args, min_args > 1 ? "s are" : " is"); in hostapd_cli_cmd()
237 if (write_cmd(buf, sizeof(buf), cmd, argc, argv) < 0) in hostapd_cli_cmd()
459 char cmd[256]; in hostapd_cli_cmd_wps_check_pin() local
469 res = os_snprintf(cmd, sizeof(cmd), "WPS_CHECK_PIN %s %s", in hostapd_cli_cmd_wps_check_pin()
472 res = os_snprintf(cmd, sizeof(cmd), "WPS_CHECK_PIN %s", in hostapd_cli_cmd_wps_check_pin()
474 if (os_snprintf_error(sizeof(cmd), res)) { in hostapd_cli_cmd_wps_check_pin()
478 return wpa_ctrl_command(ctrl, cmd); in hostapd_cli_cmd_wps_check_pin()
526 char cmd[64]; in hostapd_cli_cmd_wps_nfc_config_token() local
535 res = os_snprintf(cmd, sizeof(cmd), "WPS_NFC_CONFIG_TOKEN %s", in hostapd_cli_cmd_wps_nfc_config_token()
537 if (os_snprintf_error(sizeof(cmd), res)) { in hostapd_cli_cmd_wps_nfc_config_token()
541 return wpa_ctrl_command(ctrl, cmd); in hostapd_cli_cmd_wps_nfc_config_token()
548 char cmd[64]; in hostapd_cli_cmd_wps_nfc_token() local
557 res = os_snprintf(cmd, sizeof(cmd), "WPS_NFC_TOKEN %s", argv[0]); in hostapd_cli_cmd_wps_nfc_token()
558 if (os_snprintf_error(sizeof(cmd), res)) { in hostapd_cli_cmd_wps_nfc_token()
562 return wpa_ctrl_command(ctrl, cmd); in hostapd_cli_cmd_wps_nfc_token()
569 char cmd[64]; in hostapd_cli_cmd_nfc_get_handover_sel() local
578 res = os_snprintf(cmd, sizeof(cmd), "NFC_GET_HANDOVER_SEL %s %s", in hostapd_cli_cmd_nfc_get_handover_sel()
580 if (os_snprintf_error(sizeof(cmd), res)) { in hostapd_cli_cmd_nfc_get_handover_sel()
584 return wpa_ctrl_command(ctrl, cmd); in hostapd_cli_cmd_nfc_get_handover_sel()
737 static int wpa_ctrl_command_sta(struct wpa_ctrl *ctrl, const char *cmd, in wpa_ctrl_command_sta() argument
749 ret = wpa_ctrl_request(ctrl, cmd, strlen(cmd), buf, &len, in wpa_ctrl_command_sta()
752 printf("'%s' command timed out.\n", cmd); in wpa_ctrl_command_sta()
755 printf("'%s' command failed.\n", cmd); in wpa_ctrl_command_sta()
777 char addr[32], cmd[64]; in hostapd_cli_cmd_all_sta() local
782 snprintf(cmd, sizeof(cmd), "STA-NEXT %s", addr); in hostapd_cli_cmd_all_sta()
783 } while (wpa_ctrl_command_sta(ctrl, cmd, addr, sizeof(addr), 1) == 0); in hostapd_cli_cmd_all_sta()
792 char addr[32], cmd[64]; in hostapd_cli_cmd_list_sta() local
799 os_snprintf(cmd, sizeof(cmd), "STA-NEXT %s", addr); in hostapd_cli_cmd_list_sta()
800 } while (wpa_ctrl_command_sta(ctrl, cmd, addr, sizeof(addr), 0) == 0); in hostapd_cli_cmd_list_sta()
931 char cmd[256]; in hostapd_cli_cmd_level() local
937 snprintf(cmd, sizeof(cmd), "LEVEL %s", argv[0]); in hostapd_cli_cmd_level()
938 return wpa_ctrl_command(ctrl, cmd); in hostapd_cli_cmd_level()
944 char addr[32], cmd[64]; in update_stations() local
956 os_snprintf(cmd, sizeof(cmd), "STA-NEXT %s", addr); in update_stations()
957 } while (wpa_ctrl_command_sta(ctrl, cmd, addr, sizeof(addr), 0) == 0); in update_stations()
1041 char cmd[2048]; in hostapd_cli_cmd_set() local
1050 res = os_snprintf(cmd, sizeof(cmd), "SET %s %s", argv[0], argv[1]); in hostapd_cli_cmd_set()
1051 if (os_snprintf_error(sizeof(cmd), res)) { in hostapd_cli_cmd_set()
1055 return wpa_ctrl_command(ctrl, cmd); in hostapd_cli_cmd_set()
1099 char cmd[256]; in hostapd_cli_cmd_get() local
1108 res = os_snprintf(cmd, sizeof(cmd), "GET %s", argv[0]); in hostapd_cli_cmd_get()
1109 if (os_snprintf_error(sizeof(cmd), res)) { in hostapd_cli_cmd_get()
1113 return wpa_ctrl_command(ctrl, cmd); in hostapd_cli_cmd_get()
1145 char cmd[256]; in hostapd_cli_cmd_fst() local
1155 total = os_snprintf(cmd, sizeof(cmd), "FST-MANAGER"); in hostapd_cli_cmd_fst()
1158 res = os_snprintf(cmd + total, sizeof(cmd) - total, " %s", in hostapd_cli_cmd_fst()
1160 if (os_snprintf_error(sizeof(cmd) - total, res)) { in hostapd_cli_cmd_fst()
1166 return wpa_ctrl_command(ctrl, cmd); in hostapd_cli_cmd_fst()
1183 char cmd[256]; in hostapd_cli_cmd_chan_switch() local
1198 res = os_snprintf(cmd, sizeof(cmd), "CHAN_SWITCH %s %s", in hostapd_cli_cmd_chan_switch()
1200 if (os_snprintf_error(sizeof(cmd), res)) { in hostapd_cli_cmd_chan_switch()
1207 tmp = cmd + total; in hostapd_cli_cmd_chan_switch()
1208 res = os_snprintf(tmp, sizeof(cmd) - total, " %s", argv[i]); in hostapd_cli_cmd_chan_switch()
1209 if (os_snprintf_error(sizeof(cmd) - total, res)) { in hostapd_cli_cmd_chan_switch()
1215 return wpa_ctrl_command(ctrl, cmd); in hostapd_cli_cmd_chan_switch()
1291 char cmd[256]; in hostapd_cli_cmd_vendor() local
1300 res = os_snprintf(cmd, sizeof(cmd), "VENDOR %s %s %s%s%s", argv[0], in hostapd_cli_cmd_vendor()
1303 if (os_snprintf_error(sizeof(cmd), res)) { in hostapd_cli_cmd_vendor()
1307 return wpa_ctrl_command(ctrl, cmd); in hostapd_cli_cmd_vendor()
1321 char cmd[256]; in hostapd_cli_cmd_log_level() local
1324 res = os_snprintf(cmd, sizeof(cmd), "LOG_LEVEL%s%s%s%s", in hostapd_cli_cmd_log_level()
1329 if (os_snprintf_error(sizeof(cmd), res)) { in hostapd_cli_cmd_log_level()
1333 return wpa_ctrl_command(ctrl, cmd); in hostapd_cli_cmd_log_level()
1361 char cmd[2048]; in hostapd_cli_cmd_set_neighbor() local
1369 res = os_snprintf(cmd, sizeof(cmd), "SET_NEIGHBOR %s %s %s %s %s %s", in hostapd_cli_cmd_set_neighbor()
1372 if (os_snprintf_error(sizeof(cmd), res)) { in hostapd_cli_cmd_set_neighbor()
1376 return wpa_ctrl_command(ctrl, cmd); in hostapd_cli_cmd_set_neighbor()
1397 char cmd[256]; in hostapd_cli_cmd_req_lci() local
1405 res = os_snprintf(cmd, sizeof(cmd), "REQ_LCI %s", argv[0]); in hostapd_cli_cmd_req_lci()
1406 if (os_snprintf_error(sizeof(cmd), res)) { in hostapd_cli_cmd_req_lci()
1410 return wpa_ctrl_command(ctrl, cmd); in hostapd_cli_cmd_req_lci()
1658 const char *cmd; member
1892 static void print_cmd_help(FILE *stream, const struct hostapd_cli_cmd *cmd, in print_cmd_help() argument
1898 if (cmd->usage == NULL) in print_cmd_help()
1900 fprintf(stream, "%s%s ", pad, cmd->cmd); in print_cmd_help()
1901 for (n = 0; (c = cmd->usage[n]); n++) { in print_cmd_help()
1910 static void print_help(FILE *stream, const char *cmd) in print_help() argument
1915 for (n = 0; hostapd_cli_commands[n].cmd; n++) { in print_help()
1916 if (cmd == NULL || str_starts(hostapd_cli_commands[n].cmd, cmd)) in print_help()
1924 const struct hostapd_cli_cmd *cmd, *match = NULL; in wpa_request() local
1928 cmd = hostapd_cli_commands; in wpa_request()
1929 while (cmd->cmd) { in wpa_request()
1930 if (strncasecmp(cmd->cmd, argv[0], strlen(argv[0])) == 0) { in wpa_request()
1931 match = cmd; in wpa_request()
1932 if (os_strcasecmp(cmd->cmd, argv[0]) == 0) { in wpa_request()
1939 cmd++; in wpa_request()
1944 cmd = hostapd_cli_commands; in wpa_request()
1945 while (cmd->cmd) { in wpa_request()
1946 if (strncasecmp(cmd->cmd, argv[0], strlen(argv[0])) == in wpa_request()
1948 printf(" %s", cmd->cmd); in wpa_request()
1950 cmd++; in wpa_request()
2043 static void hostapd_cli_edit_cmd_cb(void *ctx, char *cmd) in hostapd_cli_edit_cmd_cb() argument
2047 argc = tokenize_cmd(cmd, argv); in hostapd_cli_edit_cmd_cb()
2069 for (i = 0; hostapd_cli_commands[i].cmd; i++) { in list_cmd_list()
2070 res[i] = os_strdup(hostapd_cli_commands[i].cmd); in list_cmd_list()
2079 static char ** hostapd_cli_cmd_completion(const char *cmd, const char *str, in hostapd_cli_cmd_completion() argument
2084 for (i = 0; hostapd_cli_commands[i].cmd; i++) { in hostapd_cli_cmd_completion()
2085 if (os_strcasecmp(hostapd_cli_commands[i].cmd, cmd) != 0) in hostapd_cli_cmd_completion()
2106 char *cmd; in hostapd_cli_edit_completion_cb() local
2112 cmd = os_malloc(pos + 1); in hostapd_cli_edit_completion_cb()
2113 if (cmd == NULL) in hostapd_cli_edit_completion_cb()
2115 os_memcpy(cmd, str, pos); in hostapd_cli_edit_completion_cb()
2116 cmd[end - str] = '\0'; in hostapd_cli_edit_completion_cb()
2117 res = hostapd_cli_cmd_completion(cmd, str, pos); in hostapd_cli_edit_completion_cb()
2118 os_free(cmd); in hostapd_cli_edit_completion_cb()