fb.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 
20 #include <stdbool.h>
21 #include <stdint.h>
22 
23 #include "msg.h"
24 #include "net/gnrc/pkt.h"
25 #ifdef MODULE_GNRC_SIXLOWPAN_FRAG_HINT
27 #endif /* MODULE_GNRC_SIXLOWPAN_FRAG_HINT */
28 #if IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_SFR)
30 #endif
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
39 #define GNRC_SIXLOWPAN_FRAG_FB_SND_MSG (0x0225)
40 
44 typedef struct {
52  uint16_t datagram_size;
53  uint16_t tag;
54  uint16_t offset;
56 #if IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_SFR)
61 #endif /* IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_SFR) */
62 #ifdef MODULE_GNRC_SIXLOWPAN_FRAG_HINT
68 #endif /* MODULE_GNRC_SIXLOWPAN_FRAG_HINT */
70 
71 #ifdef TEST_SUITES
78 #endif
79 
87 
97 
104 
105 #if defined(TEST_SUITES) && !defined(DOXYGEN)
106 #include "sched.h"
107 
108 /* can't include `net/sixlowpan.h` as this would create a cyclical include */
110 #endif
111 
123 {
124  msg_t msg;
125 
126  msg.content.ptr = fbuf;
128 #ifdef TEST_SUITES
129  return (msg_try_send(&msg, gnrc_sixlowpan_get_pid()) > 0);
130 #else
131  return (msg_send_to_self(&msg) != 0);
132 #endif
133 }
134 
135 #ifdef __cplusplus
136 }
137 #endif
138 
int msg_send_to_self(msg_t *m)
Send a message to the current thread.
int msg_try_send(msg_t *m, kernel_pid_t target_pid)
Send a message (non-blocking).
int16_t kernel_pid_t
Unique process identifier.
Definition: sched.h:135
#define GNRC_SIXLOWPAN_FRAG_FB_SND_MSG
Message type for passing one 6LoWPAN fragment down the network stack.
Definition: fb.h:39
gnrc_sixlowpan_frag_fb_t * gnrc_sixlowpan_frag_fb_get_by_tag(uint16_t tag)
Get an existing fragmentation buffer entry by a given tag.
static bool gnrc_sixlowpan_frag_fb_send(gnrc_sixlowpan_frag_fb_t *fbuf)
Sends a message to pass a further fragment down the network stack.
Definition: fb.h:122
void gnrc_sixlowpan_frag_fb_reset(void)
Reset fragmentation buffer.
uint16_t gnrc_sixlowpan_frag_fb_next_tag(void)
Generate a new datagram tag for sending.
gnrc_sixlowpan_frag_fb_t * gnrc_sixlowpan_frag_fb_get(void)
Allocates a fragmentation buffer entry.
Definitions to provide a hint on the final fragment size.
General definitions for network packets and their helper functions.
Scheduler API definition.
6LoWPAN selective fragment recovery type definitions for GNRC
kernel_pid_t gnrc_sixlowpan_get_pid(void)
Returns the PID of the 6Lo thread.
Type to represent parts (either headers or payload) of a packet, called snips.
Definition: pkt.h:105
6LoWPAN fragmentation buffer entry.
Definition: fb.h:44
uint16_t offset
Offset of the Nth fragment from the beginning of the payload datagram.
Definition: fb.h:54
gnrc_pktsnip_t * pkt
Pointer to the IPv6 packet to be fragmented.
Definition: fb.h:45
uint16_t tag
Tag used for the fragment.
Definition: fb.h:53
uint16_t datagram_size
Length of just the (uncompressed) IPv6 packet to be fragmented.
Definition: fb.h:52
A fragment size hint.
Definition: hint.h:30
Extension for 6LoWPAN fragmentation buffer for selective fragment recovery.
Definition: sfr_types.h:44
Describes a message object which can be sent between threads.
Definition: msg.h:192
uint16_t type
Type field.
Definition: msg.h:195
union msg_t::@1 content
Content of the message.
void * ptr
Pointer content field.
Definition: msg.h:197