2015-04-13 12:48:53 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2015-08-17 15:41:29 +02:00
|
|
|
* @defgroup net_gnrc_sixlowpan_iphc IPv6 header compression (IPHC)
|
|
|
|
* @ingroup net_gnrc_sixlowpan
|
2015-04-13 12:48:53 +02:00
|
|
|
* @brief IPv6 header compression for 6LoWPAN.
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief 6LoWPAN IPHC definitions
|
|
|
|
*
|
|
|
|
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
|
|
|
|
*/
|
2017-05-23 18:19:52 +02:00
|
|
|
#ifndef NET_GNRC_SIXLOWPAN_IPHC_H
|
|
|
|
#define NET_GNRC_SIXLOWPAN_IPHC_H
|
2015-04-13 12:48:53 +02:00
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
#include "net/gnrc/pkt.h"
|
2015-08-17 15:06:44 +02:00
|
|
|
#include "net/sixlowpan.h"
|
2015-04-13 12:48:53 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Decompresses a received 6LoWPAN IPHC frame.
|
|
|
|
*
|
2015-12-15 19:59:05 +01:00
|
|
|
* @pre (dec_hdr != NULL) && (*dec_hdr != NULL) && ((*dec_hdr)->size >= sizeof(gnrc_ipv6_hdr_t))
|
2015-04-13 12:48:53 +02:00
|
|
|
*
|
2015-12-15 19:59:05 +01:00
|
|
|
* @param[out] dec_hdr A pre-allocated IPv6 header. Will not be inserted into
|
|
|
|
* @p pkt. May change due to next headers being added in NHC.
|
|
|
|
* @param[in] pkt A received 6LoWPAN IPHC frame. IPHC dispatch will not
|
2015-08-20 12:35:44 +02:00
|
|
|
* be marked.
|
|
|
|
* @param[in] datagram_size Size of the full uncompressed IPv6 datagram. May be 0, if @p pkt
|
|
|
|
* contains the full (unfragmented) IPv6 datagram.
|
|
|
|
* @param[in] offset Offset of the IPHC dispatch in 6LoWPaN frame.
|
2017-03-02 18:15:46 +01:00
|
|
|
* @param[in, out] nh_len Pointer to next header length
|
2015-08-11 23:24:01 +02:00
|
|
|
*
|
|
|
|
* @return length of the HC dispatches + inline values on success.
|
|
|
|
* @return 0 on error.
|
2015-04-13 12:48:53 +02:00
|
|
|
*/
|
2015-12-15 19:59:05 +01:00
|
|
|
size_t gnrc_sixlowpan_iphc_decode(gnrc_pktsnip_t **dec_hdr, gnrc_pktsnip_t *pkt,
|
2016-03-01 17:59:43 +01:00
|
|
|
size_t datagram_size, size_t offset,
|
|
|
|
size_t *nh_len);
|
2015-04-13 12:48:53 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Compresses a 6LoWPAN for IPHC.
|
|
|
|
*
|
|
|
|
* @param[in,out] pkt A 6LoWPAN frame with an uncompressed IPv6 header to
|
|
|
|
* send. Will be translated to an 6LoWPAN IPHC frame.
|
|
|
|
*
|
|
|
|
* @return true, on success
|
|
|
|
* @return false, on error.
|
|
|
|
*/
|
2015-08-17 15:41:29 +02:00
|
|
|
bool gnrc_sixlowpan_iphc_encode(gnrc_pktsnip_t *pkt);
|
2015-04-13 12:48:53 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-05-23 18:19:52 +02:00
|
|
|
#endif /* NET_GNRC_SIXLOWPAN_IPHC_H */
|
2015-04-13 12:48:53 +02:00
|
|
|
/** @} */
|