1 /* Bluetooth Mesh */ 2 3 /* 4 * SPDX-FileCopyrightText: 2017 Intel Corporation 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 */ 8 9 #ifndef _FRIEND_H_ 10 #define _FRIEND_H_ 11 12 #include "net.h" 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 enum bt_mesh_friend_pdu_type { 19 BLE_MESH_FRIEND_PDU_SINGLE, 20 BLE_MESH_FRIEND_PDU_PARTIAL, 21 BLE_MESH_FRIEND_PDU_COMPLETE, 22 }; 23 24 bool bt_mesh_friend_match(uint16_t net_idx, uint16_t addr); 25 26 struct bt_mesh_friend *bt_mesh_friend_find(uint16_t net_idx, uint16_t lpn_addr, 27 bool valid, bool established); 28 29 bool bt_mesh_friend_queue_has_space(uint16_t net_idx, uint16_t src, uint16_t dst, 30 const uint64_t *seq_auth, uint8_t seg_count); 31 32 void bt_mesh_friend_enqueue_rx(struct bt_mesh_net_rx *rx, 33 enum bt_mesh_friend_pdu_type type, 34 const uint64_t *seq_auth, uint8_t seg_count, 35 struct net_buf_simple *sbuf); 36 bool bt_mesh_friend_enqueue_tx(struct bt_mesh_net_tx *tx, 37 enum bt_mesh_friend_pdu_type type, 38 const uint64_t *seq_auth, uint8_t seg_count, 39 struct net_buf_simple *sbuf); 40 41 void bt_mesh_friend_clear_incomplete(struct bt_mesh_subnet *sub, uint16_t src, 42 uint16_t dst, const uint64_t *seq_auth); 43 44 void bt_mesh_friend_sec_update(uint16_t net_idx); 45 46 void bt_mesh_friend_clear_net_idx(uint16_t net_idx); 47 48 int bt_mesh_friend_poll(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf); 49 int bt_mesh_friend_req(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf); 50 int bt_mesh_friend_clear(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf); 51 int bt_mesh_friend_clear_cfm(struct bt_mesh_net_rx *rx, 52 struct net_buf_simple *buf); 53 int bt_mesh_friend_sub_add(struct bt_mesh_net_rx *rx, 54 struct net_buf_simple *buf); 55 int bt_mesh_friend_sub_rem(struct bt_mesh_net_rx *rx, 56 struct net_buf_simple *buf); 57 58 int bt_mesh_friend_init(void); 59 int bt_mesh_friend_deinit(void); 60 61 void bt_mesh_friend_remove_lpn(uint16_t lpn_addr); 62 63 #ifdef __cplusplus 64 } 65 #endif 66 67 #endif /* _FRIEND_H_ */ 68