From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 2/8] netdev: add netdev_get_all_stations
Date: Wed, 20 Jan 2021 10:30:30 -0800 [thread overview]
Message-ID: <20210120183036.477287-2-prestwoj@gmail.com> (raw)
In-Reply-To: <20210120183036.477287-1-prestwoj@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2005 bytes --]
This is a nl80211 dump version of netdev_get_station aimed at
AP mode. This will dump all stations, parse into
netdev_station_info structs, and call the callback for each
individual station found. Once the dump is completed the destroy
callback is called.
---
src/netdev.c | 26 ++++++++++++++++++++++++++
src/netdev.h | 2 ++
2 files changed, 28 insertions(+)
diff --git a/src/netdev.c b/src/netdev.c
index 0fc0600a..e3ce270a 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -4240,6 +4240,32 @@ int netdev_get_current_station(struct netdev *netdev,
user_data, destroy);
}
+int netdev_get_all_stations(struct netdev *netdev, netdev_get_station_cb_t cb,
+ void *user_data, netdev_destroy_func_t destroy)
+{
+ struct l_genl_msg *msg;
+
+ if (netdev->get_station_cmd_id)
+ return -EBUSY;
+
+ msg = l_genl_msg_new_sized(NL80211_CMD_GET_STATION, 64);
+ l_genl_msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &netdev->index);
+
+ netdev->get_station_cmd_id = l_genl_family_dump(nl80211, msg,
+ netdev_get_station_cb, netdev,
+ netdev_get_station_destroy);
+ if (!netdev->get_station_cmd_id) {
+ l_genl_msg_unref(msg);
+ return -EIO;
+ }
+
+ netdev->get_station_cb = cb;
+ netdev->get_station_data = user_data;
+ netdev->get_station_destroy = destroy;
+
+ return 0;
+}
+
static int netdev_cqm_rssi_update(struct netdev *netdev)
{
struct l_genl_msg *msg;
diff --git a/src/netdev.h b/src/netdev.h
index 074dc61f..e7a1c060 100644
--- a/src/netdev.h
+++ b/src/netdev.h
@@ -211,6 +211,8 @@ int netdev_get_station(struct netdev *netdev, const uint8_t *mac,
int netdev_get_current_station(struct netdev *netdev,
netdev_get_station_cb_t cb, void *user_data,
netdev_destroy_func_t destroy);
+int netdev_get_all_stations(struct netdev *netdev, netdev_get_station_cb_t cb,
+ void *user_data, netdev_destroy_func_t destroy);
void netdev_handshake_failed(struct handshake_state *hs, uint16_t reason_code);
--
2.26.2
next prev parent reply other threads:[~2021-01-20 18:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-20 18:30 [PATCH 1/8] doc: document AccessPointDiagnostic interface James Prestwood
2021-01-20 18:30 ` James Prestwood [this message]
2021-01-20 20:06 ` [PATCH 2/8] netdev: add netdev_get_all_stations Denis Kenzior
2021-01-20 18:30 ` [PATCH 3/8] dbus: add AccessPointDiagnostic interface James Prestwood
2021-01-20 18:30 ` [PATCH 4/8] ap: add AP diagnostic interface James Prestwood
2021-01-20 20:11 ` Denis Kenzior
2021-01-20 18:30 ` [PATCH 5/8] client: add AccessPointDiagnostic interface definition James Prestwood
2021-01-20 20:14 ` Denis Kenzior
2021-01-20 18:30 ` [PATCH 6/8] client: implement "ap <wlan> show" James Prestwood
2021-01-20 20:16 ` Denis Kenzior
2021-01-20 20:36 ` James Prestwood
2021-01-20 18:30 ` [PATCH 7/8] test: add AccessPointDiagnostics to monitor-iwd James Prestwood
2021-01-20 18:30 ` [PATCH 8/8] test: add StationDiagnostic interface " James Prestwood
2021-01-20 20:00 ` [PATCH 1/8] doc: document AccessPointDiagnostic interface Denis Kenzior
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=20210120183036.477287-2-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.01.org \
/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