1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 22:13:52 +01:00

gnrc_sixlowpan_frag_rb: return status on dispatch_when_complete()

This commit is contained in:
Martine S. Lenders 2019-09-30 15:29:38 +02:00 committed by Martine Lenders
parent b086453347
commit a229755abe
2 changed files with 13 additions and 5 deletions

View File

@ -187,9 +187,14 @@ static inline void gnrc_sixlowpan_frag_rb_remove(gnrc_sixlowpan_frag_rb_t *rbuf)
* @param[in] netif Original @ref gnrc_netif_hdr_t of the last received frame.
* Used to construct the @ref gnrc_netif_hdr_t of the completed
* datagram. Must not be NULL.
*
* @return >0, when the datagram in @p rbuf was complete and dispatched.
* @return 0, when the datagram in @p rbuf is not complete.
* @return -1, if the the reassembled datagram was not dispatched. @p rbuf is
* destroyed either way.
*/
void gnrc_sixlowpan_frag_rb_dispatch_when_complete(gnrc_sixlowpan_frag_rb_t *rbuf,
gnrc_netif_hdr_t *netif);
int gnrc_sixlowpan_frag_rb_dispatch_when_complete(gnrc_sixlowpan_frag_rb_t *rbuf,
gnrc_netif_hdr_t *netif);
#else
/* NOPs to be used with gnrc_sixlowpan_iphc if gnrc_sixlowpan_frag_rb is not
* compiled in */

View File

@ -476,12 +476,14 @@ void gnrc_sixlowpan_frag_rb_base_rm(gnrc_sixlowpan_frag_rb_base_t *entry)
entry->datagram_size = 0;
}
void gnrc_sixlowpan_frag_rb_dispatch_when_complete(gnrc_sixlowpan_frag_rb_t *rbuf,
int gnrc_sixlowpan_frag_rb_dispatch_when_complete(gnrc_sixlowpan_frag_rb_t *rbuf,
gnrc_netif_hdr_t *netif_hdr)
{
assert(rbuf);
assert(netif_hdr);
if (rbuf->super.current_size == rbuf->super.datagram_size) {
int res = (rbuf->super.current_size == rbuf->super.datagram_size);
if (res) {
gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(rbuf->super.src,
rbuf->super.src_len,
rbuf->super.dst,
@ -491,7 +493,7 @@ void gnrc_sixlowpan_frag_rb_dispatch_when_complete(gnrc_sixlowpan_frag_rb_t *rbu
DEBUG("6lo rbuf: error allocating netif header\n");
gnrc_pktbuf_release(rbuf->pkt);
gnrc_sixlowpan_frag_rb_remove(rbuf);
return;
return -1;
}
/* copy the transmit information of the latest fragment into the newly
@ -507,6 +509,7 @@ void gnrc_sixlowpan_frag_rb_dispatch_when_complete(gnrc_sixlowpan_frag_rb_t *rbu
gnrc_sixlowpan_dispatch_recv(rbuf->pkt, NULL, 0);
gnrc_sixlowpan_frag_rb_remove(rbuf);
}
return res;
}