2016-06-23 21:06:24 +08:00
|
|
|
/** @file
|
|
|
|
@brief 6lowpan handler
|
|
|
|
|
|
|
|
This is not to be included by the application.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Intel Corporation
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-06-23 21:06:24 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __NET_6LO_H
|
|
|
|
#define __NET_6LO_H
|
|
|
|
|
|
|
|
#include <misc/slist.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include <net/nbuf.h>
|
2016-10-05 22:20:06 +08:00
|
|
|
#include "icmpv6.h"
|
2016-06-23 21:06:24 +08:00
|
|
|
|
2016-07-11 16:21:57 +08:00
|
|
|
typedef bool (*fragment_handler_t)(struct net_buf *, int);
|
|
|
|
|
2016-06-23 21:06:24 +08:00
|
|
|
/**
|
|
|
|
* @brief Compress IPv6 packet as per RFC 6282
|
|
|
|
*
|
|
|
|
* @details After this IPv6 packet and next header(if UDP), headers
|
|
|
|
* are compressed as per RFC 6282. After header compression data
|
|
|
|
* will be adjusted according to remaining space in fragments.
|
|
|
|
*
|
|
|
|
* @param Pointer to network buffer
|
2016-07-11 16:03:30 +08:00
|
|
|
* @param iphc true for IPHC compression, false for IPv6 dispatch header
|
2016-07-11 16:21:57 +08:00
|
|
|
* @param Pointer to fragment function
|
2016-06-23 21:06:24 +08:00
|
|
|
*
|
2016-07-07 23:14:08 +08:00
|
|
|
* @return True on success, false otherwise
|
2016-06-23 21:06:24 +08:00
|
|
|
*/
|
2016-07-11 16:21:57 +08:00
|
|
|
bool net_6lo_compress(struct net_buf *buf, bool iphc,
|
|
|
|
fragment_handler_t fragment);
|
2016-06-23 21:06:24 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Unompress IPv6 packet as per RFC 6282
|
|
|
|
*
|
|
|
|
* @details After this IPv6 packet and next header(if UDP), headers
|
|
|
|
* are uncompressed as per RFC 6282. After header uncompression data
|
|
|
|
* will be adjusted according to remaining space in fragments.
|
|
|
|
*
|
|
|
|
* @param Pointer to network buffer
|
|
|
|
*
|
2016-07-07 23:14:08 +08:00
|
|
|
* @return True on success, false otherwise
|
2016-06-23 21:06:24 +08:00
|
|
|
*/
|
2016-07-07 23:14:08 +08:00
|
|
|
bool net_6lo_uncompress(struct net_buf *buf);
|
2016-06-23 21:06:24 +08:00
|
|
|
|
2016-10-05 22:20:06 +08:00
|
|
|
/**
|
|
|
|
* @brief Set 6lowpan context information
|
|
|
|
*
|
|
|
|
* @details Set 6lowpan context information. This context information
|
|
|
|
* will be used in IPv6 header compression and uncompression.
|
|
|
|
*
|
|
|
|
* @return True on success, false otherwise
|
|
|
|
*/
|
|
|
|
#if defined(CONFIG_NET_6LO_CONTEXT)
|
|
|
|
void net_6lo_set_context(struct net_if *iface,
|
|
|
|
struct net_icmpv6_nd_opt_6co *context);
|
|
|
|
#endif
|
2016-06-23 21:06:24 +08:00
|
|
|
#endif /* __NET_6LO_H */
|