public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 12/14] client: add BasicServiceSet interface
Date: Wed,  7 Aug 2024 11:14:25 -0700	[thread overview]
Message-ID: <20240807181427.170515-12-prestwoj@gmail.com> (raw)
In-Reply-To: <20240807181427.170515-1-prestwoj@gmail.com>

---
 Makefile.am  |   1 +
 client/bss.c | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 111 insertions(+)
 create mode 100644 client/bss.c

diff --git a/Makefile.am b/Makefile.am
index 0c152216..d438a5ba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -319,6 +319,7 @@ client_iwctl_SOURCES = client/main.c \
 			client/daemon.c client/daemon.h \
 			client/dpp.c client/dpp-pkex.c \
 			client/station-debug.c \
+			client/bss.c \
 			src/util.c src/util.h \
 			src/band.c src/band.h
 
diff --git a/client/bss.c b/client/bss.c
new file mode 100644
index 00000000..273831a5
--- /dev/null
+++ b/client/bss.c
@@ -0,0 +1,110 @@
+/*
+ *
+ *  Wireless daemon for Linux
+ *
+ *  Copyright (C) 2024, Locus Robotics
+ *
+ *  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
+
+#include <ell/ell.h>
+#include "ell/useful.h"
+
+#include "client/dbus-proxy.h"
+#include "client/display.h"
+#include "client/bss.h"
+
+struct bss {
+	char *bssid;
+};
+
+static const char *get_bssid(const void *data)
+{
+	const struct bss *bss = data;
+
+	return bss->bssid;
+}
+
+static void update_bssid(void *data, struct l_dbus_message_iter *variant)
+{
+	struct bss *bss = data;
+	const char *value;
+
+	l_free(bss->bssid);
+
+	if (!l_dbus_message_iter_get_variant(variant, "s", &value)) {
+		bss->bssid = NULL;
+
+		return;
+	}
+
+	bss->bssid = l_strdup(value);
+}
+
+static const struct proxy_interface_property bss_properties[] = {
+	{ "Bssid",       "s", update_bssid, get_bssid },
+	{ }
+};
+
+static void *bss_create(void)
+{
+	return l_new(struct bss, 1);
+}
+
+static void bss_destroy(void *data)
+{
+	struct bss *bss = data;
+
+	l_free(bss->bssid);
+	l_free(bss);
+}
+
+static void bss_display_inline(const char *margin, const void *data)
+{
+	const struct bss *bss = data;
+
+	display("%s%s\n", margin, bss->bssid);
+}
+
+static const struct proxy_interface_type_ops ops = {
+	.create = bss_create,
+	.destroy = bss_destroy,
+	.display = bss_display_inline,
+};
+
+static struct proxy_interface_type bss_interface_type = {
+	.interface = IWD_BSS_INTERFACE,
+	.properties = bss_properties,
+	.ops = &ops,
+};
+
+static int bss_interface_init(void)
+{
+	proxy_interface_type_register(&bss_interface_type);
+
+	return 0;
+}
+
+static void bss_interface_exit(void)
+{
+	proxy_interface_type_unregister(&bss_interface_type);
+}
+
+INTERFACE_TYPE(bss_interface_type, bss_interface_init, bss_interface_exit)
-- 
2.34.1


  parent reply	other threads:[~2024-08-07 18:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-07 18:14 [PATCH 01/14] network: add network_bss_list_prune James Prestwood
2024-08-07 18:14 ` [PATCH 02/14] station: use network_bss_list_prune James Prestwood
2024-08-08 14:29   ` Denis Kenzior
2024-08-08 14:44     ` James Prestwood
2024-08-07 18:14 ` [PATCH 03/14] network: remove network_bss_list_clear James Prestwood
2024-08-07 18:14 ` [PATCH 04/14] dbus: Add net.connman.iwd.BasicServiceSet interface James Prestwood
2024-08-07 18:14 ` [PATCH 05/14] network: implement net.connman.iwd.BasicServiceSet James Prestwood
2024-08-07 18:14 ` [PATCH 06/14] network: add BasicServiceSets property on the network object James Prestwood
2024-08-07 18:14 ` [PATCH 07/14] station: add ConnectedBss property James Prestwood
2024-08-07 18:14 ` [PATCH 08/14] doc: document BasicServiceSet API James Prestwood
2024-08-08 14:42   ` Denis Kenzior
2024-08-07 18:14 ` [PATCH 09/14] client: separate property header and values into two functions James Prestwood
2024-08-07 18:14 ` [PATCH 10/14] client: add net.connman.iwd.BasicServiceSet definition James Prestwood
2024-08-07 18:14 ` [PATCH 11/14] client: Add BasicServiceSets property to network James Prestwood
2024-08-07 18:14 ` James Prestwood [this message]
2024-08-07 18:14 ` [PATCH 13/14] client: refactor cmd_connect() and add find_network() James Prestwood
2024-08-07 18:14 ` [PATCH 14/14] client: add station command "get-bsses" James Prestwood

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=20240807181427.170515-12-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