nRF5 IoT SDK  v0.9.0
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ICMP6 Application Interface for Nordic's IPv6 stack

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

Data Structures

struct  icmp6_ns_param_t
 

Macros

#define ICMP6_ECHO_REQUEST_PAYLOAD_OFFSET   4
 

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_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   4

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 using ICMP6_ENABLE_ND6_MESSAGES_TO_APPLICATION or 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.
Returns
A provision 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. Sequence number, ICMP Code, type checksum, etc. are filled in by the module. For example, if the application wants to send an echo request containing 10 'A's, it should first allocate a buffer and then set the payload and payload length as follows:

memset(p_request->p_payload+ICMP6_ECHO_REQUEST_PAYLOAD_OFFSET, 'A', 10);
p_request->length = ICMP6_ECHO_REQUEST_PAYLOAD_OFFSET+10;

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_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.