mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-28 20:35:59 +00:00
This is a major refactoring of the handling of the cryptographic material of both the network and transport layers. The aim is to encapsulate the key object manipulation, and improve overall modularity. Pulls Applications and Subnets out of the bt_mesh and into separate modules, with static storage types on the data. This has several side-effects: - The Config Server no longer operates directly on the bt_mesh.subs and bt_mesh.apps lists, but goes through a public configuration interface, following the pattern set in #27908. - All iteration through the keys is done through iteration APIs - Key resolution on RX and TX is centralized. - Changes to the keys triggers events the other modules can register handlers for. - Friendship credentials are stored in the lpn and friend structures. Part of #27842. Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
46 lines
1.4 KiB
C
46 lines
1.4 KiB
C
/* Bluetooth Mesh */
|
|
|
|
/*
|
|
* Copyright (c) 2017 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#define BT_MESH_KEY_PRIMARY 0x0000
|
|
|
|
#define BT_MESH_ADDR_IS_UNICAST(addr) ((addr) && (addr) < 0x8000)
|
|
#define BT_MESH_ADDR_IS_GROUP(addr) ((addr) >= 0xc000 && (addr) <= 0xff00)
|
|
#define BT_MESH_ADDR_IS_VIRTUAL(addr) ((addr) >= 0x8000 && (addr) < 0xc000)
|
|
#define BT_MESH_ADDR_IS_RFU(addr) ((addr) >= 0xff00 && (addr) <= 0xfffb)
|
|
|
|
enum bt_mesh_key_evt {
|
|
BT_MESH_KEY_ADDED, /* New key added */
|
|
BT_MESH_KEY_DELETED, /* Existing key deleted */
|
|
BT_MESH_KEY_UPDATED, /* KR phase 1, second key added */
|
|
BT_MESH_KEY_SWAPPED, /* KR phase 2, now sending on second key */
|
|
BT_MESH_KEY_REVOKED, /* KR phase 3, old key removed */
|
|
};
|
|
|
|
/** Appkey callback. Instantiate with @ref BT_MESH_APP_KEY_CB */
|
|
struct bt_mesh_app_key_cb {
|
|
void (*evt_handler)(uint16_t app_idx, uint16_t net_idx,
|
|
enum bt_mesh_key_evt evt);
|
|
};
|
|
|
|
/** @def BT_MESH_APP_KEY_CB
|
|
*
|
|
* @brief Register an AppKey event callback.
|
|
*
|
|
* @param _handler Handler function, see @ref bt_mesh_app_key_cb::evt_handler.
|
|
*/
|
|
#define BT_MESH_APP_KEY_CB_DEFINE(_handler) \
|
|
static const Z_STRUCT_SECTION_ITERABLE(bt_mesh_app_key_cb, \
|
|
_CONCAT(bt_mesh_app_key_cb_, \
|
|
_handler)) = { \
|
|
.evt_handler = (_handler), \
|
|
}
|
|
|
|
struct bt_mesh_net;
|
|
|
|
int bt_mesh_start(void);
|