1 /*
2  * Copyright (c) 2017 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/sys/iterable_sections.h>
8 
9 #define BT_MESH_KEY_PRIMARY 0x0000
10 
11 enum bt_mesh_key_evt {
12 	BT_MESH_KEY_ADDED,   /* New key added */
13 	BT_MESH_KEY_DELETED, /* Existing key deleted */
14 	BT_MESH_KEY_UPDATED, /* KR phase 1, second key added */
15 	BT_MESH_KEY_SWAPPED, /* KR phase 2, now sending on second key */
16 	BT_MESH_KEY_REVOKED, /* KR phase 3, old key removed */
17 };
18 
19 /** Appkey callback. Instantiate with @ref BT_MESH_APP_KEY_CB */
20 struct bt_mesh_app_key_cb {
21 	void (*evt_handler)(uint16_t app_idx, uint16_t net_idx,
22 			    enum bt_mesh_key_evt evt);
23 };
24 
25 /**
26  *  @brief Register an AppKey event callback.
27  *
28  *  @param _handler Handler function, see @ref bt_mesh_app_key_cb::evt_handler.
29  */
30 #define BT_MESH_APP_KEY_CB_DEFINE(_handler)                                    \
31 	static const STRUCT_SECTION_ITERABLE(bt_mesh_app_key_cb,               \
32 					     _CONCAT(bt_mesh_app_key_cb_,      \
33 						       _handler)) = {          \
34 		.evt_handler = (_handler),                                     \
35 	}
36 
37 struct bt_mesh_net;
38 
39 int bt_mesh_start(void);
40 void bt_mesh_reprovision(uint16_t addr);
41 void bt_mesh_dev_key_cand(const uint8_t *key);
42 void bt_mesh_dev_key_cand_remove(void);
43 void bt_mesh_dev_key_cand_activate(void);
44