* [PATCH BlueZ] mesh: Implement remote dev key methods for keyring
@ 2019-05-22 23:54 Brian Gix
0 siblings, 0 replies; only message in thread
From: Brian Gix @ 2019-05-22 23:54 UTC (permalink / raw)
To: linux-bluetooth; +Cc: inga.stotland, brian.gix
Affected methods:
ImportRemoteNode()
DeleteRemoteNode()
---
mesh/manager.c | 38 +++++++++++++++++++++++++++++++++++---
1 file changed, 35 insertions(+), 3 deletions(-)
diff --git a/mesh/manager.c b/mesh/manager.c
index 41d4e9cc6..dee66b2cb 100644
--- a/mesh/manager.c
+++ b/mesh/manager.c
@@ -54,18 +54,47 @@ static struct l_dbus_message *add_node_call(struct l_dbus *dbus,
return dbus_error(msg, MESH_ERROR_NOT_IMPLEMENTED, NULL);
}
+
+static struct l_dbus_message *import_node_call(struct l_dbus *dbus,
+ struct l_dbus_message *msg,
+ void *user_data)
+{
+ struct mesh_node *node = user_data;
+ struct l_dbus_message_iter iter_key;
+ uint16_t primary;
+ uint8_t num_ele;
+ uint8_t *key;
+ uint32_t n;
+
+ if (!l_dbus_message_get_arguments(msg, "qyay", &primary, &num_ele,
+ &iter_key))
+ return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
+
+ if (!l_dbus_message_iter_get_fixed_array(&iter_key, &key, &n)
+ || n != 16)
+ return dbus_error(msg, MESH_ERROR_INVALID_ARGS,
+ "Bad device key");
+
+ if (!keyring_put_remote_dev_key(node, primary, num_ele, key))
+ return dbus_error(msg, MESH_ERROR_FAILED, NULL);
+
+ return l_dbus_message_new_method_return(msg);
+}
+
static struct l_dbus_message *delete_node_call(struct l_dbus *dbus,
struct l_dbus_message *msg,
void *user_data)
{
+ struct mesh_node *node = user_data;
uint16_t primary;
uint8_t num_ele;
if (!l_dbus_message_get_arguments(msg, "qy", &primary, &num_ele))
return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
- /* TODO */
- return dbus_error(msg, MESH_ERROR_NOT_IMPLEMENTED, NULL);
+ keyring_del_remote_dev_key(node, primary, num_ele);
+
+ return l_dbus_message_new_method_return(msg);
}
static struct l_dbus_message *start_scan_call(struct l_dbus *dbus,
@@ -388,7 +417,10 @@ static void setup_management_interface(struct l_dbus_interface *iface)
{
l_dbus_interface_method(iface, "AddNode", 0, add_node_call, "", "ay",
"", "uuid");
- l_dbus_interface_method(iface, "DeleteRemodeNode", 0, delete_node_call,
+ l_dbus_interface_method(iface, "ImportRemoteNode", 0, import_node_call,
+ "", "qyay", "", "primary",
+ "count", "dev_key");
+ l_dbus_interface_method(iface, "DeleteRemoteNode", 0, delete_node_call,
"", "qy", "", "primary", "count");
l_dbus_interface_method(iface, "UnprovisionedScan", 0, start_scan_call,
"", "q", "", "seconds");
--
2.14.5
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-05-22 23:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 23:54 [PATCH BlueZ] mesh: Implement remote dev key methods for keyring Brian Gix
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).