Loading...
Searching...
No Matches
rb.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019 Freie Universität Berlin
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
20#ifndef NET_GNRC_SIXLOWPAN_FRAG_RB_H
21#define NET_GNRC_SIXLOWPAN_FRAG_RB_H
22
23#include <stdint.h>
24#include <stdbool.h>
25#include <stdalign.h>
26
27#include "architecture.h"
28#include "net/gnrc/netif/hdr.h"
29#include "net/gnrc/pkt.h"
30#ifdef MODULE_GNRC_SIXLOWPAN_FRAG_SFR
31#include "net/sixlowpan/sfr.h"
32#endif /* MODULE_GNRC_SIXLOWPAN_FRAG_SFR */
33
35
36#ifdef __cplusplus
37extern "C" {
38#endif
42#define GNRC_SIXLOWPAN_FRAG_RB_GC_MSG (0x0226)
43
62
91
98typedef struct {
104#if IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_SFR) || defined(DOXYGEN)
113 int8_t offset_diff;
115#endif /* IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_SFR) */
117
135 gnrc_pktsnip_t *frag,
136 size_t offset, unsigned page);
137
158 const gnrc_netif_hdr_t *netif_hdr,
159 uint16_t tag);
160
180 uint16_t tag);
181
198 uint16_t tag);
199
209 const gnrc_sixlowpan_frag_rb_t *rbuf) {
210 return (rbuf->pkt == NULL);
211}
212
213#if defined(TEST_SUITES) || defined(DOXYGEN)
220
231#endif
232
239
244
263 gnrc_netif_hdr_t *netif);
264
265#if defined(MODULE_GNRC_SIXLOWPAN_FRAG_RB) || defined(DOXYGEN)
279{
280 assert(rbuf != NULL);
282 rbuf->pkt = NULL;
283}
284#else
285/* NOPs to be used with gnrc_sixlowpan_iphc if gnrc_sixlowpan_frag_rb is not
286 * compiled in */
288{
289 (void)rbuf;
290 return;
291}
292#endif
293
294#if defined(TEST_SUITES) || defined(DOXYGEN)
305#else /* defined(TEST_SUITES) || defined(DOXYGEN) */
306/* always true without TEST_SUITES defined to optimize out when not testing,
307 * as checking the status of the fragment interval pool is unnecessary in
308 * production */
309static inline bool gnrc_sixlowpan_frag_rb_ints_empty(void)
310{
311 return true;
312}
313#endif /* defined(TEST_SUITES) || defined(DOXYGEN) */
314
315#ifdef __cplusplus
316}
317#endif
318
319#endif /* NET_GNRC_SIXLOWPAN_FRAG_RB_H */
Platform-independent access to architecture details.
#define assert(cond)
abort the program if assertion is false
Definition assert.h:136
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)
Adds a new fragment to the reassembly buffer.
void gnrc_sixlowpan_frag_rb_reset(void)
Resets the packet buffer to a clean state.
static bool gnrc_sixlowpan_frag_rb_entry_empty(const gnrc_sixlowpan_frag_rb_t *rbuf)
Checks if a reassembly buffer entry is unset.
Definition rb.h:208
int gnrc_sixlowpan_frag_rb_dispatch_when_complete(gnrc_sixlowpan_frag_rb_t *rbuf, gnrc_netif_hdr_t *netif)
Checks if a reassembly buffer entry is complete and dispatches it to the next layer if that is the ca...
gnrc_sixlowpan_frag_rb_t * gnrc_sixlowpan_frag_rb_get_by_datagram(const gnrc_netif_hdr_t *netif_hdr, uint16_t tag)
Gets a reassembly buffer entry with a given link-layer address pair and tag.
bool gnrc_sixlowpan_frag_rb_ints_empty(void)
Check if pool of fragment intervals is empty.
static void gnrc_sixlowpan_frag_rb_remove(gnrc_sixlowpan_frag_rb_t *rbuf)
Unsets a reassembly buffer entry (but does not free rbuf_t::super::pkt)
Definition rb.h:278
void gnrc_sixlowpan_frag_rb_gc(void)
Garbage collect reassembly buffer.
const gnrc_sixlowpan_frag_rb_t * gnrc_sixlowpan_frag_rb_array(void)
Returns a pointer to the array representing the reassembly buffer.
void gnrc_sixlowpan_frag_rb_rm_by_datagram(const gnrc_netif_hdr_t *netif_hdr, uint16_t tag)
Removes a reassembly buffer entry with a given link-layer address pair and tag.
bool gnrc_sixlowpan_frag_rb_exists(const gnrc_netif_hdr_t *netif_hdr, uint16_t tag)
Checks if a reassembly buffer entry with a given link-layer address pair and tag exists.
void gnrc_sixlowpan_frag_rb_base_rm(gnrc_sixlowpan_frag_rb_base_t *entry)
Remove base entry.
struct gnrc_sixlowpan_frag_rb_int gnrc_sixlowpan_frag_rb_int_t
Fragment intervals to identify limits of fragments and duplicates.
#define IEEE802154_LONG_ADDRESS_LEN
long address (EUI-64)
Definition ieee802154.h:45
#define SIXLOWPAN_SFR_ACK_BITMAP_SIZE
Acknowledgment bitmap size in bits.
Definition sfr.h:55
Generic network interface header.
General definitions for network packets and their helper functions.
6LoWPAN selective fragment recovery dispatch type and helper function definitions.
Generic network interface header.
Definition hdr.h:126
Type to represent parts (either headers or payload) of a packet, called snips.
Definition pkt.h:108
Base class for both reassembly buffer and virtual reassembly buffer.
Definition rb.h:76
gnrc_sixlowpan_frag_rb_int_t * ints
intervals of already received fragments
Definition rb.h:77
uint16_t datagram_size
the datagram's size
Definition rb.h:83
uint16_t tag
the datagram's tag
Definition rb.h:82
uint8_t src_len
length of gnrc_sixlowpan_frag_rb_t::src
Definition rb.h:80
uint32_t arrival
time in microseconds of arrival of last received fragment
Definition rb.h:88
uint8_t dst_len
length of gnrc_sixlowpan_frag_rb_t::dst
Definition rb.h:81
uint16_t current_size
The number of bytes currently received of the complete datagram.
Definition rb.h:87
Fragment intervals to identify limits of fragments and duplicates.
Definition rb.h:54
struct gnrc_sixlowpan_frag_rb_int * next
next element in fragment interval list
Definition rb.h:58
uint16_t start
start byte of the fragment interval
Definition rb.h:59
uint16_t end
end byte of the fragment interval
Definition rb.h:60
An entry in the 6LoWPAN reassembly buffer.
Definition rb.h:98
gnrc_sixlowpan_frag_rb_base_t super
base class
Definition rb.h:99
gnrc_pktsnip_t * pkt
The reassembled packet in the packet buffer.
Definition rb.h:103
int8_t offset_diff
offset change due to recompression
Definition rb.h:113
BITFIELD(received, SIXLOWPAN_SFR_ACK_BITMAP_SIZE)
Bitmap for received fragments.
Configuration macros for 6LoWPAN.
Bitmap type to simplify comparisons.
Definition sfr_types.h:38