* [PATCH 1/3] client: Add shared code DBus interface
@ 2023-11-09 18:49 James Prestwood
2023-11-09 18:49 ` [PATCH 2/3] client: add helper to call method via builder James Prestwood
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: James Prestwood @ 2023-11-09 18:49 UTC (permalink / raw)
To: iwd; +Cc: James Prestwood
---
client/dbus-proxy.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/client/dbus-proxy.h b/client/dbus-proxy.h
index 0b4fec43..cd1b2305 100644
--- a/client/dbus-proxy.h
+++ b/client/dbus-proxy.h
@@ -2,7 +2,7 @@
*
* Wireless daemon for Linux
*
- * Copyright (C) 2017-2019 Intel Corporation. All rights reserved.
+ * Copyright (C) 2017-2013 Intel Corporation. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -38,6 +38,8 @@ struct proxy_interface;
#define IWD_AP_DIAGNOSTIC_INTERFACE "net.connman.iwd.AccessPointDiagnostic"
#define IWD_DAEMON_INTERFACE "net.connman.iwd.Daemon"
#define IWD_DPP_INTERFACE "net.connman.iwd.DeviceProvisioning"
+#define IWD_DPP_PKEX_INTERFACE \
+ "net.connman.iwd.SharedCodeDeviceProvisioning"
typedef bool (*proxy_property_match_func_t) (const void *a, const void *b);
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] client: add helper to call method via builder
2023-11-09 18:49 [PATCH 1/3] client: Add shared code DBus interface James Prestwood
@ 2023-11-09 18:49 ` James Prestwood
2023-11-10 2:22 ` Denis Kenzior
2023-11-09 18:49 ` [PATCH 3/3] client: add client commands for shared code configuration James Prestwood
2023-11-10 2:17 ` [PATCH 1/3] client: Add shared code DBus interface Denis Kenzior
2 siblings, 1 reply; 8+ messages in thread
From: James Prestwood @ 2023-11-09 18:49 UTC (permalink / raw)
To: iwd; +Cc: James Prestwood
There was no way to call a method with anything except basic
arguments. Add a helper to use a builder to create more complex
args.
---
client/dbus-proxy.c | 36 +++++++++++++++++++++++++++++++++++-
client/dbus-proxy.h | 9 +++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
index 42b8427f..de252427 100644
--- a/client/dbus-proxy.c
+++ b/client/dbus-proxy.c
@@ -2,7 +2,7 @@
*
* Wireless daemon for Linux
*
- * Copyright (C) 2017-2020 Intel Corporation. All rights reserved.
+ * Copyright (C) 2017-2023 Intel Corporation. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -629,6 +629,40 @@ bool proxy_interface_method_call(const struct proxy_interface *proxy,
return true;
}
+struct l_dbus_message_builder *proxy_interface_new_builder(
+ const struct proxy_interface *proxy,
+ const char *name)
+{
+ struct l_dbus_message *call = l_dbus_message_new_method_call(dbus,
+ IWD_SERVICE, proxy->path,
+ proxy->type->interface, name);
+
+ return l_dbus_message_builder_new(call);
+}
+
+bool proxy_interface_method_call_from_builder(
+ const struct proxy_interface *proxy,
+ struct l_dbus_message_builder *builder,
+ l_dbus_message_func_t callback)
+{
+ struct proxy_callback_data *callback_data;
+ struct l_dbus_message *call;
+
+ if (!proxy || !builder)
+ return false;
+
+ call = l_dbus_message_builder_finalize(builder);
+
+ callback_data = l_new(struct proxy_callback_data, 1);
+ callback_data->callback = callback;
+ callback_data->user_data = (void *) proxy;
+
+ l_dbus_send_with_reply(dbus, call, proxy_callback, callback_data,
+ l_free);
+
+ return true;
+}
+
void *proxy_interface_get_data(const struct proxy_interface *proxy)
{
return proxy->data;
diff --git a/client/dbus-proxy.h b/client/dbus-proxy.h
index cd1b2305..94625b85 100644
--- a/client/dbus-proxy.h
+++ b/client/dbus-proxy.h
@@ -90,6 +90,15 @@ bool proxy_interface_method_call(const struct proxy_interface *proxy,
const char *name, const char *signature,
l_dbus_message_func_t callback, ...);
+bool proxy_interface_method_call_from_builder(
+ const struct proxy_interface *proxy,
+ struct l_dbus_message_builder *builder,
+ l_dbus_message_func_t callback);
+
+struct l_dbus_message_builder *proxy_interface_new_builder(
+ const struct proxy_interface *proxy,
+ const char *name);
+
void proxy_properties_display(const struct proxy_interface *proxy,
const char *caption, const char *margin,
unsigned int name_column_width,
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] client: add client commands for shared code configuration
2023-11-09 18:49 [PATCH 1/3] client: Add shared code DBus interface James Prestwood
2023-11-09 18:49 ` [PATCH 2/3] client: add helper to call method via builder James Prestwood
@ 2023-11-09 18:49 ` James Prestwood
2023-11-10 2:31 ` Denis Kenzior
2023-11-10 2:17 ` [PATCH 1/3] client: Add shared code DBus interface Denis Kenzior
2 siblings, 1 reply; 8+ messages in thread
From: James Prestwood @ 2023-11-09 18:49 UTC (permalink / raw)
To: iwd; +Cc: James Prestwood
The StartConfigurator() call was left out since there would be no
functional difference to the user in iwctl. Its expected that
human users of the shared code API provide the code/id ahead of
time, i.e. use ConfigureEnrollee/StartEnrollee.
---
Makefile.am | 3 +-
client/dpp-pkex.c | 342 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 344 insertions(+), 1 deletion(-)
create mode 100644 client/dpp-pkex.c
diff --git a/Makefile.am b/Makefile.am
index 2e962153..d0247faf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -314,7 +314,8 @@ client_iwctl_SOURCES = client/main.c \
client/wsc.c client/station.c \
client/diagnostic.c client/diagnostic.h \
client/daemon.c client/daemon.h \
- client/dpp.c client/station-debug.c \
+ client/dpp.c client/dpp-pkex.c \
+ client/station-debug.c \
src/util.c src/util.h \
src/band.c src/band.h
diff --git a/client/dpp-pkex.c b/client/dpp-pkex.c
new file mode 100644
index 00000000..7a6934e1
--- /dev/null
+++ b/client/dpp-pkex.c
@@ -0,0 +1,342 @@
+/*
+ *
+ * Wireless daemon for Linux
+ *
+ * Copyright (C) 2023 Intel Corporation. All rights reserved.
+ *
+ * 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 <stdio.h>
+#include <linux/limits.h>
+
+#include <ell/ell.h>
+
+#include "client/command.h"
+#include "client/dbus-proxy.h"
+#include "client/device.h"
+#include "client/display.h"
+#include "src/util.h"
+
+struct pkex {
+ bool started;
+ char *role;
+};
+
+static void *pkex_create(void)
+{
+ return l_new(struct pkex, 1);
+}
+
+static void pkex_destroy(void *data)
+{
+ struct pkex *pkex = data;
+
+ l_free(pkex->role);
+ l_free(pkex);
+}
+
+static void display_pkex_inline(const char *margin, const void *data)
+{
+ const struct proxy_interface *pkex_i = data;
+ struct proxy_interface *device_i =
+ proxy_interface_find(IWD_DEVICE_INTERFACE,
+ proxy_interface_get_path(pkex_i));
+ const char *identity;
+
+ if (!device_i)
+ return;
+
+ identity = proxy_interface_get_identity_str(device_i);
+ if (!identity)
+ return;
+
+ display("%s%-*s\n", margin, 20, identity);
+}
+
+static void check_errors_method_callback(struct l_dbus_message *message,
+ void *user_data)
+{
+ dbus_message_has_error(message);
+}
+
+static enum cmd_status cmd_list(const char *device_name, char **argv, int argc)
+{
+ const struct l_queue_entry *entry;
+ struct l_queue *match =
+ proxy_interface_find_all(IWD_DPP_PKEX_INTERFACE, NULL, NULL);
+
+ display_table_header("DPP-PKEX-capable Devices",
+ MARGIN "%-*s", 20, "Name");
+
+ if (!match) {
+ display("No DPP-PKEX-capable devices available\n");
+ display_table_footer();
+
+ return CMD_STATUS_DONE;
+ }
+
+ for (entry = l_queue_get_entries(match); entry; entry = entry->next) {
+ const struct proxy_interface *pkex = entry->data;
+ display_pkex_inline(MARGIN, pkex);
+ }
+
+ display_table_footer();
+
+ l_queue_destroy(match, NULL);
+
+ return CMD_STATUS_DONE;
+}
+
+static bool append_dict_basic(struct l_dbus_message_builder *builder,
+ const char *name, char type,
+ const void *data)
+{
+ char strtype[] = { type, '\0' };
+
+ if (!l_dbus_message_builder_enter_dict(builder, "sv"))
+ return false;
+ if (!l_dbus_message_builder_append_basic(builder, 's', name))
+ return false;
+ if (!l_dbus_message_builder_enter_variant(builder, strtype))
+ return false;
+ if (!l_dbus_message_builder_append_basic(builder, type, data))
+ return false;
+ if (!l_dbus_message_builder_leave_variant(builder))
+ return false;
+ if (!l_dbus_message_builder_leave_dict(builder))
+ return false;
+
+ return true;
+}
+
+static enum cmd_status cmd_enroll_or_configure(const char *device_name,
+ char **argv, int argc,
+ const char *method)
+{
+ struct l_dbus_message_builder *builder;
+ const struct proxy_interface *pkex;
+ const char *key;
+ const char *id = NULL;
+
+ pkex = device_proxy_find(device_name, IWD_DPP_PKEX_INTERFACE);
+ if (!pkex) {
+ display("No pkex pkex on device: '%s'\n", device_name);
+ return CMD_STATUS_INVALID_VALUE;
+ }
+
+ if (argc < 1)
+ return CMD_STATUS_INVALID_ARGS;
+
+ key = argv[0];
+
+ if (argc > 1)
+ id = argv[1];
+
+ builder = proxy_interface_new_builder(pkex, method);
+
+ l_dbus_message_builder_enter_array(builder, "{sv}");
+
+ append_dict_basic(builder, "Code", 's', key);
+
+ if (id)
+ append_dict_basic(builder, "Identifier", 's', id);
+
+ l_dbus_message_builder_leave_array(builder);
+
+ proxy_interface_method_call_from_builder(pkex, builder,
+ check_errors_method_callback);
+ l_dbus_message_builder_destroy(builder);
+
+ return CMD_STATUS_TRIGGERED;
+}
+
+static enum cmd_status cmd_enroll(const char *device_name,
+ char **argv, int argc)
+{
+ return cmd_enroll_or_configure(device_name, argv, argc,
+ "StartEnrollee");
+}
+
+static enum cmd_status cmd_configure(const char *device_name,
+ char **argv, int argc)
+{
+ return cmd_enroll_or_configure(device_name, argv, argc,
+ "ConfigureEnrollee");
+}
+
+static enum cmd_status cmd_stop(const char *device_name, char **argv, int argc)
+{
+ const struct proxy_interface *pkex_i =
+ device_proxy_find(device_name, IWD_DPP_PKEX_INTERFACE);
+
+ if (!pkex_i) {
+ display("No pkex on device: '%s'\n", device_name);
+ return CMD_STATUS_INVALID_VALUE;
+ }
+
+ proxy_interface_method_call(pkex_i, "Stop", "",
+ check_errors_method_callback);
+
+ return CMD_STATUS_TRIGGERED;
+}
+
+static enum cmd_status cmd_show(const char *device_name,
+ char **argv, int argc)
+{
+ const struct proxy_interface *proxy =
+ device_proxy_find(device_name, IWD_DPP_PKEX_INTERFACE);
+ char *caption = l_strdup_printf("%s: %s", "DPP-PKEX", device_name);
+
+ if (!proxy) {
+ display("No DPP-PKEX interface on device: '%s'\n", device_name);
+ return CMD_STATUS_INVALID_VALUE;
+ }
+
+ proxy_properties_display(proxy, caption, MARGIN, 20, 47);
+ l_free(caption);
+
+ display_table_footer();
+
+ return CMD_STATUS_DONE;
+}
+
+static const struct command pkex_commands[] = {
+ { NULL, "list", NULL, cmd_list,
+ "List shared code capable devices", true },
+ { "<wlan>", "stop", NULL, cmd_stop, "Aborts shared code operations" },
+ { "<wlan>", "show", NULL, cmd_show,
+ "Shows the shared code state", true },
+ { "<wlan>", "enroll", "key [identifier]",
+ cmd_enroll, "Start a shared code enrollee"},
+ { "<wlan>", "configure", "key [identifier]",
+ cmd_configure,
+ "Start a shared code configurator"},
+ { }
+};
+
+static char *family_arg_completion(const char *text, int state)
+{
+ return device_arg_completion(text, state, pkex_commands,
+ IWD_DPP_PKEX_INTERFACE);
+}
+
+static char *entity_arg_completion(const char *text, int state)
+{
+ return command_entity_arg_completion(text, state, pkex_commands);
+}
+
+static void update_started(void *data, struct l_dbus_message_iter *variant)
+{
+ struct pkex *pkex = data;
+ bool value;
+
+ if (!l_dbus_message_iter_get_variant(variant, "b", &value)) {
+ pkex->started = false;
+ return;
+ }
+
+ pkex->started = value;
+}
+
+static const char *started_tostr(const void *data)
+{
+ const struct pkex *pkex = data;
+
+ return pkex->started ? "yes" : "no";
+}
+
+static void update_role(void *data, struct l_dbus_message_iter *variant)
+{
+ struct pkex *pkex = data;
+ const char *value;
+
+ if (pkex->role)
+ l_free(pkex->role);
+
+ if (!l_dbus_message_iter_get_variant(variant, "s", &value)) {
+ pkex->role = NULL;
+ return;
+ }
+
+ pkex->role = l_strdup(value);
+}
+
+static const char *role_tostr(const void *data)
+{
+ const struct pkex *pkex = data;
+
+ return pkex->role;
+}
+
+static const struct proxy_interface_property pkex_properties[] = {
+ { "Started", "b", update_started, started_tostr },
+ { "Role", "s", update_role, role_tostr },
+ { }
+};
+
+static const struct proxy_interface_type_ops pkex_ops = {
+ .create = pkex_create,
+ .destroy = pkex_destroy,
+};
+
+static struct proxy_interface_type pkex_interface_type = {
+ .interface = IWD_DPP_PKEX_INTERFACE,
+ .properties = pkex_properties,
+ .ops = &pkex_ops,
+};
+
+
+static struct command_family pkex_command_family = {
+ .caption = "Shared Code Device Provisioning (PKEX)",
+ .name = "pkex",
+ .command_list = pkex_commands,
+ .family_arg_completion = family_arg_completion,
+ .entity_arg_completion = entity_arg_completion,
+};
+
+static int pkex_command_family_init(void)
+{
+ command_family_register(&pkex_command_family);
+
+ return 0;
+}
+
+static void pkex_command_family_exit(void)
+{
+ command_family_unregister(&pkex_command_family);
+}
+
+COMMAND_FAMILY(pkex_command_family, pkex_command_family_init,
+ pkex_command_family_exit)
+
+static int pkex_interface_init(void)
+{
+ proxy_interface_type_register(&pkex_interface_type);
+
+ return 0;
+}
+
+static void pkex_interface_exit(void)
+{
+ proxy_interface_type_unregister(&pkex_interface_type);
+}
+
+INTERFACE_TYPE(pkex_interface_type, pkex_interface_init, pkex_interface_exit)
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] client: Add shared code DBus interface
2023-11-09 18:49 [PATCH 1/3] client: Add shared code DBus interface James Prestwood
2023-11-09 18:49 ` [PATCH 2/3] client: add helper to call method via builder James Prestwood
2023-11-09 18:49 ` [PATCH 3/3] client: add client commands for shared code configuration James Prestwood
@ 2023-11-10 2:17 ` Denis Kenzior
2 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2023-11-10 2:17 UTC (permalink / raw)
To: James Prestwood, iwd
Hi James,
On 11/9/23 12:49, James Prestwood wrote:
> ---
> client/dbus-proxy.h | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/client/dbus-proxy.h b/client/dbus-proxy.h
> index 0b4fec43..cd1b2305 100644
> --- a/client/dbus-proxy.h
> +++ b/client/dbus-proxy.h
> @@ -2,7 +2,7 @@
> *
> * Wireless daemon for Linux
> *
> - * Copyright (C) 2017-2019 Intel Corporation. All rights reserved.
> + * Copyright (C) 2017-2013 Intel Corporation. All rights reserved.
Uh?
> *
> * This library is free software; you can redistribute it and/or
> * modify it under the terms of the GNU Lesser General Public
Regards,
-Denis
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] client: add helper to call method via builder
2023-11-09 18:49 ` [PATCH 2/3] client: add helper to call method via builder James Prestwood
@ 2023-11-10 2:22 ` Denis Kenzior
2023-11-10 12:28 ` James Prestwood
0 siblings, 1 reply; 8+ messages in thread
From: Denis Kenzior @ 2023-11-10 2:22 UTC (permalink / raw)
To: James Prestwood, iwd
Hi James,
On 11/9/23 12:49, James Prestwood wrote:
> There was no way to call a method with anything except basic
> arguments. Add a helper to use a builder to create more complex
> args.
> ---
> client/dbus-proxy.c | 36 +++++++++++++++++++++++++++++++++++-
> client/dbus-proxy.h | 9 +++++++++
> 2 files changed, 44 insertions(+), 1 deletion(-)
>
> diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
> index 42b8427f..de252427 100644
> --- a/client/dbus-proxy.c
> +++ b/client/dbus-proxy.c
> @@ -2,7 +2,7 @@
> *
> * Wireless daemon for Linux
> *
> - * Copyright (C) 2017-2020 Intel Corporation. All rights reserved.
> + * Copyright (C) 2017-2023 Intel Corporation. All rights reserved.
Is this correct?
> *
> * This library is free software; you can redistribute it and/or
> * modify it under the terms of the GNU Lesser General Public
> @@ -629,6 +629,40 @@ bool proxy_interface_method_call(const struct proxy_interface *proxy,
> return true;
> }
>
> +struct l_dbus_message_builder *proxy_interface_new_builder(
> + const struct proxy_interface *proxy,
> + const char *name)
> +{
> + struct l_dbus_message *call = l_dbus_message_new_method_call(dbus,
> + IWD_SERVICE, proxy->path,
> + proxy->type->interface, name);
> +
> + return l_dbus_message_builder_new(call);
Do you really need this 2 line function for a single call site?
> +}
> +
> +bool proxy_interface_method_call_from_builder(
> + const struct proxy_interface *proxy,
> + struct l_dbus_message_builder *builder,
> + l_dbus_message_func_t callback)
> +{
> + struct proxy_callback_data *callback_data;
> + struct l_dbus_message *call;
> +
> + if (!proxy || !builder)
> + return false;
> +
> + call = l_dbus_message_builder_finalize(builder);
> +
> + callback_data = l_new(struct proxy_callback_data, 1);
> + callback_data->callback = callback;
> + callback_data->user_data = (void *) proxy;
> +
> + l_dbus_send_with_reply(dbus, call, proxy_callback, callback_data,
> + l_free);
> +
> + return true;
> +}
> +
> void *proxy_interface_get_data(const struct proxy_interface *proxy)
> {
> return proxy->data;
Regards,
-Denis
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] client: add client commands for shared code configuration
2023-11-09 18:49 ` [PATCH 3/3] client: add client commands for shared code configuration James Prestwood
@ 2023-11-10 2:31 ` Denis Kenzior
0 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2023-11-10 2:31 UTC (permalink / raw)
To: James Prestwood, iwd
Hi James,
On 11/9/23 12:49, James Prestwood wrote:
> The StartConfigurator() call was left out since there would be no
> functional difference to the user in iwctl. Its expected that
> human users of the shared code API provide the code/id ahead of
> time, i.e. use ConfigureEnrollee/StartEnrollee.
> ---
> Makefile.am | 3 +-
> client/dpp-pkex.c | 342 ++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 344 insertions(+), 1 deletion(-)
> create mode 100644 client/dpp-pkex.c
>
<snip>
> diff --git a/client/dpp-pkex.c b/client/dpp-pkex.c
> new file mode 100644
> index 00000000..7a6934e1
> --- /dev/null
> +++ b/client/dpp-pkex.c
> @@ -0,0 +1,342 @@
> +/*
> + *
> + * Wireless daemon for Linux
> + *
> + * Copyright (C) 2023 Intel Corporation. All rights reserved.
> + *
This looks incorrect. Copy-paste?
> + * 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
> + *
> + */
> +
<snip>
> +static enum cmd_status cmd_enroll_or_configure(const char *device_name,
> + char **argv, int argc,
> + const char *method)
> +{
> + struct l_dbus_message_builder *builder;
> + const struct proxy_interface *pkex;
> + const char *key;
> + const char *id = NULL;
> +
> + pkex = device_proxy_find(device_name, IWD_DPP_PKEX_INTERFACE);
> + if (!pkex) {
> + display("No pkex pkex on device: '%s'\n", device_name);
> + return CMD_STATUS_INVALID_VALUE;
> + }
> +
> + if (argc < 1)
> + return CMD_STATUS_INVALID_ARGS;
> +
> + key = argv[0];
> +
> + if (argc > 1)
> + id = argv[1];
> +
> + builder = proxy_interface_new_builder(pkex, method);
> +
> + l_dbus_message_builder_enter_array(builder, "{sv}");
> +
> + append_dict_basic(builder, "Code", 's', key);
> +
> + if (id)
> + append_dict_basic(builder, "Identifier", 's', id);
> +
> + l_dbus_message_builder_leave_array(builder);
This can all be done as:
l_dbus_message_set_arguments(msg, "a{sv}", 2,
"Code", "s", key,
"Identifier", "s", id);
> +
> + proxy_interface_method_call_from_builder(pkex, builder,
> + check_errors_method_callback);
> + l_dbus_message_builder_destroy(builder);
> +
> + return CMD_STATUS_TRIGGERED;
> +}
> +
Regards,
-Denis
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] client: add helper to call method via builder
2023-11-10 2:22 ` Denis Kenzior
@ 2023-11-10 12:28 ` James Prestwood
2023-11-10 12:59 ` James Prestwood
0 siblings, 1 reply; 8+ messages in thread
From: James Prestwood @ 2023-11-10 12:28 UTC (permalink / raw)
To: Denis Kenzior, iwd
Hi Denis,
On 11/9/23 6:22 PM, Denis Kenzior wrote:
> Hi James,
>
> On 11/9/23 12:49, James Prestwood wrote:
>> There was no way to call a method with anything except basic
>> arguments. Add a helper to use a builder to create more complex
>> args.
>> ---
>> client/dbus-proxy.c | 36 +++++++++++++++++++++++++++++++++++-
>> client/dbus-proxy.h | 9 +++++++++
>> 2 files changed, 44 insertions(+), 1 deletion(-)
>>
>> diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
>> index 42b8427f..de252427 100644
>> --- a/client/dbus-proxy.c
>> +++ b/client/dbus-proxy.c
>> @@ -2,7 +2,7 @@
>> *
>> * Wireless daemon for Linux
>> *
>> - * Copyright (C) 2017-2020 Intel Corporation. All rights reserved.
>> + * Copyright (C) 2017-2023 Intel Corporation. All rights reserved.
>
> Is this correct?
I'm generally terrible about updating the dates on the copyright and
really never do it. Decided I'd try and do better this time :)
But I'm not actually sure how this works. Should there be multiple
copyright notices if different companies touch existing files? or should
we just leave the copyrights as-is if the file already exists.
>
>> *
>> * This library is free software; you can redistribute it and/or
>> * modify it under the terms of the GNU Lesser General Public
>> @@ -629,6 +629,40 @@ bool proxy_interface_method_call(const struct
>> proxy_interface *proxy,
>> return true;
>> }
>> +struct l_dbus_message_builder *proxy_interface_new_builder(
>> + const struct proxy_interface *proxy,
>> + const char *name)
>> +{
>> + struct l_dbus_message *call = l_dbus_message_new_method_call(dbus,
>> + IWD_SERVICE, proxy->path,
>> + proxy->type->interface, name);
>> +
>> + return l_dbus_message_builder_new(call);
>
> Do you really need this 2 line function for a single call site?
With knowledge that l_dbus_message_set_arguments can handle dictionaries
I don't need this patch at all :)
>
>> +}
>> +
>> +bool proxy_interface_method_call_from_builder(
>> + const struct proxy_interface *proxy,
>> + struct l_dbus_message_builder *builder,
>> + l_dbus_message_func_t callback)
>> +{
>> + struct proxy_callback_data *callback_data;
>> + struct l_dbus_message *call;
>> +
>> + if (!proxy || !builder)
>> + return false;
>> +
>> + call = l_dbus_message_builder_finalize(builder);
>> +
>> + callback_data = l_new(struct proxy_callback_data, 1);
>> + callback_data->callback = callback;
>> + callback_data->user_data = (void *) proxy;
>> +
>> + l_dbus_send_with_reply(dbus, call, proxy_callback, callback_data,
>> + l_free);
>> +
>> + return true;
>> +}
>> +
>> void *proxy_interface_get_data(const struct proxy_interface *proxy)
>> {
>> return proxy->data;
>
> Regards,
> -Denis
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] client: add helper to call method via builder
2023-11-10 12:28 ` James Prestwood
@ 2023-11-10 12:59 ` James Prestwood
0 siblings, 0 replies; 8+ messages in thread
From: James Prestwood @ 2023-11-10 12:59 UTC (permalink / raw)
To: Denis Kenzior, iwd
Hi Denis,
On 11/10/23 4:28 AM, James Prestwood wrote:
> Hi Denis,
>
> On 11/9/23 6:22 PM, Denis Kenzior wrote:
>> Hi James,
>>
>> On 11/9/23 12:49, James Prestwood wrote:
>>> There was no way to call a method with anything except basic
>>> arguments. Add a helper to use a builder to create more complex
>>> args.
>>> ---
>>> client/dbus-proxy.c | 36 +++++++++++++++++++++++++++++++++++-
>>> client/dbus-proxy.h | 9 +++++++++
>>> 2 files changed, 44 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
>>> index 42b8427f..de252427 100644
>>> --- a/client/dbus-proxy.c
>>> +++ b/client/dbus-proxy.c
>>> @@ -2,7 +2,7 @@
>>> *
>>> * Wireless daemon for Linux
>>> *
>>> - * Copyright (C) 2017-2020 Intel Corporation. All rights reserved.
>>> + * Copyright (C) 2017-2023 Intel Corporation. All rights reserved.
>>
>> Is this correct?
>
> I'm generally terrible about updating the dates on the copyright and
> really never do it. Decided I'd try and do better this time :)
>
> But I'm not actually sure how this works. Should there be multiple
> copyright notices if different companies touch existing files? or should
> we just leave the copyrights as-is if the file already exists.
Nevermind, took a look at the kernel and they just append the
companies/dates. It had been so long at Intel I forgot how all this
worked :)
Thanks,
James
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-11-10 12:59 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-09 18:49 [PATCH 1/3] client: Add shared code DBus interface James Prestwood
2023-11-09 18:49 ` [PATCH 2/3] client: add helper to call method via builder James Prestwood
2023-11-10 2:22 ` Denis Kenzior
2023-11-10 12:28 ` James Prestwood
2023-11-10 12:59 ` James Prestwood
2023-11-09 18:49 ` [PATCH 3/3] client: add client commands for shared code configuration James Prestwood
2023-11-10 2:31 ` Denis Kenzior
2023-11-10 2:17 ` [PATCH 1/3] client: Add shared code DBus interface Denis Kenzior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox