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>
|
|
|
|
*/
|
2015-08-17 15:41:29 +02:00
|
|
|
#ifndef GNRC_SIXLOWPAN_IPHC_H_
|
|
|
|
#define 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-08-17 15:41:29 +02:00
|
|
|
* @pre (ipv6 != NULL) && (ipv6->size >= sizeof(gnrc_ipv6_hdr_t))
|
2015-04-13 12:48:53 +02:00
|
|
|
*
|
2015-08-11 23:24:01 +02:00
|
|
|
* @param[out] ipv6 A pre-allocated IPv6 header. Will not be inserted into
|
|
|
|
* @p pkt
|
|
|
|
* @param[in,out] pkt A received 6LoWPAN IPHC frame. IPHC dispatch will not
|
|
|
|
* be marked.
|
2015-08-17 15:41:29 +02:00
|
|
|
* @param[in] offset Offset of the IPHC dispatch in 6LoWPaN frame.
|
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-08-17 15:41:29 +02:00
|
|
|
size_t gnrc_sixlowpan_iphc_decode(gnrc_pktsnip_t *ipv6, gnrc_pktsnip_t *pkt, size_t offset);
|
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
|
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
#endif /* GNRC_SIXLOWPAN_IPHC_H_ */
|
2015-04-13 12:48:53 +02:00
|
|
|
/** @} */
|