1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2026-01-01 01:41:18 +01:00

gnrc_sixlowpan_frag_rb: return pointer to entry on add()

This commit is contained in:
Martine S. Lenders 2019-09-30 14:26:21 +02:00 committed by Martine Lenders
parent 3a4ebe98c3
commit b086453347
2 changed files with 16 additions and 11 deletions

View File

@ -105,10 +105,13 @@ typedef struct {
* @param[in] frag The fragment to add.
* @param[in] offset The fragment's offset.
* @param[in] page Current 6Lo dispatch parsing page.
*
* @return The reassembly buffer entry the fragment was added to on success.
* @return NULL on error.
*/
void gnrc_sixlowpan_frag_rb_add(gnrc_netif_hdr_t *netif_hdr,
gnrc_pktsnip_t *frag, size_t offset,
unsigned page);
gnrc_sixlowpan_frag_rb_t *gnrc_sixlowpan_frag_rb_add(gnrc_netif_hdr_t *netif_hdr,
gnrc_pktsnip_t *frag,
size_t offset, unsigned page);
/**
* @brief Checks if a reassembly buffer entry is unset

View File

@ -120,13 +120,15 @@ static int _check_fragments(gnrc_sixlowpan_frag_rb_base_t *entry,
return RBUF_ADD_SUCCESS;
}
void gnrc_sixlowpan_frag_rb_add(gnrc_netif_hdr_t *netif_hdr,
gnrc_pktsnip_t *pkt, size_t offset,
unsigned page)
gnrc_sixlowpan_frag_rb_t *gnrc_sixlowpan_frag_rb_add(gnrc_netif_hdr_t *netif_hdr,
gnrc_pktsnip_t *pkt,
size_t offset, unsigned page)
{
if (_rbuf_add(netif_hdr, pkt, offset, page) == RBUF_ADD_REPEAT) {
_rbuf_add(netif_hdr, pkt, offset, page);
int res;
if ((res = _rbuf_add(netif_hdr, pkt, offset, page)) == RBUF_ADD_REPEAT) {
res = _rbuf_add(netif_hdr, pkt, offset, page);
}
return (res < 0) ? NULL : &rbuf[res];
}
#ifndef NDEBUG
@ -210,7 +212,7 @@ static int _rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *pkt,
return RBUF_ADD_REPEAT;
case RBUF_ADD_DUPLICATE:
gnrc_pktbuf_release(pkt);
return RBUF_ADD_SUCCESS;
return res;
default:
break;
}
@ -230,7 +232,7 @@ static int _rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *pkt,
return RBUF_ADD_ERROR;
}
gnrc_sixlowpan_iphc_recv(pkt, entry, 0);
return RBUF_ADD_SUCCESS;
return res;
}
else
#endif
@ -243,7 +245,7 @@ static int _rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *pkt,
}
gnrc_sixlowpan_frag_rb_dispatch_when_complete(entry, netif_hdr);
gnrc_pktbuf_release(pkt);
return RBUF_ADD_SUCCESS;
return res;
}
static inline bool _rbuf_int_overlap_partially(gnrc_sixlowpan_frag_rb_int_t *i,