2015-03-07 20:37:45 +01: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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup net_ng_icmpv6 Internet Control Message Protocol for IPv6
|
|
|
|
* @ingroup net_ng_ipv6
|
|
|
|
* @brief Basic implementation of ICMPv6
|
|
|
|
*
|
|
|
|
* @see <a href="https://tools.ietf.org/html/rfc4443">
|
|
|
|
* RFC 4443
|
|
|
|
* </a>
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Definitions for ICMPv6
|
|
|
|
*
|
|
|
|
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
|
2015-07-31 21:57:20 +02:00
|
|
|
*
|
|
|
|
* @todo build error messages
|
2015-03-07 20:37:45 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NG_ICMPV6_H_
|
|
|
|
#define NG_ICMPV6_H_
|
|
|
|
|
|
|
|
#include "kernel_types.h"
|
2015-08-10 13:22:24 +02:00
|
|
|
#include "net/icmpv6.h"
|
2015-03-07 20:37:45 +01:00
|
|
|
#include "net/ng_pkt.h"
|
|
|
|
|
2015-04-01 17:35:23 +02:00
|
|
|
#include "net/ng_icmpv6/echo.h"
|
2015-04-01 17:29:07 +02:00
|
|
|
#include "net/ng_icmpv6/error.h"
|
2015-03-07 20:37:45 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Demultiplexes a received ICMPv6 packet according to its type field.
|
|
|
|
*
|
|
|
|
* @param[in] iface The receiving interface
|
|
|
|
* @param[in] pkt The packet to demultiplex.
|
|
|
|
*/
|
|
|
|
void ng_icmpv6_demux(kernel_pid_t iface, ng_pktsnip_t *pkt);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Builds an ICMPv6 message for sending.
|
|
|
|
*
|
2015-05-11 01:26:59 +02:00
|
|
|
* @param[in] next Next packet snip in the new packet.
|
2015-03-07 20:37:45 +01:00
|
|
|
* @param[in] type Type for the ICMPv6 message.
|
|
|
|
* @param[in] code Code for the ICMPv6 message.
|
|
|
|
* @param[in] size Size of the ICMPv6 message (needs do be >
|
2015-08-10 13:22:24 +02:00
|
|
|
* `sizeof(icmpv6_hdr_t)`).
|
2015-03-07 20:37:45 +01:00
|
|
|
*
|
|
|
|
* @return The ICMPv6 message on success
|
|
|
|
* @return NULL, on failure
|
|
|
|
*/
|
2015-05-11 01:26:59 +02:00
|
|
|
ng_pktsnip_t *ng_icmpv6_build(ng_pktsnip_t *next, uint8_t type, uint8_t code, size_t size);
|
2015-03-07 20:37:45 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Calculates the checksum for an ICMPv6 packet.
|
|
|
|
*
|
|
|
|
* @param[in] hdr The header the checksum should be calculated
|
|
|
|
* for.
|
|
|
|
* @param[in] pseudo_hdr The header the pseudo header shall be generated
|
|
|
|
* from. NULL if none is needed.
|
|
|
|
*
|
|
|
|
* @return 0, on success.
|
|
|
|
* @return -EINVAL, if ng_pktsnip_t::type of @p pkt was not NG_NETTYPE_ICMPV6
|
|
|
|
* @return -ENOENT, if ng_pktsnip_t::type of @p pseudo_hdr was not
|
|
|
|
* NG_NETTYPE_IPV6
|
|
|
|
*/
|
|
|
|
int ng_icmpv6_calc_csum(ng_pktsnip_t *hdr, ng_pktsnip_t *pseudo_hdr);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* NG_ICMPV6_H_ */
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|