xref: /nrf52832-nimble/packages/NimBLE-latest/nimble/host/mesh/src/friend.h (revision 042d53a763ad75cb1465103098bb88c245d95138)
1 /*  Bluetooth Mesh */
2 
3 /*
4  * Copyright (c) 2017 Intel Corporation
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  */
8 
9 #ifndef __FRIEND_H__
10 #define __FRIEND_H__
11 
12 #include "mesh/mesh.h"
13 
14 enum bt_mesh_friend_pdu_type {
15 	BT_MESH_FRIEND_PDU_SINGLE,
16 	BT_MESH_FRIEND_PDU_PARTIAL,
17 	BT_MESH_FRIEND_PDU_COMPLETE,
18 };
19 
20 bool bt_mesh_friend_match(u16_t net_idx, u16_t addr);
21 
22 struct bt_mesh_friend *bt_mesh_friend_find(u16_t net_idx, u16_t lpn_addr,
23 					   bool valid, bool established);
24 
25 void bt_mesh_friend_enqueue_rx(struct bt_mesh_net_rx *rx,
26 			       enum bt_mesh_friend_pdu_type type,
27 			       u64_t *seq_auth, struct os_mbuf *sbuf);
28 bool bt_mesh_friend_enqueue_tx(struct bt_mesh_net_tx *tx,
29 			       enum bt_mesh_friend_pdu_type type,
30 			       u64_t *seq_auth, struct os_mbuf *sbuf);
31 
32 void bt_mesh_friend_clear_incomplete(struct bt_mesh_subnet *sub, u16_t src,
33 				     u16_t dst, u64_t *seq_auth);
34 
35 void bt_mesh_friend_sec_update(u16_t net_idx);
36 
37 void bt_mesh_friend_clear_net_idx(u16_t net_idx);
38 
39 int bt_mesh_friend_poll(struct bt_mesh_net_rx *rx, struct os_mbuf *buf);
40 int bt_mesh_friend_req(struct bt_mesh_net_rx *rx, struct os_mbuf *buf);
41 int bt_mesh_friend_clear(struct bt_mesh_net_rx *rx, struct os_mbuf *buf);
42 int bt_mesh_friend_clear_cfm(struct bt_mesh_net_rx *rx,
43 			     struct os_mbuf *buf);
44 int bt_mesh_friend_sub_add(struct bt_mesh_net_rx *rx,
45 			   struct os_mbuf *buf);
46 int bt_mesh_friend_sub_rem(struct bt_mesh_net_rx *rx,
47 			   struct os_mbuf *buf);
48 
49 int bt_mesh_friend_init(void);
50 
51 #endif
52