1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/include/net/gnrc/sixlowpan/frag.h
Cenk Gündoğan e08fd546cf
Merge pull request #9353 from miri64/gnrc_sixlowpan/opt/rm-pad
gnrc_sixlowpan: fix order of gnrc_sixlowpan_msg_frag_t
2018-06-18 10:59:27 +02:00

104 lines
3.0 KiB
C

/*
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
* Copyright (C) 2015 Hamburg University of Applied Sciences
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup net_gnrc_sixlowpan_frag 6LoWPAN Fragmentation
* @ingroup net_gnrc_sixlowpan
* @brief 6LoWPAN Fragmentation headers and functionality
* @see <a href="https://tools.ietf.org/html/rfc4944#section-5.3">
* RFC 4944, section 5.3
* </a>
* @{
*
* @file
* @brief 6LoWPAN Fragmentation definitions
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
* @author Peter Kietzmann <peter.kietzmann@haw-hamburg.de>
*/
#ifndef NET_GNRC_SIXLOWPAN_FRAG_H
#define NET_GNRC_SIXLOWPAN_FRAG_H
#include <inttypes.h>
#include <stdbool.h>
#include "byteorder.h"
#include "kernel_types.h"
#include "net/gnrc/pkt.h"
#include "net/ieee802154.h"
#include "net/sixlowpan.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Message type for passing one 6LoWPAN fragment down the network stack
*/
#define GNRC_SIXLOWPAN_MSG_FRAG_SND (0x0225)
/**
* @brief An entry in the 6LoWPAN reassembly buffer.
*
* A recipient of a fragment SHALL use
*
* 1. the source address,
* 2. the destination address,
* 3. the datagram size (gnrc_pktsnip_t::size of rbuf_t::pkt), and
* 4. the datagram tag
*
* to identify all fragments that belong to the given datagram.
*
* @see [RFC 4944, section 5.3](https://tools.ietf.org/html/rfc4944#section-5.3)
*/
typedef struct {
/**
* @brief The reassembled packet in the packet buffer
*/
gnrc_pktsnip_t *pkt;
uint8_t src[IEEE802154_LONG_ADDRESS_LEN]; /**< source address */
uint8_t dst[IEEE802154_LONG_ADDRESS_LEN]; /**< destination address */
uint8_t src_len; /**< length of gnrc_sixlowpan_rbuf_t::src */
uint8_t dst_len; /**< length of gnrc_sixlowpan_rbuf_t::dst */
uint16_t tag; /**< the datagram's tag */
} gnrc_sixlowpan_rbuf_t;
/**
* @brief Definition of 6LoWPAN fragmentation type.
*/
typedef struct {
gnrc_pktsnip_t *pkt; /**< Pointer to the IPv6 packet to be fragmented */
size_t datagram_size; /**< Length of just the IPv6 packet to be fragmented */
uint16_t offset; /**< Offset of the Nth fragment from the beginning of the
* payload datagram */
kernel_pid_t pid; /**< PID of the interface */
} gnrc_sixlowpan_msg_frag_t;
/**
* @brief Sends a packet fragmented.
*
* @param[in] fragment_msg Message containing status of the 6LoWPAN
* fragmentation progress
*/
void gnrc_sixlowpan_frag_send(gnrc_sixlowpan_msg_frag_t *fragment_msg);
/**
* @brief Handles a packet containing a fragment header.
*
* @param[in] pkt The packet to handle.
*/
void gnrc_sixlowpan_frag_handle_pkt(gnrc_pktsnip_t *pkt);
#ifdef __cplusplus
}
#endif
#endif /* NET_GNRC_SIXLOWPAN_FRAG_H */
/** @} */