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 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 #define GNRC_SIXLOWPAN_FRAG_FB_SND_MSG (0x0225)
37 
41 typedef struct {
43  uint16_t datagram_size;
44  uint16_t tag;
45  uint16_t offset;
47 #ifdef MODULE_GNRC_SIXLOWPAN_FRAG_HINT
48 
53 #endif /* MODULE_GNRC_SIXLOWPAN_FRAG_HINT */
55 
56 #ifdef TEST_SUITES
57 
63 #endif
64 
72 
82 
88 uint16_t gnrc_sixlowpan_frag_fb_next_tag(void);
89 
90 #if defined(TEST_SUITES) && !defined(DOXYGEN)
91 #include "kernel_types.h"
92 
93 /* can't include `net/sixlowpan.h` as this would create a cyclical include */
95 #endif
96 
108 {
109  msg_t msg;
110 
111  msg.content.ptr = fbuf;
113 #ifdef TEST_SUITES
114  return (msg_try_send(&msg, gnrc_sixlowpan_get_pid()) > 0);
115 #else
116  return (msg_send_to_self(&msg) != 0);
117 #endif
118 }
119 
120 #ifdef __cplusplus
121 }
122 #endif
123 
124 #endif /* NET_GNRC_SIXLOWPAN_FRAG_FB_H */
125 
Types used by the kernel.
kernel_pid_t gnrc_sixlowpan_get_pid(void)
Returns the PID of the 6Lo thread.
int msg_send_to_self(msg_t *m)
Send a message to the current thread.
void gnrc_sixlowpan_frag_fb_reset(void)
Reset fragmentation buffer.
General definitions for network packets and their helper functions.
union msg_t::@2 content
Content of the message.
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.
int16_t kernel_pid_t
Unique process identifier.
Definition: kernel_types.h:83
uint16_t tag
Tag used for the fragment.
Definition: fb.h:44
#define GNRC_SIXLOWPAN_FRAG_FB_SND_MSG
Message type for passing one 6LoWPAN fragment down the network stack.
Definition: fb.h:36
uint16_t offset
Offset of the Nth fragment from the beginning of the payload datagram.
Definition: fb.h:45
int msg_try_send(msg_t *m, kernel_pid_t target_pid)
Send a message (non-blocking).
A fragment size hint.
Definition: hint.h:33
Messaging API for inter process communication.
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:107
6LoWPAN fragmentation buffer entry.
Definition: fb.h:41
Describes a message object which can be sent between threads.
Definition: msg.h:184
gnrc_sixlowpan_frag_fb_t * gnrc_sixlowpan_frag_fb_get(void)
Allocates a fragmentation buffer entry.
gnrc_pktsnip_t * pkt
Pointer to the IPv6 packet to be fragmented.
Definition: fb.h:42
uint16_t datagram_size
Length of just the (uncompressed) IPv6 packet to be fragmented.
Definition: fb.h:43
Type to represent parts (either headers or payload) of a packet, called snips.
Definition: pkt.h:107
uint16_t gnrc_sixlowpan_frag_fb_next_tag(void)
Generate a new datagram tag for sending.
void * ptr
Pointer content field.
Definition: msg.h:189
uint16_t type
Type field.
Definition: msg.h:187