Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
icmp.h File Reference

ICMP sending and receiving. More...

#include <stddef.h>
#include <zephyr/kernel.h>
#include <zephyr/types.h>
#include <zephyr/net/net_ip.h>
#include <zephyr/net/net_if.h>
#include <zephyr/net/net_pkt.h>

Go to the source code of this file.

Data Structures

struct  net_icmp_ctx
 ICMP context structure. More...
 
struct  net_icmp_ip_hdr
 Struct presents either IPv4 or IPv6 header in ICMP response message. More...
 
struct  net_icmp_ping_params
 Struct presents parameters that are needed when sending Echo-Request (ping) messages. More...
 
struct  net_icmp_offload
 ICMP offload context structure. More...
 

Macros

#define NET_ICMPV4_ECHO_REQUEST   8
 ICMPv4 Echo-Request.
 
#define NET_ICMPV4_ECHO_REPLY   0
 ICMPv4 Echo-Reply.
 
#define NET_ICMPV6_ECHO_REQUEST   128
 ICMPv6 Echo-Request.
 
#define NET_ICMPV6_ECHO_REPLY   129
 ICMPv6 Echo-Reply.
 

Typedefs

typedef int(* net_icmp_handler_t) (struct net_icmp_ctx *ctx, struct net_pkt *pkt, struct net_icmp_ip_hdr *ip_hdr, struct net_icmp_hdr *icmp_hdr, void *user_data)
 Handler function that is called when ICMP response is received.
 
typedef int(* net_icmp_offload_ping_handler_t) (struct net_icmp_ctx *ctx, struct net_if *iface, struct sockaddr *dst, struct net_icmp_ping_params *params, void *user_data)
 Handler function that is called when an Echo-Request is sent to offloaded device.
 

Functions

int net_icmp_init_ctx (struct net_icmp_ctx *ctx, uint8_t type, uint8_t code, net_icmp_handler_t handler)
 Initialize the ICMP context structure.
 
int net_icmp_cleanup_ctx (struct net_icmp_ctx *ctx)
 Cleanup the ICMP context structure.
 
int net_icmp_send_echo_request (struct net_icmp_ctx *ctx, struct net_if *iface, struct sockaddr *dst, struct net_icmp_ping_params *params, void *user_data)
 Send ICMP echo request message.
 
int net_icmp_register_offload_ping (struct net_icmp_offload *ctx, struct net_if *iface, net_icmp_offload_ping_handler_t ping_handler)
 Register a handler function that is called when an Echo-Request is sent to the offloaded device.
 
int net_icmp_unregister_offload_ping (struct net_icmp_offload *ctx)
 Unregister the offload handler.
 
int net_icmp_get_offload_rsp_handler (struct net_icmp_offload *ctx, net_icmp_handler_t *resp_handler)
 Get a ICMP response handler function for an offloaded device.
 

Detailed Description

ICMP sending and receiving.