2017-04-21 20:14:51 +02:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Wireless daemon for Linux
|
|
|
|
*
|
2019-04-11 00:58:18 +02:00
|
|
|
* Copyright (C) 2017-2019 Intel Corporation. All rights reserved.
|
2017-04-21 20:14:51 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2017-04-26 03:13:57 +02:00
|
|
|
#define _XOPEN_SOURCE 700
|
|
|
|
|
|
|
|
#include <time.h>
|
2017-04-21 20:14:51 +02:00
|
|
|
#include <ell/ell.h>
|
|
|
|
|
2019-12-13 09:02:42 +01:00
|
|
|
#include "client/command.h"
|
|
|
|
#include "client/dbus-proxy.h"
|
|
|
|
#include "client/display.h"
|
|
|
|
#include "client/properties.h"
|
|
|
|
#include "client/network.h"
|
2017-04-26 03:13:57 +02:00
|
|
|
|
2017-04-21 20:14:55 +02:00
|
|
|
struct known_network {
|
2018-07-31 16:37:10 +02:00
|
|
|
char *identity;
|
2017-04-21 20:14:55 +02:00
|
|
|
char *name;
|
|
|
|
char *type;
|
|
|
|
char *last_connected;
|
2018-11-09 01:25:19 +01:00
|
|
|
bool hidden;
|
2019-04-11 00:58:23 +02:00
|
|
|
bool autoconnect;
|
2017-04-21 20:14:55 +02:00
|
|
|
};
|
|
|
|
|
2017-04-26 03:13:57 +02:00
|
|
|
static const char *format_iso8601(const char *time_str, const char *format)
|
|
|
|
{
|
|
|
|
struct tm tm;
|
|
|
|
time_t time;
|
|
|
|
static char buf[255];
|
|
|
|
|
|
|
|
if (!time_str)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
memset(&tm, 0, sizeof(struct tm));
|
|
|
|
|
|
|
|
strptime(time_str, "%FT%TZ", &tm);
|
|
|
|
|
|
|
|
time = mktime(&tm);
|
|
|
|
|
|
|
|
strftime(buf, sizeof(buf), format, localtime(&time));
|
|
|
|
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
2018-07-25 01:17:18 +02:00
|
|
|
static void update_name(void *data, struct l_dbus_message_iter *variant)
|
2017-04-26 03:13:57 +02:00
|
|
|
{
|
|
|
|
struct known_network *network = data;
|
|
|
|
const char *value;
|
|
|
|
|
2018-07-31 16:37:11 +02:00
|
|
|
l_free(network->name);
|
|
|
|
|
2017-04-26 03:13:57 +02:00
|
|
|
if (!l_dbus_message_iter_get_variant(variant, "s", &value)) {
|
|
|
|
network->name = NULL;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
network->name = l_strdup(value);
|
|
|
|
}
|
|
|
|
|
2019-04-11 00:58:16 +02:00
|
|
|
static const char *get_name(const void *data)
|
|
|
|
{
|
|
|
|
const struct known_network *network = data;
|
|
|
|
|
|
|
|
return network->name;
|
|
|
|
}
|
|
|
|
|
2018-07-25 01:17:18 +02:00
|
|
|
static void update_type(void *data, struct l_dbus_message_iter *variant)
|
2017-04-26 03:13:57 +02:00
|
|
|
{
|
|
|
|
struct known_network *network = data;
|
|
|
|
const char *value;
|
|
|
|
|
2018-07-31 16:37:11 +02:00
|
|
|
l_free(network->type);
|
|
|
|
|
2017-04-26 03:13:57 +02:00
|
|
|
if (!l_dbus_message_iter_get_variant(variant, "s", &value)) {
|
|
|
|
network->type = NULL;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
network->type = l_strdup(value);
|
|
|
|
}
|
|
|
|
|
2018-07-25 01:17:18 +02:00
|
|
|
static void update_last_connected(void *data, struct l_dbus_message_iter *variant)
|
2017-04-26 03:13:57 +02:00
|
|
|
{
|
|
|
|
struct known_network *network = data;
|
|
|
|
const char *value;
|
|
|
|
|
2018-07-31 16:37:11 +02:00
|
|
|
l_free(network->last_connected);
|
|
|
|
|
2017-04-26 03:13:57 +02:00
|
|
|
if (!l_dbus_message_iter_get_variant(variant, "s", &value)) {
|
|
|
|
network->last_connected = NULL;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
network->last_connected = l_strdup(value);
|
|
|
|
}
|
|
|
|
|
2018-11-09 01:25:19 +01:00
|
|
|
static void update_hidden(void *data, struct l_dbus_message_iter *variant)
|
|
|
|
{
|
|
|
|
struct known_network *network = data;
|
|
|
|
bool value;
|
|
|
|
|
|
|
|
if (!l_dbus_message_iter_get_variant(variant, "b", &value)) {
|
|
|
|
network->hidden = false;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
network->hidden = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *get_hidden_tostr(const void *data)
|
|
|
|
{
|
|
|
|
const struct known_network *network = data;
|
|
|
|
|
|
|
|
return network->hidden ? "yes" : "";
|
|
|
|
}
|
|
|
|
|
2019-04-11 00:58:23 +02:00
|
|
|
static void update_autoconnect(void *data, struct l_dbus_message_iter *variant)
|
|
|
|
{
|
|
|
|
struct known_network *network = data;
|
|
|
|
bool value;
|
|
|
|
|
|
|
|
if (!l_dbus_message_iter_get_variant(variant, "b", &value)) {
|
|
|
|
network->autoconnect = false;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
network->autoconnect = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *get_autoconnect_tostr(const void *data)
|
|
|
|
{
|
|
|
|
const struct known_network *network = data;
|
|
|
|
|
|
|
|
return network->autoconnect ? "yes" : "no";
|
|
|
|
}
|
|
|
|
|
2017-04-26 03:13:57 +02:00
|
|
|
static const struct proxy_interface_property known_network_properties[] = {
|
2019-04-11 00:58:16 +02:00
|
|
|
{ "Name", "s", update_name, get_name },
|
2018-07-25 01:17:18 +02:00
|
|
|
{ "Type", "s", update_type },
|
|
|
|
{ "LastConnectedTime", "s", update_last_connected },
|
2018-11-09 01:25:19 +01:00
|
|
|
{ "Hidden", "b", update_hidden, get_hidden_tostr },
|
2019-10-24 19:50:21 +02:00
|
|
|
{ "AutoConnect", "b", update_autoconnect, get_autoconnect_tostr,
|
2019-04-11 00:58:23 +02:00
|
|
|
true, properties_builder_append_yes_no_variant,
|
|
|
|
properties_yes_no_opts },
|
2017-04-26 03:13:57 +02:00
|
|
|
{ },
|
|
|
|
};
|
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
static void *known_network_create(void)
|
2017-04-26 03:13:57 +02:00
|
|
|
{
|
2018-07-31 16:37:10 +02:00
|
|
|
return l_new(struct known_network, 1);
|
|
|
|
}
|
2017-04-26 03:13:57 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
static void known_network_destroy(void *data)
|
|
|
|
{
|
|
|
|
struct known_network *network = data;
|
2017-04-26 03:13:57 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
l_free(network->last_connected);
|
|
|
|
l_free(network->name);
|
|
|
|
l_free(network->type);
|
|
|
|
l_free(network->identity);
|
2017-04-26 03:13:57 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
l_free(network);
|
2017-04-26 03:13:57 +02:00
|
|
|
}
|
|
|
|
|
2019-04-11 00:58:18 +02:00
|
|
|
static void known_network_display(const struct proxy_interface *proxy)
|
|
|
|
{
|
|
|
|
const struct known_network *known_network =
|
|
|
|
proxy_interface_get_data(proxy);
|
|
|
|
char *caption = l_strdup_printf("%s: %s", "Known Network",
|
|
|
|
known_network->name);
|
|
|
|
|
|
|
|
proxy_properties_display(proxy, caption, MARGIN, 18, 50);
|
|
|
|
|
|
|
|
l_free(caption);
|
|
|
|
|
|
|
|
display_table_footer();
|
|
|
|
}
|
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
static void known_network_display_inline(const char *margin, const void *data)
|
2017-04-26 03:13:57 +02:00
|
|
|
{
|
2018-07-31 16:37:10 +02:00
|
|
|
const struct known_network *network = data;
|
|
|
|
char *last_connected =
|
|
|
|
l_strdup(format_iso8601(network->last_connected,
|
|
|
|
"%b %e, %l:%M %p"));
|
2017-04-26 03:13:57 +02:00
|
|
|
|
2018-11-09 01:25:19 +01:00
|
|
|
display("%s%-*s%-*s%-*s%-*s\n",
|
2018-07-31 16:37:10 +02:00
|
|
|
margin, 32, network->name, 11, network->type,
|
2018-11-09 01:25:19 +01:00
|
|
|
9, get_hidden_tostr(network), 19, last_connected ? : "-");
|
2017-04-26 03:13:57 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
l_free(last_connected);
|
|
|
|
}
|
2017-04-26 03:13:57 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
static const char *known_network_identity(void *data)
|
|
|
|
{
|
|
|
|
struct known_network *network = data;
|
2017-04-26 03:13:57 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
if (!network->identity)
|
|
|
|
network->identity =
|
|
|
|
l_strdup_printf("%s %s", network->name, network->type);
|
2017-04-26 03:13:57 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
return network->identity;
|
|
|
|
}
|
2017-04-26 03:13:57 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
static const struct proxy_interface_type_ops known_network_ops = {
|
|
|
|
.create = known_network_create,
|
|
|
|
.destroy = known_network_destroy,
|
|
|
|
.display = known_network_display_inline,
|
|
|
|
.identity = known_network_identity,
|
|
|
|
};
|
2017-04-26 03:13:57 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
static struct proxy_interface_type known_network_interface_type = {
|
|
|
|
.interface = IWD_KNOWN_NETWORK_INTREFACE,
|
|
|
|
.properties = known_network_properties,
|
|
|
|
.ops = &known_network_ops,
|
|
|
|
};
|
2017-04-26 03:13:57 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
static bool known_network_match(const void *a, const void *b)
|
2017-04-21 20:14:55 +02:00
|
|
|
{
|
2018-07-31 16:37:10 +02:00
|
|
|
const struct known_network *network = a;
|
|
|
|
const struct network_args *args = b;
|
2017-04-21 20:14:55 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
if (strcmp(network->name, args->name))
|
|
|
|
return false;
|
2017-04-21 20:14:55 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
if (args->type && strcmp(network->type, args->type))
|
|
|
|
return false;
|
2017-04-21 20:14:55 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
return true;
|
|
|
|
}
|
2017-04-21 20:14:55 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
static void check_errors_method_callback(struct l_dbus_message *message,
|
|
|
|
void *user_data)
|
|
|
|
{
|
|
|
|
dbus_message_has_error(message);
|
|
|
|
}
|
2017-04-21 20:14:51 +02:00
|
|
|
|
2018-07-27 21:41:30 +02:00
|
|
|
static enum cmd_status cmd_list(const char *entity, char **args, int argc)
|
2017-04-21 20:14:53 +02:00
|
|
|
{
|
2018-11-09 01:25:19 +01:00
|
|
|
display_table_header("Known Networks", MARGIN "%-*s%-*s%-*s%-*s",
|
|
|
|
32, "Name", 11, "Security", 9, "Hidden",
|
2018-07-31 16:37:10 +02:00
|
|
|
19, "Last connected");
|
2017-04-26 03:13:57 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
proxy_interface_display_list(known_network_interface_type.interface);
|
2017-04-26 03:13:57 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
display_table_footer();
|
2017-04-26 03:13:58 +02:00
|
|
|
|
2018-08-03 23:35:37 +02:00
|
|
|
return CMD_STATUS_DONE;
|
2017-04-21 20:14:53 +02:00
|
|
|
}
|
|
|
|
|
2019-04-11 00:58:17 +02:00
|
|
|
static const struct proxy_interface *known_network_proxy_find_by_name(
|
|
|
|
const char *name)
|
2017-04-21 20:14:53 +02:00
|
|
|
{
|
2018-07-31 16:37:10 +02:00
|
|
|
struct network_args network_args;
|
2017-04-26 03:13:59 +02:00
|
|
|
struct l_queue *match;
|
2019-04-11 00:58:17 +02:00
|
|
|
const struct proxy_interface *proxy;
|
2017-04-26 03:13:59 +02:00
|
|
|
|
2019-04-11 00:58:17 +02:00
|
|
|
if (!name)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (l_str_has_suffix(name, ".psk"))
|
|
|
|
network_args.type = "psk";
|
|
|
|
else if (l_str_has_suffix(name, ".8021x"))
|
|
|
|
network_args.type = "8021x";
|
|
|
|
else if (l_str_has_suffix(name, ".open"))
|
|
|
|
network_args.type = "open";
|
|
|
|
else
|
|
|
|
network_args.type = NULL;
|
|
|
|
|
|
|
|
if (network_args.type) {
|
|
|
|
char *dot = strrchr(name, '.');
|
2017-04-26 03:13:59 +02:00
|
|
|
|
2019-04-11 00:58:17 +02:00
|
|
|
if (!dot)
|
|
|
|
/* This shouldn't ever be the case */
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
*dot = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
network_args.name = name;
|
2017-04-26 03:13:59 +02:00
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
match = proxy_interface_find_all(known_network_interface_type.interface,
|
|
|
|
known_network_match,
|
|
|
|
&network_args);
|
2017-04-26 03:13:59 +02:00
|
|
|
|
|
|
|
if (!match) {
|
2018-07-31 16:37:10 +02:00
|
|
|
display("No network with specified parameters was found\n");
|
2019-04-11 00:58:17 +02:00
|
|
|
return NULL;
|
2017-04-26 03:13:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (l_queue_length(match) > 1) {
|
2018-07-31 16:37:10 +02:00
|
|
|
if (!network_args.type) {
|
2017-04-26 03:13:59 +02:00
|
|
|
display("Provided network name is ambiguous. "
|
2019-04-11 00:58:17 +02:00
|
|
|
"Specify network security type as follows:\n");
|
|
|
|
display("<\"network name" COLOR_BOLDGRAY ".security"
|
|
|
|
COLOR_OFF "\">\n");
|
|
|
|
display("\twhere '.security' is [.psk | .8021x | "
|
|
|
|
".open]\n");
|
2017-04-26 03:13:59 +02:00
|
|
|
}
|
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
l_queue_destroy(match, NULL);
|
2019-04-11 00:58:17 +02:00
|
|
|
return NULL;
|
2017-04-26 03:13:59 +02:00
|
|
|
}
|
|
|
|
|
2019-04-11 00:58:17 +02:00
|
|
|
proxy = l_queue_pop_head(match);
|
2017-04-26 03:13:59 +02:00
|
|
|
l_queue_destroy(match, NULL);
|
|
|
|
|
2019-04-11 00:58:17 +02:00
|
|
|
return proxy;
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum cmd_status cmd_forget(const char *network_name, char **argv,
|
|
|
|
int argc)
|
|
|
|
{
|
|
|
|
const struct proxy_interface *proxy =
|
|
|
|
known_network_proxy_find_by_name(network_name);
|
|
|
|
|
|
|
|
if (!proxy)
|
|
|
|
return CMD_STATUS_INVALID_ARGS;
|
|
|
|
|
|
|
|
proxy_interface_method_call(proxy, "Forget", "",
|
|
|
|
check_errors_method_callback);
|
2017-04-26 03:13:59 +02:00
|
|
|
|
2018-08-03 23:35:37 +02:00
|
|
|
return CMD_STATUS_TRIGGERED;
|
2017-04-21 20:14:53 +02:00
|
|
|
}
|
|
|
|
|
2019-04-11 00:58:18 +02:00
|
|
|
static enum cmd_status cmd_show(const char *network_name, char **argv, int argc)
|
|
|
|
{
|
|
|
|
const struct proxy_interface *proxy =
|
|
|
|
known_network_proxy_find_by_name(network_name);
|
|
|
|
|
|
|
|
if (!proxy)
|
|
|
|
return CMD_STATUS_INVALID_ARGS;
|
|
|
|
|
|
|
|
known_network_display(proxy);
|
|
|
|
|
|
|
|
return CMD_STATUS_DONE;
|
|
|
|
}
|
|
|
|
|
2019-04-11 00:58:24 +02:00
|
|
|
static void property_set_callback(struct l_dbus_message *message,
|
|
|
|
void *user_data)
|
|
|
|
{
|
|
|
|
dbus_message_has_error(message);
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum cmd_status cmd_set_property(const char *network_name,
|
|
|
|
char **argv, int argc)
|
|
|
|
{
|
|
|
|
const struct proxy_interface *proxy =
|
|
|
|
known_network_proxy_find_by_name(network_name);
|
|
|
|
|
|
|
|
if (!proxy)
|
|
|
|
return CMD_STATUS_INVALID_VALUE;
|
|
|
|
|
|
|
|
if (argc != 2)
|
|
|
|
return CMD_STATUS_INVALID_ARGS;
|
|
|
|
|
|
|
|
if (!proxy_property_set(proxy, argv[0], argv[1],
|
|
|
|
property_set_callback))
|
|
|
|
return CMD_STATUS_INVALID_VALUE;
|
|
|
|
|
|
|
|
return CMD_STATUS_TRIGGERED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *set_property_cmd_arg_completion(const char *text, int state)
|
|
|
|
{
|
|
|
|
return proxy_property_completion(known_network_properties, text, state);
|
|
|
|
}
|
|
|
|
|
2019-04-11 00:58:16 +02:00
|
|
|
static bool match_by_partial_name(const void *a, const void *b)
|
|
|
|
{
|
|
|
|
const struct known_network *network = a;
|
|
|
|
const char *text = b;
|
|
|
|
|
|
|
|
return !strncmp(network->name, text, strlen(text));
|
|
|
|
}
|
|
|
|
|
2017-04-21 20:14:53 +02:00
|
|
|
static const struct command known_networks_commands[] = {
|
|
|
|
{ NULL, "list", NULL, cmd_list, "List known networks", true },
|
2019-04-11 00:58:17 +02:00
|
|
|
{ "<\"network name\">", "forget", NULL, cmd_forget,
|
|
|
|
"Forget known network" },
|
2019-04-11 00:58:18 +02:00
|
|
|
{ "<\"network name\">", "show", NULL, cmd_show, "Show known network",
|
|
|
|
true },
|
2019-04-11 00:58:24 +02:00
|
|
|
{ "<\"network name\">", "set-property", "<name> <value>",
|
|
|
|
cmd_set_property, "Set property", false,
|
|
|
|
set_property_cmd_arg_completion },
|
2017-04-21 20:14:53 +02:00
|
|
|
{ }
|
|
|
|
};
|
2017-04-21 20:14:54 +02:00
|
|
|
static char *family_arg_completion(const char *text, int state)
|
|
|
|
{
|
2019-04-11 00:58:16 +02:00
|
|
|
static bool first_pass;
|
2017-04-21 20:14:54 +02:00
|
|
|
static size_t index;
|
|
|
|
static size_t len;
|
|
|
|
const char *cmd;
|
|
|
|
|
|
|
|
if (!state) {
|
|
|
|
index = 0;
|
|
|
|
len = strlen(text);
|
2019-04-11 00:58:16 +02:00
|
|
|
first_pass = true;
|
2017-04-21 20:14:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
while ((cmd = known_networks_commands[index].cmd)) {
|
|
|
|
if (known_networks_commands[index++].entity)
|
|
|
|
continue;
|
|
|
|
|
2019-04-11 00:58:16 +02:00
|
|
|
if (!strncmp(cmd, text, len))
|
|
|
|
return l_strdup(cmd);
|
|
|
|
}
|
2017-04-21 20:14:54 +02:00
|
|
|
|
2019-04-11 00:58:16 +02:00
|
|
|
if (first_pass) {
|
|
|
|
state = 0;
|
|
|
|
first_pass = false;
|
2017-04-21 20:14:54 +02:00
|
|
|
}
|
|
|
|
|
2019-04-11 00:58:16 +02:00
|
|
|
return proxy_property_str_completion(&known_network_interface_type,
|
|
|
|
match_by_partial_name, "Name",
|
|
|
|
text, state, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *entity_arg_completion(const char *text, int state)
|
|
|
|
{
|
|
|
|
return command_entity_arg_completion(text, state,
|
|
|
|
known_networks_commands);
|
2017-04-21 20:14:54 +02:00
|
|
|
}
|
|
|
|
|
2017-04-21 20:14:51 +02:00
|
|
|
static struct command_family known_networks_command_family = {
|
|
|
|
.caption = "Known Networks",
|
|
|
|
.name = "known-networks",
|
2017-04-21 20:14:53 +02:00
|
|
|
.command_list = known_networks_commands,
|
2017-04-21 20:14:54 +02:00
|
|
|
.family_arg_completion = family_arg_completion,
|
2019-04-11 00:58:16 +02:00
|
|
|
.entity_arg_completion = entity_arg_completion,
|
2017-04-21 20:14:51 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static int known_networks_command_family_init(void)
|
|
|
|
{
|
|
|
|
command_family_register(&known_networks_command_family);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void known_networks_command_family_exit(void)
|
|
|
|
{
|
|
|
|
command_family_unregister(&known_networks_command_family);
|
|
|
|
}
|
|
|
|
|
|
|
|
COMMAND_FAMILY(known_networks_command_family,
|
|
|
|
known_networks_command_family_init,
|
|
|
|
known_networks_command_family_exit)
|
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
static int known_network_interface_init(void)
|
2017-04-21 20:14:51 +02:00
|
|
|
{
|
2018-07-31 16:37:10 +02:00
|
|
|
proxy_interface_type_register(&known_network_interface_type);
|
2017-04-21 20:14:51 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
static void known_network_interface_exit(void)
|
2017-04-21 20:14:51 +02:00
|
|
|
{
|
2018-07-31 16:37:10 +02:00
|
|
|
proxy_interface_type_unregister(&known_network_interface_type);
|
2017-04-21 20:14:51 +02:00
|
|
|
}
|
|
|
|
|
2018-07-31 16:37:10 +02:00
|
|
|
INTERFACE_TYPE(known_network_interface_type, known_network_interface_init,
|
|
|
|
known_network_interface_exit)
|