7#ifndef _BLUETOOTH_MESH_SUBNET_H_
8#define _BLUETOOTH_MESH_SUBNET_H_
12#include "../include/mesh/glue.h"
13#define BT_MESH_NET_FLAG_KR BIT(0)
14#define BT_MESH_NET_FLAG_IVU BIT(1)
16#define BT_MESH_KR_NORMAL 0x00
17#define BT_MESH_KR_PHASE_1 0x01
18#define BT_MESH_KR_PHASE_2 0x02
19#define BT_MESH_KR_PHASE_3 0x03
22#define SUBNET_KEY_TX_IDX(sub) ((sub)->kr_phase == BT_MESH_KR_PHASE_2)
44 uint8_t beacon_cache[21];
51 uint32_t node_id_start;
55 struct bt_mesh_subnet_keys {
60 #if defined(CONFIG_BT_MESH_GATT_PROXY)
67#ifdef CONFIG_BT_MESH_GATT_PROXY
68extern void (*bt_mesh_subnet_cb_list[5]) (
struct bt_mesh_subnet *sub,
69 enum bt_mesh_key_evt evt);
71extern void (*bt_mesh_subnet_cb_list[4]) (
struct bt_mesh_subnet *sub,
72 enum bt_mesh_key_evt evt);
78 enum bt_mesh_key_evt evt);
82void bt_mesh_net_keys_reset(
void);
101size_t bt_mesh_subnet_foreach(
void (*cb)(
struct bt_mesh_subnet *sub));
131int bt_mesh_subnet_set(uint16_t net_idx, uint8_t kr_phase,
132 const uint8_t key[16],
const uint8_t new_key[16]);
146 uint16_t lpn_addr, uint16_t frnd_addr,
147 uint16_t lpn_counter, uint16_t frnd_counter,
148 const uint8_t key[16]);
161bool bt_mesh_net_cred_find(
struct bt_mesh_net_rx *rx,
struct os_mbuf *in,
163 bool (*cb)(
struct bt_mesh_net_rx *rx,
183void bt_mesh_kr_update(
struct bt_mesh_subnet *sub,
bool kr_flag,
bool new_key);
194 return sub->kr_phase != BT_MESH_KR_NORMAL;
201void bt_mesh_subnet_store(uint16_t net_idx);
204void bt_mesh_subnet_pending_store(
void);
205void bt_mesh_net_key_init(
void);