2015-04-30 21:27:17 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2016-06-05 23:05:59 +02:00
|
|
|
* @defgroup net_gnrc_rpl_srh RPL source routing header extension
|
2015-08-17 15:41:29 +02:00
|
|
|
* @ingroup net_gnrc_rpl
|
2015-04-30 21:27:17 +02:00
|
|
|
* @brief Implementation of RPL source routing extension headers
|
|
|
|
* @see <a href="https://tools.ietf.org/html/rfc6554">
|
|
|
|
* RFC 6554
|
|
|
|
* </a>
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Definititions for RPL source routing extension headers
|
|
|
|
*
|
|
|
|
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
|
|
|
|
*/
|
2017-05-23 18:19:52 +02:00
|
|
|
#ifndef NET_GNRC_RPL_SRH_H
|
|
|
|
#define NET_GNRC_RPL_SRH_H
|
2015-04-30 21:27:17 +02:00
|
|
|
|
2016-01-24 11:45:41 +01:00
|
|
|
#include "net/ipv6/hdr.h"
|
2015-08-10 00:26:36 +02:00
|
|
|
#include "net/ipv6/addr.h"
|
2015-04-30 21:27:17 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The RPL Source routing header.
|
|
|
|
*
|
|
|
|
* @see <a href="https://tools.ietf.org/html/rfc6554">
|
|
|
|
* RFC 6554
|
|
|
|
* </a>
|
|
|
|
*
|
2015-08-09 23:53:40 +02:00
|
|
|
* @extends ipv6_ext_rh_t
|
2015-04-30 21:27:17 +02:00
|
|
|
*/
|
|
|
|
typedef struct __attribute__((packed)) {
|
|
|
|
uint8_t nh; /**< next header */
|
|
|
|
uint8_t len; /**< length in 8 octets without first octet */
|
|
|
|
uint8_t type; /**< identifier of a particular routing header type */
|
|
|
|
uint8_t seg_left; /**< number of route segments remaining */
|
2016-01-24 11:45:41 +01:00
|
|
|
uint8_t compr; /**< number of prefix octets (comprI and comprE) */
|
|
|
|
uint8_t pad_resv; /**< padding and reserved */
|
|
|
|
uint16_t resv; /**< reserved */
|
2015-08-17 15:41:29 +02:00
|
|
|
} gnrc_rpl_srh_t;
|
2015-04-30 21:27:17 +02:00
|
|
|
|
|
|
|
/**
|
2016-01-24 11:45:41 +01:00
|
|
|
* @brief Process the RPL source routing header.
|
2015-04-30 21:27:17 +02:00
|
|
|
*
|
2018-10-24 18:55:06 +02:00
|
|
|
* @pre `rh->seq_left > 0`; The 0 case means the destination is reached and
|
|
|
|
* common among all routing headers, so it should be handled by an
|
|
|
|
* external routing header handler.
|
|
|
|
*
|
2018-10-24 16:44:25 +02:00
|
|
|
* @param[in, out] ipv6 The IPv6 header of the incoming packet.
|
2015-04-30 21:27:17 +02:00
|
|
|
* @param[in] rh A RPL source routing header.
|
2018-10-24 16:44:25 +02:00
|
|
|
* @param[out] err_ptr A pointer to an erroneous octet within @p rh when
|
|
|
|
* return value is @ref GNRC_IPV6_EXT_RH_ERROR. For any
|
|
|
|
* other return value than @ref GNRC_IPV6_EXT_RH_ERROR the
|
|
|
|
* value of `err_ptr` is not defined.
|
2015-04-30 21:27:17 +02:00
|
|
|
*
|
2018-10-25 11:11:50 +02:00
|
|
|
* @return @ref GNRC_IPV6_EXT_RH_AT_DST, on success
|
2018-10-23 19:34:46 +02:00
|
|
|
* @return @ref GNRC_IPV6_EXT_RH_FORWARDED, when @p pkt *should be* forwarded
|
|
|
|
* @return @ref GNRC_IPV6_EXT_RH_ERROR, on error
|
2015-04-30 21:27:17 +02:00
|
|
|
*/
|
2018-10-24 16:44:25 +02:00
|
|
|
int gnrc_rpl_srh_process(ipv6_hdr_t *ipv6, gnrc_rpl_srh_t *rh, void **err_ptr);
|
2015-04-30 21:27:17 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-05-23 18:19:52 +02:00
|
|
|
#endif /* NET_GNRC_RPL_SRH_H */
|
2015-04-30 21:27:17 +02:00
|
|
|
/** @} */
|