2015-04-01 17:29:07 +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_icmpv6_error ICMPv6 error messages
|
|
|
|
* @ingroup net_gnrc_icmpv6
|
2015-04-01 17:29:07 +02:00
|
|
|
* @brief ICMPv6 error message handling and creation
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief ICMPv6 error message definitions
|
|
|
|
*
|
|
|
|
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
|
|
|
|
*/
|
2017-05-23 18:19:52 +02:00
|
|
|
#ifndef NET_GNRC_ICMPV6_ERROR_H
|
|
|
|
#define NET_GNRC_ICMPV6_ERROR_H
|
2015-04-01 17:29:07 +02:00
|
|
|
|
2016-01-23 16:10:44 +01:00
|
|
|
#include <errno.h>
|
2015-06-10 04:02:10 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "net/icmpv6.h"
|
|
|
|
#include "net/ipv6/hdr.h"
|
2016-01-23 16:10:44 +01:00
|
|
|
#include "net/gnrc/ipv6.h"
|
|
|
|
#include "net/gnrc/netapi.h"
|
2015-06-10 04:02:10 +02:00
|
|
|
#include "net/gnrc/pkt.h"
|
|
|
|
|
2015-04-01 17:29:07 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2018-11-14 13:54:12 +01:00
|
|
|
#if defined(MODULE_GNRC_ICMPV6_ERROR) || defined(DOXYGEN)
|
2016-01-23 16:10:44 +01:00
|
|
|
/**
|
|
|
|
* @brief Sends an ICMPv6 destination unreachable message for sending.
|
|
|
|
*
|
2018-11-17 15:22:01 +01:00
|
|
|
* @pre @p orig_pkt contains a packet snip of type @ref GNRC_NETTYPE_IPV6
|
2018-11-14 16:23:54 +01:00
|
|
|
*
|
2018-11-17 01:53:10 +01:00
|
|
|
* @note Won't send if source address of @p orig_pkt is unspecified or
|
|
|
|
* multicast
|
|
|
|
*
|
2018-11-14 16:24:30 +01:00
|
|
|
* @param[in] code The [code for the message](@ref net_icmpv6_error_dst_unr_codes).
|
2016-01-23 16:10:44 +01:00
|
|
|
* @param[in] orig_pkt The invoking packet.
|
|
|
|
*/
|
2018-11-14 14:23:31 +01:00
|
|
|
void gnrc_icmpv6_error_dst_unr_send(uint8_t code, const gnrc_pktsnip_t *orig_pkt);
|
2016-01-23 16:10:44 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sends an ICMPv6 packet too big message for sending.
|
|
|
|
*
|
2018-11-17 15:22:01 +01:00
|
|
|
* @pre @p orig_pkt contains a packet snip of type @ref GNRC_NETTYPE_IPV6
|
2018-11-14 16:23:54 +01:00
|
|
|
*
|
2018-11-17 01:53:10 +01:00
|
|
|
* @note Won't send if source address of @p orig_pkt is unspecified or
|
|
|
|
* multicast
|
|
|
|
*
|
2016-01-23 16:10:44 +01:00
|
|
|
* @param[in] mtu The maximum transission unit of the next-hop link.
|
|
|
|
* @param[in] orig_pkt The invoking packet.
|
|
|
|
*/
|
2018-11-14 14:23:31 +01:00
|
|
|
void gnrc_icmpv6_error_pkt_too_big_send(uint32_t mtu,
|
|
|
|
const gnrc_pktsnip_t *orig_pkt);
|
2016-01-23 16:10:44 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sends an ICMPv6 time exceeded message for sending.
|
|
|
|
*
|
2018-11-17 15:22:01 +01:00
|
|
|
* @pre @p orig_pkt contains a packet snip of type @ref GNRC_NETTYPE_IPV6
|
2018-11-14 16:23:54 +01:00
|
|
|
*
|
2018-11-17 01:53:10 +01:00
|
|
|
* @note Won't send if source address of @p orig_pkt is unspecified or
|
|
|
|
* multicast
|
|
|
|
*
|
2018-11-14 16:24:30 +01:00
|
|
|
* @param[in] code The [code for the message](@ref net_icmpv6_error_time_exc_codes).
|
2016-01-23 16:10:44 +01:00
|
|
|
* @param[in] orig_pkt The invoking packet.
|
|
|
|
*/
|
2018-11-14 14:23:31 +01:00
|
|
|
void gnrc_icmpv6_error_time_exc_send(uint8_t code,
|
|
|
|
const gnrc_pktsnip_t *orig_pkt);
|
2016-01-23 16:10:44 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sends an ICMPv6 parameter problem message for sending.
|
|
|
|
*
|
2018-11-17 15:22:01 +01:00
|
|
|
* @pre @p orig_pkt is in receive order.
|
|
|
|
* @pre @p orig_pkt contains a packet snip of type @ref GNRC_NETTYPE_IPV6
|
2018-11-14 16:17:32 +01:00
|
|
|
*
|
2018-11-17 01:53:10 +01:00
|
|
|
* @note Won't send if source address of @p orig_pkt is unspecified or
|
|
|
|
* multicast
|
2018-11-14 16:24:30 +01:00
|
|
|
*
|
|
|
|
* @param[in] code The [code for the message](@ref net_icmpv6_error_param_prob_codes).
|
2019-10-23 21:16:22 +02:00
|
|
|
* @param[in] ptr Pointer to the erroneous octet in @p orig_pkt.
|
2016-01-23 16:10:44 +01:00
|
|
|
* @param[in] orig_pkt The invoking packet.
|
|
|
|
*/
|
2018-11-14 14:08:03 +01:00
|
|
|
void gnrc_icmpv6_error_param_prob_send(uint8_t code, void *ptr,
|
2018-11-14 14:23:31 +01:00
|
|
|
const gnrc_pktsnip_t *orig_pkt);
|
2018-11-14 13:54:12 +01:00
|
|
|
#else /* defined(MODULE_GNRC_ICMPV6_ERROR) || defined(DOXYGEN) */
|
|
|
|
/* NOPs to make the usage code more readable */
|
|
|
|
#define gnrc_icmpv6_error_dst_unr_send(code, orig_pkt) \
|
|
|
|
(void)code; (void)orig_pkt
|
|
|
|
#define gnrc_icmpv6_error_pkt_too_big_send(mtu, orig_pkt) \
|
|
|
|
(void)mtu; (void)orig_pkt
|
|
|
|
#define gnrc_icmpv6_error_time_exc_send(code, orig_pkt) \
|
|
|
|
(void)code; (void)orig_pkt
|
|
|
|
#define gnrc_icmpv6_error_param_prob_send(code, ptr, orig_pkt) \
|
|
|
|
(void)code; (void)ptr, (void)orig_pkt
|
|
|
|
#endif /* defined(MODULE_GNRC_ICMPV6_ERROR) || defined(DOXYGEN) */
|
2016-01-23 16:10:44 +01:00
|
|
|
|
2015-04-01 17:29:07 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-05-23 18:19:52 +02:00
|
|
|
#endif /* NET_GNRC_ICMPV6_ERROR_H */
|
2015-04-01 17:29:07 +02:00
|
|
|
/** @} */
|