2016-06-23 15:06:24 +02:00
|
|
|
/** @file
|
|
|
|
@brief 6lowpan handler
|
|
|
|
|
|
|
|
This is not to be included by the application.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Intel Corporation
|
|
|
|
*
|
2017-01-19 02:01:01 +01:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-06-23 15:06:24 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __NET_6LO_H
|
|
|
|
#define __NET_6LO_H
|
|
|
|
|
2019-06-26 16:33:52 +02:00
|
|
|
#include <sys/slist.h>
|
Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t. This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.
We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.
We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.
Jira: ZEP-2051
Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-19 17:32:08 +02:00
|
|
|
#include <zephyr/types.h>
|
2016-06-23 15:06:24 +02:00
|
|
|
|
2017-04-03 17:14:35 +02:00
|
|
|
#include <net/net_pkt.h>
|
2016-10-05 16:20:06 +02:00
|
|
|
#include "icmpv6.h"
|
2016-06-23 15:06:24 +02: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.
|
|
|
|
*
|
2017-04-05 08:37:44 +02:00
|
|
|
* @param Pointer to network packet
|
2016-07-11 10:03:30 +02:00
|
|
|
* @param iphc true for IPHC compression, false for IPv6 dispatch header
|
2016-06-23 15:06:24 +02:00
|
|
|
*
|
2018-10-24 09:52:01 +02:00
|
|
|
* @return header size difference on success (>= 0), negative errno otherwise
|
2016-06-23 15:06:24 +02:00
|
|
|
*/
|
2019-02-14 14:33:22 +01:00
|
|
|
#if defined(CONFIG_NET_6LO)
|
2018-10-24 09:52:01 +02:00
|
|
|
int net_6lo_compress(struct net_pkt *pkt, bool iphc);
|
2019-02-14 14:33:22 +01:00
|
|
|
#else
|
|
|
|
static inline int net_6lo_compress(struct net_pkt *pkt, bool iphc)
|
|
|
|
{
|
|
|
|
ARG_UNUSED(pkt);
|
|
|
|
ARG_UNUSED(iphc);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
2016-06-23 15:06:24 +02:00
|
|
|
|
|
|
|
/**
|
2017-04-19 20:05:01 +02:00
|
|
|
* @brief Uncompress IPv6 packet as per RFC 6282
|
2016-06-23 15:06:24 +02:00
|
|
|
*
|
|
|
|
* @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.
|
|
|
|
*
|
2017-04-05 08:37:44 +02:00
|
|
|
* @param Pointer to network packet
|
2016-06-23 15:06:24 +02:00
|
|
|
*
|
2016-07-07 17:14:08 +02:00
|
|
|
* @return True on success, false otherwise
|
2016-06-23 15:06:24 +02:00
|
|
|
*/
|
2019-02-14 14:33:22 +01:00
|
|
|
#if defined(CONFIG_NET_6LO)
|
2017-04-05 08:37:44 +02:00
|
|
|
bool net_6lo_uncompress(struct net_pkt *pkt);
|
2019-02-14 14:33:22 +01:00
|
|
|
#else
|
|
|
|
static inline bool net_6lo_uncompress(struct net_pkt *pkt)
|
|
|
|
{
|
|
|
|
ARG_UNUSED(pkt);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#endif
|
2016-06-23 15:06:24 +02:00
|
|
|
|
2016-10-05 16:20:06 +02: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
|
2018-10-24 09:52:01 +02:00
|
|
|
|
2019-02-21 19:38:11 +01:00
|
|
|
/**
|
|
|
|
* @brief Return the header size difference after uncompression
|
|
|
|
*
|
|
|
|
* @details This will do a dry-run on uncompressing the headers.
|
|
|
|
* The point is only to calculate the difference.
|
|
|
|
*
|
|
|
|
* @param Pointer to network packet
|
|
|
|
*
|
|
|
|
* @return header difference or INT_MAX in case of error.
|
|
|
|
*/
|
|
|
|
#if defined(CONFIG_NET_6LO)
|
|
|
|
int net_6lo_uncompress_hdr_diff(struct net_pkt *pkt);
|
|
|
|
#endif
|
|
|
|
|
2016-06-23 15:06:24 +02:00
|
|
|
#endif /* __NET_6LO_H */
|