All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Gix <brian.gix@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: johan.hedberg@gmail.com, inga.stotland@intel.com,
	marcel@holtmann.org, brian.gix@intel.com
Subject: [PATCH BlueZ v3 14/30] mesh: re-arrange provisioning for DBus API
Date: Fri, 14 Dec 2018 16:26:08 -0800	[thread overview]
Message-ID: <20181215002624.9313-15-brian.gix@intel.com> (raw)
In-Reply-To: <20181215002624.9313-1-brian.gix@intel.com>

---
 mesh/prov.h      |  14 +++++--
 mesh/provision.h | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 112 insertions(+), 14 deletions(-)

diff --git a/mesh/prov.h b/mesh/prov.h
index 09fe6c3cd..61ec08e10 100644
--- a/mesh/prov.h
+++ b/mesh/prov.h
@@ -47,11 +47,17 @@ enum mesh_prov_mode {
 };
 
 struct mesh_prov;
-typedef void (*mesh_prov_open_func_t)(struct mesh_prov *prov);
-typedef void (*mesh_prov_close_func_t)(struct mesh_prov *prov, uint8_t reason);
+
+typedef void (*prov_trans_tx_t)(void *trans_data, uint8_t *data, uint16_t len);
+typedef void (*mesh_prov_open_func_t)(void *user_data, prov_trans_tx_t trans_tx,
+					void *trans_data, uint8_t trans_type);
+
+typedef void (*mesh_prov_close_func_t)(void *user_data, uint8_t reason);
 typedef void (*mesh_prov_send_func_t)(bool success, struct mesh_prov *prov);
