mesh: provide mesh_transport_seq_zero based on seq in transport_pdu

This commit is contained in:
Milanka Ringwald 2018-12-07 16:12:02 +01:00 committed by Matthias Ringwald
parent bc0d07b4e9
commit b53cd3bd65

View File

@ -221,6 +221,9 @@ static uint16_t mesh_transport_ttl(mesh_transport_pdu_t * transport_pdu){
static uint32_t mesh_transport_seq(mesh_transport_pdu_t * transport_pdu){
return big_endian_read_24(transport_pdu->network_header, 2);
}
static uint32_t mesh_transport_seq_zero(mesh_transport_pdu_t * transport_pdu){
return big_endian_read_24(transport_pdu->network_header, 2) & 0x1fff;
}
static uint16_t mesh_transport_src(mesh_transport_pdu_t * transport_pdu){
return big_endian_read_16(transport_pdu->network_header, 5);
}
@ -593,11 +596,6 @@ static mesh_transport_pdu_t * mesh_transport_pdu_for_segmented_message(mesh_netw
test_transport_pdu->netkey_index = network_pdu->netkey_index;
test_transport_pdu->block_ack = 0;
test_transport_pdu->acknowledgement_timer_active = 0;
uint8_t * lower_transport_pdu = mesh_network_pdu_data(network_pdu);
uint16_t seg_zero = ( big_endian_read_16(lower_transport_pdu, 1) >> 2) & 0x1fff;
// TODO: reconstruct full seq auth
mesh_transport_set_seq(test_transport_pdu, seg_zero);
printf("mesh_transport_pdu_for_segmented_message: setup transport pdu %p for src %x\n", test_transport_pdu, mesh_transport_src(test_transport_pdu));
} else {
printf("mesh_transport_pdu_for_segmented_message: transport pdu %p already set up for src %x\n", test_transport_pdu, mesh_transport_src(test_transport_pdu));