summaryrefslogtreecommitdiff
path: root/mesh/node.h
diff options
context:
space:
mode:
authorInga Stotland <inga.stotland@intel.com>2018-12-14 13:54:17 -0800
committerBrian Gix <brian.gix@intel.com>2019-01-08 08:26:22 -0800
commit39db4f7d294e840c015313a8ec91ed0e0d999d82 (patch)
treecad44d128ef16cb620c75d181e6473f2619291c2 /mesh/node.h
parent20146a4f2f7112c48183652ec5091492882407a2 (diff)
downloadbluez-39db4f7d294e840c015313a8ec91ed0e0d999d82.tar.gz
mesh: Add org.bluez.mesh.Node D-Bus API support
Add support for maintaining multiple local nodes within a single daemon. A mesh node is an adressable entity in Bluetooth mesh. A local mesh capable device may have multiple distinct representations as a mesh node on different mesh networks. Each such representation (aka "node configuration") maintains runtime storage of encryption/decryption keys, model subscriptions and publications, etc. Also, implement D-Bus methods for org.bluez.mesh.Node interaface: Send(), Publish(), VendorPublish() Also, add support for generating temporary mesh node entity for Join() method and verification of credentials for Attach() method
Diffstat (limited to 'mesh/node.h')
-rw-r--r--mesh/node.h43
1 files changed, 29 insertions, 14 deletions
diff --git a/mesh/node.h b/mesh/node.h
index f417fe503..ab09b14b0 100644
--- a/mesh/node.h
+++ b/mesh/node.h
@@ -15,38 +15,42 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- *
*/
-#include "mesh/mesh-db.h"
-
struct mesh_net;
struct mesh_node;
+struct mesh_io;
+struct mesh_agent;
/* To prevent local node JSON cache thrashing, minimum update times */
#define MIN_SEQ_TRIGGER 32
#define MIN_SEQ_CACHE (2*MIN_SEQ_TRIGGER)
#define MIN_SEQ_CACHE_TIME (5*60)
+typedef void (*node_attach_ready_func_t) (int status, char *node_path,
+ uint64_t token);
+
+typedef void (*node_join_ready_func_t) (struct mesh_node *node,
+ struct mesh_agent *agent);
+
struct mesh_node *node_new(void);
void node_free(struct mesh_node *node);
+void node_join(const char *app_path, const char *sender, const uint8_t *uuid,
+ node_join_ready_func_t cb);
uint8_t *node_uuid_get(struct mesh_node *node);
+struct mesh_net *node_get_net(struct mesh_node *node);
struct mesh_node *node_find_by_addr(uint16_t addr);
struct mesh_node *node_find_by_uuid(uint8_t uuid[16]);
bool node_is_provisioned(struct mesh_node *node);
bool node_app_key_delete(struct mesh_net *net, uint16_t addr,
uint16_t net_idx, uint16_t idx);
-bool node_net_key_delete(struct mesh_node *node, uint16_t index);
-bool node_set_primary(struct mesh_node *node, uint16_t unicast);
uint16_t node_get_primary(struct mesh_node *node);
uint16_t node_get_primary_net_idx(struct mesh_node *node);
-bool node_set_device_key(struct mesh_node *node, uint8_t key[16]);
+void node_set_device_key(struct mesh_node *node, uint8_t key[16]);
const uint8_t *node_get_device_key(struct mesh_node *node);
void node_set_num_elements(struct mesh_node *node, uint8_t num_ele);
uint8_t node_get_num_elements(struct mesh_node *node);
bool node_parse_composition(struct mesh_node *node, uint8_t *buf, uint16_t len);
-struct l_queue *node_get_net_keys(struct mesh_node *node);
-struct l_queue *node_get_app_keys(struct mesh_node *node);
bool node_add_binding(struct mesh_node *node, uint8_t ele_idx,
uint32_t model_id, uint16_t app_idx);
bool node_del_binding(struct mesh_node *node, uint8_t ele_idx,
@@ -58,12 +62,8 @@ uint32_t node_get_sequence_number(struct mesh_node *node);
int node_get_element_idx(struct mesh_node *node, uint16_t ele_addr);
struct l_queue *node_get_element_models(struct mesh_node *node, uint8_t ele_idx,
int *status);
-struct mesh_model *node_get_model(struct mesh_node *node, uint8_t ele_idx,
- uint32_t id, int *status);
uint16_t node_get_crpl(struct mesh_node *node);
-struct mesh_node *node_create_from_storage(struct mesh_net *net,
- struct mesh_db_node *db_node,
- bool local);
+bool node_init_from_storage(struct mesh_node *node, void *data);
uint16_t node_generate_comp(struct mesh_node *node, uint8_t *buf, uint16_t sz);
uint8_t node_lpn_mode_get(struct mesh_node *node);
bool node_relay_mode_set(struct mesh_node *node, bool enable, uint8_t cnt,
@@ -77,4 +77,19 @@ uint8_t node_beacon_mode_get(struct mesh_node *node);
bool node_friend_mode_set(struct mesh_node *node, bool enable);
uint8_t node_friend_mode_get(struct mesh_node *node);
uint32_t node_seq_cache(struct mesh_node *node);
-void node_cleanup(struct mesh_net *net);
+const char *node_get_element_path(struct mesh_node *node, uint8_t ele_idx);
+const char *node_get_owner(struct mesh_node *node);
+bool node_add_pending_local(struct mesh_node *node, void *info,
+ struct mesh_io *io);
+void node_attach_io(struct mesh_io *io);
+int node_attach(const char *app_path, const char *sender, uint64_t token,
+ node_attach_ready_func_t cb);
+void node_build_attach_reply(struct l_dbus_message *reply, uint64_t token);
+void node_id_set(struct mesh_node *node, uint16_t node_id);
+bool node_dbus_init(struct l_dbus *bus);
+void node_cleanup(void *node);
+void node_cleanup_all(void);
+void node_jconfig_set(struct mesh_node *node, void *jconfig);
+void *node_jconfig_get(struct mesh_node *node);
+void node_cfg_file_set(struct mesh_node *node, char *cfg);
+char *node_cfg_file_get(struct mesh_node *node);