Skip to content
Snippets Groups Projects
Commit 68fe6682 authored by Martine Lenders's avatar Martine Lenders
Browse files

gnrc_sixlowpan_frag: add current_size to exposed struct

Since IPHC also manipulates the total number of bytes of a received
datagram (by decompressing it), this also needs to be exposed. I guess
I was too focused on introducing a *generic* packet buffer for a future
virtual reassembly buffer (where it isn't needed, but so isn't `pkt` to
be honest), that I totally forgot about it in #9352.
parent 904c5830
No related branches found
No related tags found
No related merge requests found
...@@ -67,6 +67,10 @@ typedef struct { ...@@ -67,6 +67,10 @@ typedef struct {
uint8_t src_len; /**< length of gnrc_sixlowpan_rbuf_t::src */ uint8_t src_len; /**< length of gnrc_sixlowpan_rbuf_t::src */
uint8_t dst_len; /**< length of gnrc_sixlowpan_rbuf_t::dst */ uint8_t dst_len; /**< length of gnrc_sixlowpan_rbuf_t::dst */
uint16_t tag; /**< the datagram's tag */ uint16_t tag; /**< the datagram's tag */
/**
* @brief The number of bytes currently received of the complete datagram
*/
uint16_t current_size;
} gnrc_sixlowpan_rbuf_t; } gnrc_sixlowpan_rbuf_t;
/** /**
......
...@@ -152,12 +152,12 @@ void rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *pkt, ...@@ -152,12 +152,12 @@ void rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *pkt,
if (_rbuf_update_ints(entry, offset, frag_size)) { if (_rbuf_update_ints(entry, offset, frag_size)) {
DEBUG("6lo rbuf: add fragment data\n"); DEBUG("6lo rbuf: add fragment data\n");
entry->cur_size += (uint16_t)frag_size; entry->super.current_size += (uint16_t)frag_size;
memcpy(((uint8_t *)entry->super.pkt->data) + offset + data_offset, data, memcpy(((uint8_t *)entry->super.pkt->data) + offset + data_offset, data,
frag_size - data_offset); frag_size - data_offset);
} }
if (entry->cur_size == entry->super.pkt->size) { if (entry->super.current_size == entry->super.pkt->size) {
gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(entry->super.src, gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(entry->super.src,
entry->super.src_len, entry->super.src_len,
entry->super.dst, entry->super.dst,
...@@ -337,7 +337,7 @@ static rbuf_t *_rbuf_get(const void *src, size_t src_len, ...@@ -337,7 +337,7 @@ static rbuf_t *_rbuf_get(const void *src, size_t src_len,
res->super.src_len = src_len; res->super.src_len = src_len;
res->super.dst_len = dst_len; res->super.dst_len = dst_len;
res->super.tag = tag; res->super.tag = tag;
res->cur_size = 0; res->super.current_size = 0;
DEBUG("6lo rfrag: entry %p (%s, ", (void *)res, DEBUG("6lo rfrag: entry %p (%s, ", (void *)res,
gnrc_netif_addr_to_str(res->super.src, res->super.src_len, gnrc_netif_addr_to_str(res->super.src, res->super.src_len,
......
...@@ -65,7 +65,6 @@ typedef struct { ...@@ -65,7 +65,6 @@ typedef struct {
rbuf_int_t *ints; /**< intervals of the fragment */ rbuf_int_t *ints; /**< intervals of the fragment */
uint32_t arrival; /**< time in microseconds of arrival of uint32_t arrival; /**< time in microseconds of arrival of
* last received fragment */ * last received fragment */
uint16_t cur_size; /**< the datagram's current size */
} rbuf_t; } rbuf_t;
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment