From b84e4965638046f9acca361c5bbfd6d15aee9601 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Mon, 11 Feb 2019 15:15:26 +0100 Subject: [PATCH] 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. --- sys/include/net/gnrc/sixlowpan/frag.h | 1 + sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c | 16 ++++++++-------- sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.h | 1 - tests/gnrc_sixlowpan_frag/main.c | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/sys/include/net/gnrc/sixlowpan/frag.h b/sys/include/net/gnrc/sixlowpan/frag.h index ef1cc8bf01..eaeb64e9da 100644 --- a/sys/include/net/gnrc/sixlowpan/frag.h +++ b/sys/include/net/gnrc/sixlowpan/frag.h @@ -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 */ diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c b/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c index 6812723b41..80141e4f62 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c @@ -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; } diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.h b/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.h index 48db3fc542..e78982e2be 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.h +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.h @@ -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; diff --git a/tests/gnrc_sixlowpan_frag/main.c b/tests/gnrc_sixlowpan_frag/main.c index f68a846e09..165489e49e 100644 --- a/tests/gnrc_sixlowpan_frag/main.c +++ b/tests/gnrc_sixlowpan_frag/main.c @@ -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)