mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
client: add new command statuses
Split CMD_STATUS_OK into CMD_STATUS_DONE and CMD_STATUS_TRIGGERED. The split is necessary for the enablement of noninteractive mode.
This commit is contained in:
parent
957132b1c3
commit
2ba4efe39e
@ -158,7 +158,7 @@ static enum cmd_status cmd_list(const char *device_name, char **argv, int argc)
|
||||
display("No devices in Ad-Hoc mode available.\n");
|
||||
display_table_footer();
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_DONE;
|
||||
}
|
||||
|
||||
for (entry = l_queue_get_entries(match); entry; entry = entry->next) {
|
||||
@ -172,7 +172,7 @@ static enum cmd_status cmd_list(const char *device_name, char **argv, int argc)
|
||||
|
||||
l_queue_destroy(match, NULL);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_DONE;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_start(const char *device_name, char **argv, int argc)
|
||||
@ -204,7 +204,7 @@ static enum cmd_status cmd_start(const char *device_name, char **argv, int argc)
|
||||
check_errors_method_callback,
|
||||
argv[0], argv[1]);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_start_open(const char *device_name,
|
||||
@ -231,7 +231,7 @@ static enum cmd_status cmd_start_open(const char *device_name,
|
||||
check_errors_method_callback,
|
||||
argv[0]);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_stop(const char *device_name, char **argv, int argc)
|
||||
@ -247,7 +247,7 @@ static enum cmd_status cmd_stop(const char *device_name, char **argv, int argc)
|
||||
proxy_interface_method_call(proxy, "Stop", "",
|
||||
check_errors_method_callback);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static const struct command ad_hoc_commands[] = {
|
||||
|
@ -243,7 +243,7 @@ static enum cmd_status cmd_list(const char *adapter_name,
|
||||
|
||||
display_table_footer();
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_DONE;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_show(const char *adapter_name,
|
||||
@ -257,7 +257,7 @@ static enum cmd_status cmd_show(const char *adapter_name,
|
||||
|
||||
display_adapter(proxy);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_DONE;
|
||||
}
|
||||
|
||||
static void property_set_callback(struct l_dbus_message *message,
|
||||
@ -282,7 +282,7 @@ static enum cmd_status cmd_set_property(const char *adapter_name,
|
||||
property_set_callback))
|
||||
return CMD_STATUS_INVALID_VALUE;
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static char *set_property_cmd_arg_completion(const char *text, int state)
|
||||
|
@ -159,7 +159,7 @@ static enum cmd_status cmd_list(const char *device_name, char **argv, int argc)
|
||||
display("No devices in access point mode available.\n");
|
||||
display_table_footer();
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_DONE;
|
||||
}
|
||||
|
||||
for (entry = l_queue_get_entries(match); entry; entry = entry->next) {
|
||||
@ -172,7 +172,7 @@ static enum cmd_status cmd_list(const char *device_name, char **argv, int argc)
|
||||
|
||||
l_queue_destroy(match, NULL);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_DONE;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_start(const char *device_name, char **argv, int argc)
|
||||
@ -204,7 +204,7 @@ static enum cmd_status cmd_start(const char *device_name, char **argv, int argc)
|
||||
check_errors_method_callback,
|
||||
argv[0], argv[1]);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_stop(const char *device_name, char **argv, int argc)
|
||||
@ -220,7 +220,7 @@ static enum cmd_status cmd_stop(const char *device_name, char **argv, int argc)
|
||||
proxy_interface_method_call(proxy, "Stop", "",
|
||||
check_errors_method_callback);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static const struct command ap_commands[] = {
|
||||
|
@ -38,7 +38,7 @@ static enum cmd_status cmd_version(const char *entity,
|
||||
{
|
||||
display("IWD version %s\n", VERSION);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_DONE;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_quit(const char *entity,
|
||||
@ -48,7 +48,7 @@ static enum cmd_status cmd_quit(const char *entity,
|
||||
|
||||
l_main_quit();
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_DONE;
|
||||
}
|
||||
|
||||
static const struct command command_list[] = {
|
||||
@ -334,7 +334,7 @@ static void execute_cmd(const char *family, const char *entity,
|
||||
|
||||
status = cmd->function(entity, argv, argc);
|
||||
|
||||
if (status != CMD_STATUS_OK)
|
||||
if (status != CMD_STATUS_TRIGGERED && status != CMD_STATUS_DONE)
|
||||
goto error;
|
||||
|
||||
if (cmd->refreshable)
|
||||
|
@ -23,7 +23,8 @@
|
||||
typedef char *(*command_completion_func_t) (const char *text, int state);
|
||||
|
||||
enum cmd_status {
|
||||
CMD_STATUS_OK,
|
||||
CMD_STATUS_TRIGGERED,
|
||||
CMD_STATUS_DONE,
|
||||
CMD_STATUS_INVALID_ARGS,
|
||||
CMD_STATUS_INVALID_VALUE,
|
||||
CMD_STATUS_UNSUPPORTED,
|
||||
|
@ -653,7 +653,7 @@ static enum cmd_status cmd_show(const char *device_name,
|
||||
|
||||
display_device(proxy);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_DONE;
|
||||
}
|
||||
|
||||
static void check_errors_method_callback(struct l_dbus_message *message,
|
||||
@ -674,7 +674,7 @@ static enum cmd_status cmd_scan(const char *device_name,
|
||||
proxy_interface_method_call(proxy, "Scan", "",
|
||||
check_errors_method_callback);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_disconnect(const char *device_name,
|
||||
@ -689,7 +689,7 @@ static enum cmd_status cmd_disconnect(const char *device_name,
|
||||
proxy_interface_method_call(proxy, "Disconnect", "",
|
||||
check_errors_method_callback);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_get_networks(const char *device_name,
|
||||
@ -713,7 +713,7 @@ proceed:
|
||||
proxy_interface_method_call(proxy, "GetOrderedNetworks", "",
|
||||
ordered_networks_callback);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_list(const char *device_name,
|
||||
@ -726,7 +726,7 @@ static enum cmd_status cmd_list(const char *device_name,
|
||||
|
||||
display_table_footer();
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_DONE;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_set_property(const char *device_name,
|
||||
@ -745,7 +745,7 @@ static enum cmd_status cmd_set_property(const char *device_name,
|
||||
check_errors_method_callback))
|
||||
return CMD_STATUS_INVALID_VALUE;
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_connect(const char *device_name,
|
||||
@ -787,7 +787,7 @@ static enum cmd_status cmd_connect(const char *device_name,
|
||||
l_queue_destroy(match, NULL);
|
||||
network_connect(network_proxy);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_connect_hidden_network(const char *device_name,
|
||||
@ -807,7 +807,7 @@ static enum cmd_status cmd_connect_hidden_network(const char *device_name,
|
||||
check_errors_method_callback,
|
||||
argv[0]);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static char *get_networks_cmd_arg_completion(const char *text, int state)
|
||||
|
@ -201,7 +201,7 @@ static enum cmd_status cmd_list(const char *entity, char **args, int argc)
|
||||
|
||||
display_table_footer();
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_DONE;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_forget(const char *entity, char **argv, int argc)
|
||||
@ -241,7 +241,7 @@ static enum cmd_status cmd_forget(const char *entity, char **argv, int argc)
|
||||
proxy_interface_method_call(known_network_proxy, "Forget", "",
|
||||
check_errors_method_callback);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static const struct command known_networks_commands[] = {
|
||||
|
12
client/wsc.c
12
client/wsc.c
@ -152,7 +152,7 @@ static enum cmd_status cmd_list(const char *device_name, char **argv, int argc)
|
||||
display("No WSC-capable devices available\n");
|
||||
display_table_footer();
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_DONE;
|
||||
}
|
||||
|
||||
for (entry = l_queue_get_entries(match); entry; entry = entry->next) {
|
||||
@ -165,7 +165,7 @@ static enum cmd_status cmd_list(const char *device_name, char **argv, int argc)
|
||||
|
||||
l_queue_destroy(match, NULL);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_DONE;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_push_button(const char *device_name,
|
||||
@ -182,7 +182,7 @@ static enum cmd_status cmd_push_button(const char *device_name,
|
||||
proxy_interface_method_call(proxy, "PushButton", "",
|
||||
check_errors_method_callback);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_start_user_pin(const char *device_name,
|
||||
@ -202,7 +202,7 @@ static enum cmd_status cmd_start_user_pin(const char *device_name,
|
||||
proxy_interface_method_call(proxy, "StartPin", "s",
|
||||
check_errors_method_callback, argv[0]);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_start_pin(const char *device_name,
|
||||
@ -219,7 +219,7 @@ static enum cmd_status cmd_start_pin(const char *device_name,
|
||||
proxy_interface_method_call(proxy, "GeneratePin", "",
|
||||
generate_pin_callback);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_cancel(const char *device_name,
|
||||
@ -236,7 +236,7 @@ static enum cmd_status cmd_cancel(const char *device_name,
|
||||
proxy_interface_method_call(proxy, "Cancel", "",
|
||||
check_errors_method_callback);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
return CMD_STATUS_TRIGGERED;
|
||||
}
|
||||
|
||||
static const struct command wsc_commands[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user