Loading...
Searching...
No Matches
fb.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_FB_H
21#define NET_GNRC_SIXLOWPAN_FRAG_FB_H
22
23#include <stdbool.h>
24#include <stdint.h>
25
26#include "msg.h"
27#include "net/gnrc/pkt.h"
28#ifdef MODULE_GNRC_SIXLOWPAN_FRAG_HINT
30#endif /* MODULE_GNRC_SIXLOWPAN_FRAG_HINT */
31#if IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_SFR)
33#endif
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
42#define GNRC_SIXLOWPAN_FRAG_FB_SND_MSG (0x0225)
43
47typedef struct {
55 uint16_t datagram_size;
56 uint16_t tag;
57 uint16_t offset;
59#if IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_SFR)
64#endif /* IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_SFR) */
65#ifdef MODULE_GNRC_SIXLOWPAN_FRAG_HINT
71#endif /* MODULE_GNRC_SIXLOWPAN_FRAG_HINT */
73
74#ifdef TEST_SUITES
81#endif
82
90
100
107
108#if defined(TEST_SUITES) && !defined(DOXYGEN)
109#include "sched.h"
110
111/* can't include `net/sixlowpan.h` as this would create a cyclical include */
113#endif
114
126{
127 msg_t msg;
128
129 msg.content.ptr = fbuf;
131#ifdef TEST_SUITES
132 return (msg_try_send(&msg, gnrc_sixlowpan_get_pid()) > 0);
133#else
134 return (msg_send_to_self(&msg) != 0);
135#endif
136}
137
138#ifdef __cplusplus
139}
140#endif
141
142#endif /* NET_GNRC_SIXLOWPAN_FRAG_FB_H */
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:139
#define GNRC_SIXLOWPAN_FRAG_FB_SND_MSG
Message type for passing one 6LoWPAN fragment down the network stack.
Definition fb.h:42
gnrc_sixlowpan_frag_fb_t * gnrc_sixlowpan_frag_fb_get(void)
Allocates a fragmentation buffer entry.
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:125
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_by_tag(uint16_t tag)
Get an existing fragmentation buffer entry by a given tag.
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:108
6LoWPAN fragmentation buffer entry.
Definition fb.h:47
uint16_t offset
Offset of the Nth fragment from the beginning of the payload datagram.
Definition fb.h:57
gnrc_pktsnip_t * pkt
Pointer to the IPv6 packet to be fragmented.
Definition fb.h:48
uint16_t tag
Tag used for the fragment.
Definition fb.h:56
uint16_t datagram_size
Length of just the (uncompressed) IPv6 packet to be fragmented.
Definition fb.h:55
A fragment size hint.
Definition hint.h:33
Extension for 6LoWPAN fragmentation buffer for selective fragment recovery.
Definition sfr_types.h:47
Describes a message object which can be sent between threads.
Definition msg.h:196
uint16_t type
Type field.
Definition msg.h:199
union msg_t::@1 content
Content of the message.
void * ptr
Pointer content field.
Definition msg.h:201