-typedef void (*mesh_prov_receive_func_t)(const void *data, uint16_t size,
-							struct mesh_prov *prov);
+typedef void (*mesh_prov_ack_func_t)(void *user_data, uint8_t msg_num);
+typedef void (*mesh_prov_receive_func_t)(void *user_data, const uint8_t *data,
+								uint16_t size);
+
 
 struct prov_invite {
 	uint8_t attention;
diff --git a/mesh/provision.h b/mesh/provision.h
index 0c59bf037..6b61a45be 100644
--- a/mesh/provision.h
+++ b/mesh/provision.h
@@ -17,14 +17,106 @@
  *
  */
 
+
+/*
+ * size: hard define (mesh.conf - OOB_NUMBEROOB_NUMBER)
+ *      oob size - 8 if alpha or numeric
+ *	else 1 if mask is non zero
+ *	else 0
+ */
+struct bt_mesh;
 struct mesh_prov;
-struct l_queue;
-
-void initiator_prov_open(struct mesh_prov *prov);
-void initiator_prov_close(struct mesh_prov *prov, uint8_t reason);
-void initiator_prov_receive(const void *pkt, uint16_t size,
-							struct mesh_prov *prov);
-void acceptor_prov_open(struct mesh_prov *prov);
-void acceptor_prov_close(struct mesh_prov *prov, uint8_t reason);
-void acceptor_prov_receive(const void *pkt, uint16_t size,
-							struct mesh_prov *prov);
+struct mesh_agent;
+
+/* Provisioner Agent Response Types */
+#define OOB_CANCEL		0x00
+#define OOB_PRIV_KEY		0x01
+#define OOB_PUB_KEY		0x02
+#define OOB_NUMBER		0x03
+#define OOB_STATIC		0x04
+#define OOB_NUMBER_DISPLAY	0x05
+
+/* Spec defined Provisioning message types */
+#define PROV_INVITE	0x00
+#define PROV_CAPS	0x01
+#define PROV_START	0x02
+#define PROV_PUB_KEY	0x03
+#define PROV_INP_CMPLT	0x04
+#define PROV_CONFIRM	0x05
+#define PROV_RANDOM	0x06
+#define PROV_DATA	0x07
+#define PROV_COMPLETE	0x08
+#define PROV_FAILED	0x09
+
+/* Spec defined Error Codes */
+#define PROV_ERR_SUCCESS		0x00
+#define PROV_ERR_INVALID_PDU		0x01
+#define PROV_ERR_INVALID_FORMAT		0x02
+#define PROV_ERR_UNEXPECTED_PDU		0x03
+#define PROV_ERR_CONFIRM_FAILED		0x04
+#define PROV_ERR_INSUF_RESOURCE		0x05
+#define PROV_ERR_DECRYPT_FAILED		0x06
+#define PROV_ERR_UNEXPECTED_ERR		0x07
+#define PROV_ERR_CANT_ASSIGN_ADDR	0x08
+/* Internally generated Error Codes */
+#define PROV_ERR_TIMEOUT		0xFF
+
+/* Provisioner Action values */
+/* IN */
+#define PROV_ACTION_PUSH		0x00
+#define PROV_ACTION_TWIST		0x01
+#define PROV_ACTION_IN_NUMERIC		0x02
+#define PROV_ACTION_IN_ALPHA		0x03
+/* OUT */
+#define PROV_ACTION_BLINK		0x00
+#define PROV_ACTION_BEEP		0x01
+#define PROV_ACTION_VIBRATE		0x02
+#define PROV_ACTION_OUT_NUMERIC		0x03
+#define PROV_ACTION_OUT_ALPHA		0x04
+
+/* OOB_Info defines from Table 3.54 of Mesh profile Specification v1.0 */
+#define OOB_INFO_URI_HASH	0x0002
+
+/* PB_REMOTE not supported from unprovisioned state */
+enum trans_type {
+	PB_ADV = 0,
+	PB_GATT,
+};
+
+#define PROV_FLAG_KR	0x01
+#define PROV_FLAG_IVU	0x02
+
+struct mesh_prov_node_info {
+	uint32_t iv_index;
+	uint16_t unicast;
+	uint16_t net_index;
+	uint8_t net_key[16];
+	uint8_t device_key[16];
+	uint8_t flags; /* IVU and KR bits */
+};
+
+typedef bool (*mesh_prov_acceptor_complete_func_t)(void *user_data,
+					uint8_t status,
+					struct mesh_prov_node_info *info);
+
+typedef bool (*mesh_prov_initiator_complete_func_t)(void *user_data,
+					uint8_t status,
+					struct mesh_prov_node_info *info);
+
+/* This starts unprovisioned device beacon */
+bool acceptor_start(uint8_t num_ele, uint8_t uuid[16],
+			uint16_t algorithms, uint32_t timeout,
+			struct mesh_agent *agent,
+			mesh_prov_acceptor_complete_func_t complete_cb,
+			void *caller_data);
+void acceptor_cancel(void *user_data);
+
+bool initiator_start(enum trans_type transport,
+		uint8_t uuid[16],
+		uint16_t max_ele,
+		uint16_t server, /* Only valid for PB-Remote */
+		uint32_t timeout, /* in seconds from mesh.conf */
+		struct mesh_agent *agent,
+		mesh_prov_initiator_complete_func_t complete_cb,
+		void *caller_data);
+void initiator_cancel(void *user_data);
-- 
2.14.5


  parent reply	other threads:[~2018-12-15  0:26 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-15  0:25 [PATCH BlueZ v3 00/30] Major rewrite for Multi-Node and DBus Brian Gix
2018-12-15  0:25 ` [PATCH BlueZ v3 01/30] mesh: Staging for Mesh DBus API rewrite Brian Gix
2018-12-15  0:25 ` [PATCH BlueZ v3 02/30] mesh: Delete obsolete files Brian Gix
2018-12-15  0:25 ` [PATCH BlueZ v3 03/30] mesh: Utilities for DBus support Brian Gix
2018-12-15  0:25 ` [PATCH BlueZ v3 04/30] mesh: Internal errors Brian Gix
2018-12-15  0:25 ` [PATCH BlueZ v3 05/30] mesh: Re-write storage for Multiple Nodes Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 06/30] mesh: Rewrite Node handling for multiple nodes Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 07/30] mesh: Rewite Network layer " Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 08/30] mesh: Direction agnostic PB-Adv implimentation Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 09/30] mesh: Acceptor side provisioning implimentation Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 10/30] mesh: Initiator " Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 11/30] mesh: Rewrite Controler interface for full init Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 12/30] mesh: Unchanged variables set to const Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 13/30] mesh: centralize generic utilities Brian Gix
2018-12-15  0:26 ` Brian Gix [this message]
2018-12-15  0:26 ` [PATCH BlueZ v3 15/30] mesh: Re-architect for DBus API Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 16/30] mesh: Make config model handle multiple nodes Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 17/30] mesh: Multi node Config Server model Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 18/30] mesh: restructure I/O for multiple nodes Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 19/30] mesh: Restrusture DB to support " Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 20/30] mesh: restructure model services for " Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 21/30] mesh: DBUS interface for Provisioning Agent Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 22/30] mesh: restructure App Key storage Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 23/30] mesh: Clean-up Comment style Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 24/30] mesh: Update for DBus API and multi-node support Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 25/30] mesh: Add default location for Mesh Node storage Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 26/30] mesh: Add structural changes for mesh Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 27/30] mesh: Sample Provisioning Agent Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 28/30] mesh: Sample On/Off Client and Server Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 29/30] mesh: Sample Mesh Joiner (provision acceptor) Brian Gix
2018-12-15  0:26 ` [PATCH BlueZ v3 30/30] mesh: Enable building Mesh Daemon Brian Gix
2018-12-17 18:42 ` [PATCH BlueZ v3 00/30] Major rewrite for Multi-Node and DBus Gix, Brian
2018-12-18  8:16   ` Szymon Janc
2018-12-18  9:14     ` Szymon Janc
2018-12-18 13:47       ` Marcel Holtmann
2018-12-18 15:08     ` Gix, Brian
2018-12-18 16:26       ` Marcel Holtmann
2018-12-18 16:50         ` Gix, Brian
2018-12-18 17:12           ` Marcel Holtmann
2018-12-19 13:02       ` Szymon Janc

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=20181215002624.9313-15-brian.gix@intel.com \
    --to=brian.gix@intel.com \
    --cc=inga.stotland@intel.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.