1 /*
2  * Copyright (c) 2017 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 enum bt_mesh_friend_pdu_type {
8 	BT_MESH_FRIEND_PDU_SINGLE,
9 	BT_MESH_FRIEND_PDU_PARTIAL,
10 	BT_MESH_FRIEND_PDU_COMPLETE,
11 };
12 
13 bool bt_mesh_friend_match(uint16_t net_idx, uint16_t addr);
14 
15 struct bt_mesh_friend *bt_mesh_friend_find(uint16_t net_idx, uint16_t lpn_addr,
16 					   bool valid, bool established);
17 
18 bool bt_mesh_friend_queue_has_space(uint16_t net_idx, uint16_t src, uint16_t dst,
19 				    uint64_t *seq_auth, uint8_t seg_count);
20 
21 void bt_mesh_friend_enqueue_rx(struct bt_mesh_net_rx *rx,
22 			       enum bt_mesh_friend_pdu_type type,
23 			       const uint64_t *seq_auth, uint8_t seg_count,
24 			       struct net_buf_simple *sbuf);
25 bool bt_mesh_friend_enqueue_tx(struct bt_mesh_net_tx *tx,
26 			       enum bt_mesh_friend_pdu_type type,
27 			       const uint64_t *seq_auth, uint8_t seg_count,
28 			       struct net_buf_simple *sbuf);
29 
30 void bt_mesh_friend_clear_incomplete(struct bt_mesh_subnet *sub, uint16_t src,
31 				     uint16_t dst, uint64_t *seq_auth);
32 
33 void bt_mesh_friend_sec_update(uint16_t net_idx);
34 
35 void bt_mesh_friends_clear(void);
36 
37 int bt_mesh_friend_poll(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf);
38 int bt_mesh_friend_req(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf);
39 int bt_mesh_friend_clear(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf);
40 int bt_mesh_friend_clear_cfm(struct bt_mesh_net_rx *rx,
41 			     struct net_buf_simple *buf);
42 int bt_mesh_friend_sub_add(struct bt_mesh_net_rx *rx,
43 			   struct net_buf_simple *buf);
44 int bt_mesh_friend_sub_rem(struct bt_mesh_net_rx *rx,
45 			   struct net_buf_simple *buf);
46 
47 int bt_mesh_friend_init(void);
48