diff --git a/src/ble/mesh/mesh_network.c b/src/ble/mesh/mesh_network.c index 1b19a1e7d..b1b0ae4b2 100644 --- a/src/ble/mesh/mesh_network.c +++ b/src/ble/mesh/mesh_network.c @@ -616,3 +616,17 @@ void mesh_set_iv_index(uint32_t iv_index){ uint32_t mesh_get_iv_index(void){ return global_iv_index; } + +// Network PDU Getter +uint16_t mesh_network_control(mesh_network_pdu_t * network_pdu){ + return network_pdu->data[1] & 0x80; +} +uint8_t mesh_network_ttl(mesh_network_pdu_t * network_pdu){ + return network_pdu->data[1] & 0x7f; +} +uint16_t mesh_network_src(mesh_network_pdu_t * network_pdu){ + return big_endian_read_16(network_pdu->data, 5); +} +int mesh_network_segmented(mesh_network_pdu_t * network_pdu){ + return network_pdu->data[9] & 0x80; +} diff --git a/src/ble/mesh/mesh_network.h b/src/ble/mesh/mesh_network.h index ec4d6581b..e31548abc 100644 --- a/src/ble/mesh/mesh_network.h +++ b/src/ble/mesh/mesh_network.h @@ -183,6 +183,12 @@ void mesh_network_setup_pdu(mesh_network_pdu_t * network_pdu, uint16_t netkey_in */ int mesh_network_addresses_valid(uint8_t ctl, uint16_t src, uint16_t dst); +// Mesh Network PDU Getter +uint16_t mesh_network_control(mesh_network_pdu_t * network_pdu); +uint8_t mesh_network_ttl(mesh_network_pdu_t * network_pdu); +uint16_t mesh_network_src(mesh_network_pdu_t * network_pdu); +int mesh_network_segmented(mesh_network_pdu_t * network_pdu); + // Testing only void mesh_network_received_message(const uint8_t * pdu_data, uint8_t pdu_len); diff --git a/test/mesh/mesh.c b/test/mesh/mesh.c index 0458dbbd9..35d5a0cc2 100644 --- a/test/mesh/mesh.c +++ b/test/mesh/mesh.c @@ -416,20 +416,6 @@ static void transport_segmented_setup_device_nonce(uint8_t * nonce, const mesh_t mesh_print_hex("DeviceNonce", nonce, 13); } -// Network PDU Getter -static uint16_t mesh_network_control(mesh_network_pdu_t * network_pdu){ - return network_pdu->data[1] & 0x80; -} -static uint8_t mesh_network_ttl(mesh_network_pdu_t * network_pdu){ - return network_pdu->data[1] & 0x7f; -} -static uint16_t mesh_network_src(mesh_network_pdu_t * network_pdu){ - return big_endian_read_16(network_pdu->data, 5); -} -static int mesh_network_segmented(mesh_network_pdu_t * network_pdu){ - return network_pdu->data[9] & 0x80; -} - // Transport PDU Getter static uint16_t mesh_transport_nid(mesh_transport_pdu_t * transport_pdu){ return transport_pdu->network_header[0] & 0x7f;