nRF5 SDK v16.0.0
Modules | Data Structures | Macros | Typedefs | Functions
ICMP6 Application Interface for Nordic's IPv6 stack

Nordic Internet Control Message Protocol Application Interface for Nordic's IPv6 stack. More...

Modules

 ICMPv6 codes per message type as defined in RFC 4443.
 

Data Structures

struct  icmp6_ns_param_t
 
struct  icmp6_error_message_param_t
 Parameters associated with error message in receive and transmit paths. More...
 

Macros

#define ICMP6_ECHO_REQUEST_PAYLOAD_OFFSET   8
 

Typedefs

typedef uint32_t(* icmp6_receive_callback_t )(iot_interface_t *p_interface, ipv6_header_t *p_ip_header, icmp6_header_t *p_icmp_header, uint32_t process_result, iot_pbuffer_t *p_rx_packet)
 ICMPv6 data RX callback. More...
 

Functions

uint32_t icmp6_error_message (const iot_interface_t *p_interface, const ipv6_addr_t *p_src_addr, const ipv6_addr_t *p_dest_addr, const icmp6_error_message_param_t *p_param)
 Sends ICMPv6 Error Message as defined in RFC 4443. More...
 
uint32_t icmp6_echo_request (const iot_interface_t *p_interface, const ipv6_addr_t *p_src_addr, const ipv6_addr_t *p_dest_addr, iot_pbuffer_t *p_request)
 Sends ICMPv6 echo request as defined in RFC4443. More...
 
uint32_t icmp6_rs_send (const iot_interface_t *p_interface, const ipv6_addr_t *p_src_addr, const ipv6_addr_t *p_dest_addr)
 Sends router solicitation message defined in RFC6775. More...
 
uint32_t icmp6_ns_send (const iot_interface_t *p_interface, const ipv6_addr_t *p_src_addr, const ipv6_addr_t *p_dest_addr, const icmp6_ns_param_t *p_ns_param)
 Sends neighbour solicitation message defined in RFC6775. More...
 
uint32_t icmp6_receive_register (icmp6_receive_callback_t cb)
 Registers the callback function for echo reply. More...
 

Detailed Description

Nordic Internet Control Message Protocol Application Interface for Nordic's IPv6 stack.

This module provides basic features related to ICMPv6 support.

Macro Definition Documentation

#define ICMP6_ECHO_REQUEST_PAYLOAD_OFFSET   8

Offset of echo request payload from ICMPv6 header.

Typedef Documentation

typedef uint32_t(* icmp6_receive_callback_t)(iot_interface_t *p_interface, ipv6_header_t *p_ip_header, icmp6_header_t *p_icmp_header, uint32_t process_result, iot_pbuffer_t *p_rx_packet)

ICMPv6 data RX callback.

Asynchronous callback used to notify the application of ICMP packets received. By default, the application is not notified through ICMP of messages related to ECHO requests or any errors. However, these notifications can easily be enabled by defining either the ICMP6_ENABLE_ND6_MESSAGES_TO_APPLICATION or the ICMP6_ENABLE_ALL_MESSAGES_TO_APPLICATION if the application should handle them.

Parameters
[in]p_interfacePointer to the IPv6 interface from where the ICMP packet was received.
[in]p_ip_headerPointer to the IP header of the ICMP packet received.
[in]p_icmp_headerPointer to the ICMP header of the received packet.
[in]process_resultNotifies the application if the ICMP packet was processed successfully or if an error occurred, for example, if the packet was malformed.
[in]p_rx_packetPacket buffer containing the packet received. p_rx_packet->p_payload contains the ICMP payload.
Return values
Aprovision for the application to notify the module of whether the received packet was processed successfully by application. The application may take ownership of the received packet by returning IOT_IPV6_ERR_PENDING, in which case the application must take care to free it using iot_pbuffer_free.

Function Documentation

uint32_t icmp6_echo_request ( const iot_interface_t p_interface,
const ipv6_addr_t p_src_addr,
const ipv6_addr_t p_dest_addr,
iot_pbuffer_t p_request 
)

