• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 bool bt_mesh_friend_queue_has_space(u16_t net_idx, u16_t src, u16_t dst,
26                                     u64_t *seq_auth, u8_t seg_count);
27 
28 void bt_mesh_friend_enqueue_rx(struct bt_mesh_net_rx *rx,
29                                enum bt_mesh_friend_pdu_type type,
30                                u64_t *seq_auth, u8_t seg_count,
31                                struct os_mbuf *sbuf);
32 bool bt_mesh_friend_enqueue_tx(struct bt_mesh_net_tx *tx,
33                                enum bt_mesh_friend_pdu_type type,
34                                u64_t *seq_auth, u8_t seg_count,
35                                struct os_mbuf *sbuf);
36 
37 void bt_mesh_friend_clear_incomplete(struct bt_mesh_subnet *sub, u16_t src,
38                                      u16_t dst, u64_t *seq_auth);
39 
40 void bt_mesh_friend_sec_update(u16_t net_idx);
41 
42 void bt_mesh_friend_clear_net_idx(u16_t net_idx);
43 
44 int bt_mesh_friend_poll(struct bt_mesh_net_rx *rx, struct os_mbuf *buf);
45 int bt_mesh_friend_req(struct bt_mesh_net_rx *rx, struct os_mbuf *buf);
46 int bt_mesh_friend_clear(struct bt_mesh_net_rx *rx, struct os_mbuf *buf);
47 int bt_mesh_friend_clear_cfm(struct bt_mesh_net_rx *rx,
48                              struct os_mbuf *buf);
49 int bt_mesh_friend_sub_add(struct bt_mesh_net_rx *rx,
50                            struct os_mbuf *buf);
51 int bt_mesh_friend_sub_rem(struct bt_mesh_net_rx *rx,
52                            struct os_mbuf *buf);
53 
54 int bt_mesh_friend_init(void);
55 
56 #endif
57