mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-21 22:09:23 +01:00
client: Add BasicServiceSets property to network
The property itself is an array of paths, but this is difficult to fit nicely within a terminal. Instead just display the count of BSS's. Displaying a detailed list of BSS's will be done via a separate command.
This commit is contained in:
parent
0e3322b5da
commit
05166d0999
@ -35,6 +35,7 @@ struct network {
|
|||||||
char *identity;
|
char *identity;
|
||||||
char *name;
|
char *name;
|
||||||
char *type;
|
char *type;
|
||||||
|
struct l_queue *bss_list;
|
||||||
const struct proxy_interface *device;
|
const struct proxy_interface *device;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -146,11 +147,58 @@ static void update_type(void *data, struct l_dbus_message_iter *variant)
|
|||||||
network->type = l_strdup(value);
|
network->type = l_strdup(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool match_path(const void *a, const void *user_data)
|
||||||
|
{
|
||||||
|
const char *path1 = a;
|
||||||
|
const char *path2 = user_data;
|
||||||
|
|
||||||
|
return !strcmp(path1, path2);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void update_ess(void *data, struct l_dbus_message_iter *variant)
|
||||||
|
{
|
||||||
|
struct network *network = data;
|
||||||
|
struct l_dbus_message_iter array;
|
||||||
|
const char *path;
|
||||||
|
|
||||||
|
if (!network->bss_list)
|
||||||
|
network->bss_list = l_queue_new();
|
||||||
|
|
||||||
|
if (!l_dbus_message_iter_get_variant(variant, "ao", &array))
|
||||||
|
return;
|
||||||
|
|
||||||
|
while (l_dbus_message_iter_next_entry(&array, &path)) {
|
||||||
|
l_free(l_queue_remove_if(network->bss_list, match_path, path));
|
||||||
|
l_queue_push_head(network->bss_list, l_strdup(path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *get_ess(const void *data)
|
||||||
|
{
|
||||||
|
const struct network *network = data;
|
||||||
|
static char count[10];
|
||||||
|
|
||||||
|
snprintf(count, 10, "Count %u", l_queue_length(network->bss_list));
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct l_queue *network_get_bss_list(
|
||||||
|
const struct proxy_interface *network_proxy)
|
||||||
|
{
|
||||||
|
const struct network *network = proxy_interface_get_data(network_proxy);
|
||||||
|
if (!network)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return network->bss_list;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct proxy_interface_property network_properties[] = {
|
static const struct proxy_interface_property network_properties[] = {
|
||||||
{ "Name", "s", update_name, get_name },
|
{ "Name", "s", update_name, get_name },
|
||||||
{ "Connected", "b", update_connected},
|
{ "Connected", "b", update_connected},
|
||||||
{ "Device", "o", update_device},
|
{ "Device", "o", update_device},
|
||||||
{ "Type", "s", update_type},
|
{ "Type", "s", update_type},
|
||||||
|
{ "ExtendedServiceSet", "ao", update_ess, get_ess },
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -186,6 +234,7 @@ static void network_destroy(void *data)
|
|||||||
l_free(network->name);
|
l_free(network->name);
|
||||||
l_free(network->type);
|
l_free(network->type);
|
||||||
l_free(network->identity);
|
l_free(network->identity);
|
||||||
|
l_queue_destroy(network->bss_list, l_free);
|
||||||
|
|
||||||
network->device = NULL;
|
network->device = NULL;
|
||||||
|
|
||||||
|
@ -37,3 +37,5 @@ char *network_name_completion(const struct proxy_interface *device,
|
|||||||
struct l_queue *network_match_by_device_and_args(
|
struct l_queue *network_match_by_device_and_args(
|
||||||
const struct proxy_interface *device,
|
const struct proxy_interface *device,
|
||||||
const struct network_args *args);
|
const struct network_args *args);
|
||||||
|
struct l_queue *network_get_bss_list(
|
||||||
|
const struct proxy_interface *network_proxy);
|
||||||
|
Loading…
Reference in New Issue
Block a user