nRF5 IoT SDK
v0.9.0
|
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... | |
Nordic Internet Control Message Protocol Application Interface for Nordic's IPv6 stack.
This module provides basic features related to ICMPv6 support.
#define ICMP6_ECHO_REQUEST_PAYLOAD_OFFSET 4 |
Offset of echo request payload from ICMPv6 header.
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.
[in] | p_interface | Pointer to the IPv6 interface from where the ICMP packet was received. |
[in] | p_ip_header | Pointer to the IP header of the ICMP packet received. |
[in] | p_icmp_header | Pointer to the ICMP header of the received packet. |
[in] | process_result | Notifies the application if the ICMP packet was processed successfully or if an error occurred, for example, if the packet was malformed. |
[in] | p_rx_packet | Packet buffer containing the packet received. p_rx_packet->p_payload contains the ICMP payload. |
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:
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.
[in] | p_interface | Pointer to the IPv6 interface to send the ICMP packet. |
[in] | p_src_addr | IPv6 source address from where the echo request is sent. |
[in] | p_dest_addr | IPv6 destination address to where the echo request is sent. |
[in] | p_request | Packet buffer containing the echo request. |
NRF_SUCCESS | If 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.
[in] | p_interface | Pointer to the IPv6 interface to send the ICMP packet. |
[in] | p_src_addr | IPv6 source address from where the neighbor solicitation message is sent. |
[in] | p_dest_addr | IPv6 destination address to where the neighbor solicitation message is sent. |
[in] | p_ns_param | Neighbor discovery parameters. |
NRF_SUCCESS | If 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.
[in] | cb | Handler called when an ICMP packet is received. |
NRF_SUCCESS | If 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.
[in] | p_interface | Pointer to the IPv6 interface to send the ICMP packet. |
[in] | p_src_addr | IPv6 source address from where the router solicitation message is sent. |
[in] | p_dest_addr | IPv6 destination address to where the router solicitation message is sent. |
NRF_SUCCESS | If the send request was successful. |