Sends ICMPv6 echo request as defined in RFC4443.

API used to send an ICMPv6 echo request packet to a specific destination address. The user can decide how much additional data must be sent.

The application calling the function should allocate a packet before, with the type set to ICMP6_PACKET_TYPE in the allocation parameter.

The application should pack the payload at ICMP6_ECHO_REQUEST_PAYLOAD_OFFSET. ID, Sequence number, ICMP Code, type checksum, etc. are filled in by the module.

The application shall not free the allocated packet buffer if the procedure was successful, to ensure that no data copies are needed when transmitting a packet.

Parameters
[in]p_interfacePointer to the IPv6 interface to send the ICMP packet.
[in]p_src_addrIPv6 source address from where the echo request is sent.
[in]p_dest_addrIPv6 destination address to where the echo request is sent.
[in]p_requestPacket buffer containing the echo request.
Return values
NRF_SUCCESSIf the send request was successful.
uint32_t icmp6_error_message ( const iot_interface_t p_interface,
const ipv6_addr_t p_src_addr,
const ipv6_addr_t p_dest_addr,
const icmp6_error_message_param_t p_param 
)

Sends ICMPv6 Error Message as defined in RFC 4443.

API to send messages categorized under error messages. See ICMPv6 error messages. and RFC 4443 for valid types.

Parameters
[in]p_interfaceIdentifies the interface on which the procedure was requested. Shall not be NULL.
[in]p_src_addrSource IPv6 address to be used for the request. Shall not be NULL.
[in]p_dest_addrDestination IPv6 address to which the message send is requested. Shall not be NULL.
[in]p_paramParameters describing Type, code, invoking packet information any additional details associated with the error message.
Return values
NRF_SUCCESSIf the send request was successful, else, an error code indicating reason for failure.
uint32_t icmp6_ns_send ( const iot_interface_t p_interface,
const ipv6_addr_t p_src_addr,
const ipv6_addr_t p_dest_addr,
const icmp6_ns_param_t p_ns_param 
)

Sends neighbour solicitation message defined in RFC6775.

API used to send a neighbor discovery message of type Neighbor Solicitation to a specific destination address.

The function internally tries to allocate a packet buffer. EUI-64 used in the SLLAO and ARO options is taken from the interface parameter defined in the ipv6_init() function.

Parameters
[in]p_interfacePointer to the IPv6 interface to send the ICMP packet.
[in]p_src_addrIPv6 source address from where the neighbor solicitation message is sent.
[in]p_dest_addrIPv6 destination address to where the neighbor solicitation message is sent.
[in]p_ns_paramNeighbor discovery parameters.
Return values
NRF_SUCCESSIf the send request was successful.
uint32_t icmp6_receive_register ( icmp6_receive_callback_t  cb)

Registers the callback function for echo reply.

API used to register callback to indicate the ICMP echo reply packet. Could be not used.

Neighbor discovery related messages are not relayed to the application by default. However, this can be enabled by using the ICMP6_ENABLE_ND6_MESSAGES_TO_APPLICATION configuration parameter.

Parameters
[in]cbHandler called when an ICMP packet is received.
Return values
NRF_SUCCESSIf the registration was successful.
uint32_t icmp6_rs_send ( const iot_interface_t p_interface,
const ipv6_addr_t p_src_addr,
const ipv6_addr_t p_dest_addr 
)

Sends router solicitation message defined in RFC6775.

API used to send a neighbor discovery message of type Router Solicitation to a specific destination address. If no address is known, the user should send the message to all routers' address (FF02::1).

The function internally tries to allocate a packet buffer. EUI-64 used in the SLLAO option is taken from the interface parameter defined in the ipv6_init() function.

Parameters
[in]p_interfacePointer to the IPv6 interface to send the ICMP packet.
[in]p_src_addrIPv6 source address from where the router solicitation message is sent.
[in]p_dest_addrIPv6 destination address to where the router solicitation message is sent.
Return values
NRF_SUCCESSIf the send request was successful.

Documentation feedback | Developer Zone | Subscribe | Updated