Loading...
Searching...
No Matches
sfr.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2019 Freie Universität Berlin
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
33
34#include "assert.h"
35#include "bitfield.h"
36#include "net/gnrc/pkt.h"
37#include "net/gnrc/netif.h"
42#include "net/sixlowpan/sfr.h"
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
51#define GNRC_SIXLOWPAN_FRAG_SFR_ARQ_TIMEOUT_MSG (0x0227)
52
56#define GNRC_SIXLOWPAN_FRAG_SFR_INTER_FRAG_GAP_MSG (0x0228)
57
61typedef struct {
63 struct {
64 uint32_t usual;
65 uint32_t aborts;
66 uint32_t forwarded;
67 } fragments_sent;
68 struct {
69 uint32_t by_nack;
70 uint32_t by_timeout;
71 } fragment_resends;
72 struct {
73 uint32_t full;
74 uint32_t partly;
75 uint32_t aborts;
76 uint32_t forwarded;
77 } acks;
79
84
93{
94 if (IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_SFR) &&
95 gnrc_netif_is_6lo(netif)) {
96#if IS_USED(MODULE_GNRC_NETIF_6LO)
98 netif->sixlo.max_frag_size =
101 : netif->sixlo.max_frag_size;
103#endif
104 }
105}
106
119{
120#if IS_USED(MODULE_GNRC_NETIF_6LO)
121 return IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_SFR) &&
122 gnrc_netif_is_6lo(netif) &&
124#else
125 (void)netif;
126 return false;
127#endif
128}
129
144 unsigned page);
145
153void gnrc_sixlowpan_frag_sfr_recv(gnrc_pktsnip_t *pkt, void *ctx, unsigned page);
154
172 unsigned page);
173
181
189
190#if IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_SFR_STATS)
196void gnrc_sixlowpan_frag_sfr_stats_get(gnrc_sixlowpan_frag_sfr_stats_t *stats);
197#endif /* IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_SFR_STATS) */
198
199#ifdef __cplusplus
200}
201#endif
202
#define GNRC_NETIF_6LO_LOCAL_FLAGS_SFR
Selective Fragment Recovery enabled.
Definition 6lo.h:43
POSIX.1-2008 compliant version of the assert macro.
#define assert(cond)
abort the program if assertion is false
Definition assert.h:143
Bitfield operations on bitfields of arbitrary length.
Fragmentation buffer definitions.
Definition for GNRC's network interfaces.
struct gnrc_pktsnip gnrc_pktsnip_t
Type to represent parts (either headers or payload) of a packet, called snips.
#define CONFIG_GNRC_SIXLOWPAN_SFR_OPT_FRAG_SIZE
Default value for fragment size that the sender should use to start with (OptFragmentSize)
Definition config.h:203
#define CONFIG_GNRC_SIXLOWPAN_SFR_MIN_FRAG_SIZE
Default minimum value for fragment size (MinFragmentSize)
Definition config.h:180
int gnrc_sixlowpan_frag_sfr_forward(gnrc_pktsnip_t *pkt, sixlowpan_sfr_rfrag_t *rfrag, gnrc_sixlowpan_frag_vrb_t *vrbe, unsigned page)
Forward a fragment via selective fragment recovery.
void gnrc_sixlowpan_frag_sfr_arq_timeout(gnrc_sixlowpan_frag_fb_t *fbuf)
Handles an Acknowledgment request timeout.
void gnrc_sixlowpan_frag_sfr_recv(gnrc_pktsnip_t *pkt, void *ctx, unsigned page)
Handles a packet containing a selective fragment recovery header.
void gnrc_sixlowpan_frag_sfr_send(gnrc_pktsnip_t *pkt, void *ctx, unsigned page)
Sends a packet via selective fragment recovery.
void gnrc_sixlowpan_frag_sfr_init(void)
Initialize selective fragment recovery.
static bool gnrc_sixlowpan_frag_sfr_netif(gnrc_netif_t *netif)
Checks if a network interface is configured for selective fragment recovery.
Definition sfr.h:118
void gnrc_sixlowpan_frag_sfr_inter_frame_gap(gnrc_sixlowpan_frag_fb_t *fbuf)
Handles inter frame gap.
static void gnrc_sixlowpan_frag_sfr_init_iface(gnrc_netif_t *netif)
Initialize a network interface for selective fragment recovery.
Definition sfr.h:92
#define IS_USED(module)
Checks whether a module is being used or not.
Definition modules.h:67
General definitions for network packets and their helper functions.
6LoWPAN selective fragment recovery type definitions for GNRC
6LoWPAN selective fragment recovery dispatch type and helper function definitions.
uint16_t max_frag_size
Maximum fragment size for 6Lo fragmentation.
Definition 6lo.h:56
uint8_t local_flags
6LoWPAN capability flags beyond the ones advertised in 6LoWPAN Capability Indication Option (6CIO)
Definition 6lo.h:65
Representation of a network interface.
Definition netif.h:137
gnrc_netif_6lo_t sixlo
6Lo component
Definition netif.h:209
6LoWPAN fragmentation buffer entry.
Definition fb.h:44
Stats on selective fragment recovery.
Definition sfr.h:61
uint32_t usual
non-abort fragments sent
Definition sfr.h:64
uint32_t full
full RFRAGs ACKs sent
Definition sfr.h:73
uint32_t forwarded
forwarded fragments
Definition sfr.h:66
uint32_t by_timeout
fragments resent due to an ARQ timeout
Definition sfr.h:70
uint32_t datagram_resends
datagrams resent
Definition sfr.h:62
uint32_t by_nack
fragments resent due to a 0 in ACK's bitmap
Definition sfr.h:69
uint32_t partly
partly ACKing RFRAGs sent
Definition sfr.h:74
uint32_t aborts
abort pseudo-fragments sent
Definition sfr.h:65
Representation of the virtual reassembly buffer entry.
Definition vrb.h:45
Recoverable fragment header.
Definition sfr.h:93
Configuration macros for 6LoWPAN.
Virtual reassembly buffer definitions.