From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v2 13/13] client: add station command "get-bsses"
Date: Thu, 8 Aug 2024 10:42:36 -0700 [thread overview]
Message-ID: <20240808174236.218750-13-prestwoj@gmail.com> (raw)
In-Reply-To: <20240808174236.218750-1-prestwoj@gmail.com>
This command will get the BasicServiceSet list for a given network.
If no network is supplied, its assumed to be the current network.
---
client/station.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/client/station.c b/client/station.c
index 58aac29e..5066a9f1 100644
--- a/client/station.c
+++ b/client/station.c
@@ -723,6 +723,55 @@ static enum cmd_status cmd_show(const char *device_name,
return CMD_STATUS_TRIGGERED;
}
+
+static enum cmd_status cmd_get_bsses(const char *device_name,
+ char **argv, int argc)
+{
+ const struct proxy_interface *station_i =
+ device_proxy_find(device_name, IWD_STATION_INTERFACE);
+ const struct station *station = proxy_interface_get_data(station_i);
+ struct l_queue *bss_list;
+ const struct l_queue_entry *e;
+ const struct proxy_interface *network_proxy;
+ char header[256];
+
+ if (argc > 0)
+ network_proxy = find_network(device_name, argv[0],
+ argc >= 2 ? argv[1] : NULL);
+ else
+ network_proxy = station->connected_network;
+
+ if (!network_proxy) {
+ display_error("Can't find network");
+ return CMD_STATUS_INVALID_ARGS;
+ }
+
+ bss_list = network_get_bss_list(network_proxy);
+ if (!bss_list) {
+ display_error("No BSS list for network");
+ return CMD_STATUS_FAILED;
+ }
+
+ sprintf(header, "%s BasicServiceSets", network_get_name(network_proxy));
+
+ proxy_properties_display_header(header, MARGIN, 10, 18);
+
+ for (e = l_queue_get_entries(bss_list); e; e = e->next) {
+ const char *path = e->data;
+ const struct proxy_interface *bss_i = proxy_interface_find(
+ IWD_BSS_INTERFACE, path);
+
+ if (!bss_i)
+ continue;
+
+ display_table_row(MARGIN, 1, strlen(path), path);
+ proxy_properties_display_inline(bss_i, MARGIN, 10, 18);
+ display_table_row(MARGIN, 1, 1, "");
+ }
+
+ return CMD_STATUS_DONE;
+}
+
static const struct command station_commands[] = {
{ NULL, "list", NULL, cmd_list, "List devices in Station mode", true },
{ "<wlan>", "connect",
@@ -747,6 +796,8 @@ static const struct command station_commands[] = {
"Get hidden APs", true },
{ "<wlan>", "scan", NULL, cmd_scan, "Scan for networks" },
{ "<wlan>", "show", NULL, cmd_show, "Show station info", true },
+ { "<wlan>", "get-bsses", "[network] [security]", cmd_get_bsses,
+ "Get BSS's for a network", true },
{ }
};
--
2.34.1
prev parent reply other threads:[~2024-08-08 17:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-08 17:42 [PATCH v2 01/13] dbus: Add net.connman.iwd.BasicServiceSet interface James Prestwood
2024-08-08 17:42 ` [PATCH v2 02/13] network: Add BasicServiceSet object James Prestwood
2024-08-08 17:42 ` [PATCH v2 03/13] station: use network_bss_{start,stop}_update James Prestwood
2024-08-08 17:42 ` [PATCH v2 04/13] network: add ExtendedServiceSet DBus property James Prestwood
2024-08-08 17:42 ` [PATCH v2 05/13] network: remove network_bss_list_clear James Prestwood
2024-08-08 17:42 ` [PATCH v2 06/13] station: add ConnectedAccessPoint property James Prestwood
2024-08-08 17:42 ` [PATCH v2 07/13] doc: document BasicServiceSet API James Prestwood
2024-08-08 17:42 ` [PATCH v2 08/13] client: separate property header and values into two functions James Prestwood
2024-08-08 17:42 ` [PATCH v2 09/13] client: add net.connman.iwd.BasicServiceSet definition James Prestwood
2024-08-08 17:42 ` [PATCH v2 10/13] client: Add BasicServiceSets property to network James Prestwood
2024-08-08 17:42 ` [PATCH v2 11/13] client: add BasicServiceSet interface James Prestwood
2024-08-08 17:42 ` [PATCH v2 12/13] client: refactor cmd_connect() and add find_network() James Prestwood
2024-08-08 17:42 ` James Prestwood [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240808174236.218750-13-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox