1 /* Bluetooth Mesh */ 2 3 /* 4 * Copyright (c) 2017 Intel Corporation 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 */ 8 9 #define TRANS_SEQ_AUTH_NVAL 0xffffffffffffffff 10 11 #define BT_MESH_TX_SDU_MAX (CONFIG_BT_MESH_TX_SEG_MAX * 16) 12 13 #define TRANS_CTL_OP_MASK ((u8_t)BIT_MASK(7)) 14 #define TRANS_CTL_OP(data) ((data)[0] & TRANS_CTL_OP_MASK) 15 #define TRANS_CTL_HDR(op, seg) ((op & TRANS_CTL_OP_MASK) | (seg << 7)) 16 17 #define TRANS_CTL_OP_ACK 0x00 18 #define TRANS_CTL_OP_FRIEND_POLL 0x01 19 #define TRANS_CTL_OP_FRIEND_UPDATE 0x02 20 #define TRANS_CTL_OP_FRIEND_REQ 0x03 21 #define TRANS_CTL_OP_FRIEND_OFFER 0x04 22 #define TRANS_CTL_OP_FRIEND_CLEAR 0x05 23 #define TRANS_CTL_OP_FRIEND_CLEAR_CFM 0x06 24 #define TRANS_CTL_OP_FRIEND_SUB_ADD 0x07 25 #define TRANS_CTL_OP_FRIEND_SUB_REM 0x08 26 #define TRANS_CTL_OP_FRIEND_SUB_CFM 0x09 27 #define TRANS_CTL_OP_HEARTBEAT 0x0a 28 /*[Genie begin] add by wenbing.cwb at 2021-01-21*/ 29 #ifdef CONFIG_BT_MESH_CTRL_RELAY 30 #define TRANS_CTL_OP_CTRL_RELAY_STATUS 0x30 31 #define TRANS_CTL_OP_CTRL_RELAY_REQ 0x31 32 #define TRANS_CTL_OP_CTRL_RELAY_OPEN 0x32 33 #endif 34 /*[Genie end] add by wenbing.cwb at 2021-01-21*/ 35 36 struct bt_mesh_ctl_friend_poll { 37 u8_t fsn; 38 } __packed; 39 40 struct bt_mesh_ctl_friend_update { 41 u8_t flags; 42 bt_u32_t iv_index; 43 u8_t md; 44 } __packed; 45 46 struct bt_mesh_ctl_friend_req { 47 u8_t criteria; 48 u8_t recv_delay; 49 u8_t poll_to[3]; 50 u16_t prev_addr; 51 u8_t num_elem; 52 u16_t lpn_counter; 53 } __packed; 54 55 struct bt_mesh_ctl_friend_offer { 56 u8_t recv_win; 57 u8_t queue_size; 58 u8_t sub_list_size; 59 s8_t rssi; 60 u16_t frnd_counter; 61 } __packed; 62 63 struct bt_mesh_ctl_friend_clear { 64 u16_t lpn_addr; 65 u16_t lpn_counter; 66 } __packed; 67 68 struct bt_mesh_ctl_friend_clear_confirm { 69 u16_t lpn_addr; 70 u16_t lpn_counter; 71 } __packed; 72 73 #define BT_MESH_FRIEND_SUB_MIN_LEN (1 + 2) 74 struct bt_mesh_ctl_friend_sub { 75 u8_t xact; 76 u16_t addr_list[5]; 77 } __packed; 78 79 struct bt_mesh_ctl_friend_sub_confirm { 80 u8_t xact; 81 } __packed; 82 83 void bt_mesh_set_hb_sub_dst(u16_t addr); 84 85 struct bt_mesh_app_key *bt_mesh_app_key_find(u16_t app_idx); 86 87 bool bt_mesh_tx_in_progress(void); 88 89 void bt_mesh_rx_reset(void); 90 void bt_mesh_tx_reset(void); 91 92 int bt_mesh_ctl_send(struct bt_mesh_net_tx *tx, u8_t ctl_op, void *data, 93 size_t data_len, u64_t *seq_auth, 94 const struct bt_mesh_send_cb *cb, void *cb_data); 95 96 int bt_mesh_trans_send(struct bt_mesh_net_tx *tx, struct net_buf_simple *msg, 97 const struct bt_mesh_send_cb *cb, void *cb_data); 98 99 int bt_mesh_trans_recv(struct net_buf_simple *buf, struct bt_mesh_net_rx *rx); 100 101 void bt_mesh_trans_init(void); 102 103 void bt_mesh_rpl_clear(void); 104 105 void bt_mesh_rpl_clear_all(void); 106 107 void bt_mesh_rpl_clear_node(uint16_t unicast_addr,uint8_t elem_num); 108