Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
cdb.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Tobias Svehagen
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12
13#ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_CDB_H_
14#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_CDB_H_
15
16#include <stdbool.h>
17#include <stdint.h>
18
19#include <zephyr/sys/atomic.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#if defined(CONFIG_BT_MESH_CDB)
27#define NODE_COUNT CONFIG_BT_MESH_CDB_NODE_COUNT
28#define SUBNET_COUNT CONFIG_BT_MESH_CDB_SUBNET_COUNT
29#define APP_KEY_COUNT CONFIG_BT_MESH_CDB_APP_KEY_COUNT
30#else
31#define NODE_COUNT 0
32#define SUBNET_COUNT 0
33#define APP_KEY_COUNT 0
34#endif
35
36enum {
38
40};
41
42/* doc string cdb node start */
57/* doc string cdb node end */
58
59/* doc string cdb subnet start */
70/* doc string cdb subnet end */
71
72/* doc string cdb app key start */
83/* doc string cdb app key end */
84
85enum {
91
93};
94
95/* doc string cdb start */
110
112extern struct bt_mesh_cdb bt_mesh_cdb;
113/* doc string cdb end */
114
125int bt_mesh_cdb_create(const uint8_t key[16]);
126
134
147
168
177
189void bt_mesh_cdb_node_del(struct bt_mesh_cdb_node *node, bool store);
190
202
214
220
233
245int bt_mesh_cdb_node_key_export(const struct bt_mesh_cdb_node *node, uint8_t out[16]);
246
247enum {
250};
251
262 void *user_data);
263
273
284
292void bt_mesh_cdb_subnet_del(struct bt_mesh_cdb_subnet *sub, bool store);
293
304
310
318
334 const uint8_t in[16]);
335
350int bt_mesh_cdb_subnet_key_export(const struct bt_mesh_cdb_subnet *sub, int key_idx,
351 uint8_t out[16]);
352
365
373void bt_mesh_cdb_app_key_del(struct bt_mesh_cdb_app_key *key, bool store);
374
385
391
406int bt_mesh_cdb_app_key_import(struct bt_mesh_cdb_app_key *key, int key_idx, const uint8_t in[16]);
407
422int bt_mesh_cdb_app_key_export(const struct bt_mesh_cdb_app_key *key, int key_idx, uint8_t out[16]);
423
424#ifdef __cplusplus
425}
426#endif
427
428#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_CDB_H_ */
Header file for the Atomic operations API.
int bt_mesh_cdb_create(const uint8_t key[16])
Create the Mesh Configuration Database.
@ BT_MESH_CDB_IVU_IN_PROGRESS
Definition cdb.h:90
@ BT_MESH_CDB_NODES_PENDING
Definition cdb.h:89
@ BT_MESH_CDB_SUBNET_PENDING
Definition cdb.h:87
@ BT_MESH_CDB_KEYS_PENDING
Definition cdb.h:88
@ BT_MESH_CDB_FLAG_COUNT
Definition cdb.h:92
@ BT_MESH_CDB_VALID
Definition cdb.h:86
uint8_t bt_mesh_cdb_subnet_flags(const struct bt_mesh_cdb_subnet *sub)
Get the flags for a subnet.
@ BT_MESH_CDB_NODE_FLAG_COUNT
Definition cdb.h:39
@ BT_MESH_CDB_NODE_CONFIGURED
Definition cdb.h:37
int bt_mesh_cdb_node_key_import(struct bt_mesh_cdb_node *node, const uint8_t in[16])
Import device key for selected node.
@ BT_MESH_CDB_ITER_CONTINUE
Definition cdb.h:249
@ BT_MESH_CDB_ITER_STOP
Definition cdb.h:248
struct bt_mesh_cdb_subnet * bt_mesh_cdb_subnet_get(uint16_t net_idx)
Get a subnet by NetIdx.
struct bt_mesh_cdb_node * bt_mesh_cdb_node_get(uint16_t addr)
Get a node by address.
int bt_mesh_cdb_node_key_export(const struct bt_mesh_cdb_node *node, uint8_t out[16])
Export device key from selected node.
void bt_mesh_cdb_clear(void)
Clear the Mesh Configuration Database.
void bt_mesh_cdb_app_key_store(const struct bt_mesh_cdb_app_key *key)
Store application key to persistent storage.
void bt_mesh_cdb_subnet_store(const struct bt_mesh_cdb_subnet *sub)
Store subnet to persistent storage.
#define SUBNET_COUNT
Definition cdb.h:32
uint8_t(* bt_mesh_cdb_node_func_t)(struct bt_mesh_cdb_node *node, void *user_data)
Node iterator callback.
Definition cdb.h:261
void bt_mesh_cdb_subnet_del(struct bt_mesh_cdb_subnet *sub, bool store)
Delete a subnet.
void bt_mesh_cdb_app_key_del(struct bt_mesh_cdb_app_key *key, bool store)
Delete an application key.
void bt_mesh_cdb_node_del(struct bt_mesh_cdb_node *node, bool store)
Delete a node.
int bt_mesh_cdb_app_key_export(const struct bt_mesh_cdb_app_key *key, int key_idx, uint8_t out[16])
Export application key.
int bt_mesh_cdb_app_key_import(struct bt_mesh_cdb_app_key *key, int key_idx, const uint8_t in[16])
Import application key.
uint16_t bt_mesh_cdb_free_addr_get(uint8_t num_elem)
Get the first available address for the given element count.
void bt_mesh_cdb_iv_update(uint32_t iv_index, bool iv_update)
Set and store the IV Index and IV Update flag.
#define APP_KEY_COUNT
Definition cdb.h:33
struct bt_mesh_cdb_node * bt_mesh_cdb_node_alloc(const uint8_t uuid[16], uint16_t addr, uint8_t num_elem, uint16_t net_idx)
Allocate a node.
struct bt_mesh_cdb_app_key * bt_mesh_cdb_app_key_get(uint16_t app_idx)
Get an application key by AppIdx.
struct bt_mesh_cdb_app_key * bt_mesh_cdb_app_key_alloc(uint16_t net_idx, uint16_t app_idx)
Allocate an application key.
int bt_mesh_cdb_subnet_key_import(struct bt_mesh_cdb_subnet *sub, int key_idx, const uint8_t in[16])
Import network key for selected subnetwork.
int bt_mesh_cdb_subnet_key_export(const struct bt_mesh_cdb_subnet *sub, int key_idx, uint8_t out[16])
Export network key from selected subnetwork.
void bt_mesh_cdb_node_store(const struct bt_mesh_cdb_node *node)
Store node to persistent storage.
void bt_mesh_cdb_node_update(struct bt_mesh_cdb_node *node, uint16_t addr, uint8_t num_elem)
Update a node.
#define NODE_COUNT
Definition cdb.h:31
void bt_mesh_cdb_node_foreach(bt_mesh_cdb_node_func_t func, void *user_data)
Node iterator.
struct bt_mesh_cdb_subnet * bt_mesh_cdb_subnet_alloc(uint16_t net_idx)
Allocate a subnet.
#define ATOMIC_DEFINE(name, num_bits)
Define an array of atomic variables.
Definition atomic.h:119
Bluetooth Mesh Profile APIs.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Definition cdb.h:73
struct bt_mesh_key app_key
Definition cdb.h:80
uint16_t app_idx
Application key index.
Definition cdb.h:77
struct bt_mesh_cdb_app_key::@274230372255300310212360360030147162313105141144 keys[2]
Old and new keys for Key Refresh.
uint16_t net_idx
Bound network key index.
Definition cdb.h:75
Definition cdb.h:43
uint8_t num_elem
Number of elements.
Definition cdb.h:51
atomic_t flags[(((((unsigned long)(BT_MESH_CDB_NODE_FLAG_COUNT)+((unsigned long)(ATOMIC_BITS) - 1))/(unsigned long)(ATOMIC_BITS)) *(unsigned long)(ATOMIC_BITS))/ATOMIC_BITS)]
Node flags.
Definition cdb.h:55
struct bt_mesh_key dev_key
Device key.
Definition cdb.h:53
uint8_t uuid[16]
Node UUID.
Definition cdb.h:45
uint16_t addr
Primary element address.
Definition cdb.h:47
uint16_t net_idx
Network key index used during provisioning.
Definition cdb.h:49
Definition cdb.h:60
uint8_t kr_phase
Key Refresh phase.
Definition cdb.h:64
uint16_t net_idx
Network key index.
Definition cdb.h:62
struct bt_mesh_cdb_subnet::@255320146034363322047346143277156274244242036001 keys[2]
Old and new keys for Key Refresh.
struct bt_mesh_key net_key
Definition cdb.h:67
Definition cdb.h:96
uint32_t iv_index
Network IV Index.
Definition cdb.h:98
struct bt_mesh_cdb_app_key app_keys[0]
Application keys in the mesh network.
Definition cdb.h:108
struct bt_mesh_cdb_node nodes[0]
Nodes in the mesh network.
Definition cdb.h:104
atomic_t flags[(((((unsigned long)(BT_MESH_CDB_FLAG_COUNT)+((unsigned long)(ATOMIC_BITS) - 1))/(unsigned long)(ATOMIC_BITS)) *(unsigned long)(ATOMIC_BITS))/ATOMIC_BITS)]
Flags for CDB state (private).
Definition cdb.h:102
uint16_t lowest_avail_addr
Lowest available unicast address for provisioning.
Definition cdb.h:100
struct bt_mesh_cdb_subnet subnets[0]
Subnets in the mesh network.
Definition cdb.h:106
The structure that keeps representation of key.
Definition keys.h:22
Binary representation of a UUID.
Definition uuid.h:48