1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 22:43:50 +01:00

gnrc_sixlowpan_frag: add intervals to public type

The fragment intervals are also required by the VRB, so make them part
of the public representation of a reassembly buffer.
This commit is contained in:
Martine Lenders 2019-02-11 15:15:26 +01:00 committed by Martine Lenders
parent a3061ab2cc
commit b84e496563
4 changed files with 13 additions and 13 deletions

View File

@ -93,6 +93,7 @@ typedef struct {
* @brief The reassembled packet in the packet buffer
*/
gnrc_pktsnip_t *pkt;
gnrc_sixlowpan_rbuf_int_t *ints; /**< intervals of already received fragments */
uint8_t src[IEEE802154_LONG_ADDRESS_LEN]; /**< source address */
uint8_t dst[IEEE802154_LONG_ADDRESS_LEN]; /**< destination address */
uint8_t src_len; /**< length of gnrc_sixlowpan_rbuf_t::src */

View File

@ -110,7 +110,7 @@ static int _rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *pkt,
return RBUF_ADD_ERROR;
}
ptr = entry->ints;
ptr = entry->super.ints;
/* dispatches in the first fragment are ignored */
if (offset == 0) {
@ -207,13 +207,13 @@ static gnrc_sixlowpan_rbuf_int_t *_rbuf_int_get_free(void)
void rbuf_rm(rbuf_t *entry)
{
while (entry->ints != NULL) {
gnrc_sixlowpan_rbuf_int_t *next = entry->ints->next;
while (entry->super.ints != NULL) {
gnrc_sixlowpan_rbuf_int_t *next = entry->super.ints->next;
entry->ints->start = 0;
entry->ints->end = 0;
entry->ints->next = NULL;
entry->ints = next;
entry->super.ints->start = 0;
entry->super.ints->end = 0;
entry->super.ints->next = NULL;
entry->super.ints = next;
}
entry->super.pkt = NULL;
@ -243,7 +243,7 @@ static bool _rbuf_update_ints(rbuf_t *entry, uint16_t offset, size_t frag_size)
l2addr_str),
(unsigned)entry->super.pkt->size, entry->super.tag);
LL_PREPEND(entry->ints, new);
LL_PREPEND(entry->super.ints, new);
return true;
}

View File

@ -51,7 +51,6 @@ extern "C" {
*/
typedef struct {
gnrc_sixlowpan_rbuf_t super; /**< exposed part of the reassembly buffer */
gnrc_sixlowpan_rbuf_int_t *ints; /**< intervals of the fragment */
uint32_t arrival; /**< time in microseconds of arrival of
* last received fragment */
} rbuf_t;

View File

@ -234,10 +234,10 @@ static void _test_entry(const rbuf_t *entry, unsigned exp_current_size,
"entry->super.dst != TEST_NETIF_HDR_DST");
TEST_ASSERT_EQUAL_INT(TEST_TAG, entry->super.tag);
TEST_ASSERT_EQUAL_INT(exp_current_size, entry->super.current_size);
TEST_ASSERT_NOT_NULL(entry->ints);
TEST_ASSERT_NULL(entry->ints->next);
TEST_ASSERT_EQUAL_INT(exp_int_start, entry->ints->start);
TEST_ASSERT_EQUAL_INT(exp_int_end, entry->ints->end);
TEST_ASSERT_NOT_NULL(entry->super.ints);
TEST_ASSERT_NULL(entry->super.ints->next);
TEST_ASSERT_EQUAL_INT(exp_int_start, entry->super.ints->start);
TEST_ASSERT_EQUAL_INT(exp_int_end, entry->super.ints->end);
}
static void _check_pktbuf(const rbuf_t *entry)