Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
|
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. | |
#define NET_ICMPV4_ECHO_REPLY 0 |
#include <zephyr/net/icmp.h>
ICMPv4 Echo-Reply.
#define NET_ICMPV4_ECHO_REQUEST 8 |
#include <zephyr/net/icmp.h>
ICMPv4 Echo-Request.
#define NET_ICMPV6_ECHO_REPLY 129 |
#include <zephyr/net/icmp.h>
ICMPv6 Echo-Reply.
#define NET_ICMPV6_ECHO_REQUEST 128 |
#include <zephyr/net/icmp.h>
ICMPv6 Echo-Request.
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) |
#include <zephyr/net/icmp.h>
Handler function that is called when ICMP response is received.
ctx | ICMP context to use. |
pkt | Received ICMP response network packet. |
ip_hdr | IP header of the packet. |
icmp_hdr | ICMP header of the packet. |
user_data | A valid pointer to user data or NULL |
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) |
#include <zephyr/net/icmp.h>
Handler function that is called when an Echo-Request is sent to offloaded device.
This handler is typically setup by the device driver so that it can catch the ping request and send it to the offloaded device.
ctx | ICMP context used in this request. |
iface | Network interface, can be set to NULL in which case the interface is selected according to destination address. |
dst | IP address of the target host. |
params | Echo-Request specific parameters. May be NULL in which case suitable default parameters are used. |
user_data | User supplied opaque data passed to the handler. May be NULL. |
int net_icmp_cleanup_ctx | ( | struct net_icmp_ctx * | ctx | ) |
#include <zephyr/net/icmp.h>
Cleanup the ICMP context structure.
This will unregister the ICMP handler from the system.
ctx | ICMP context used in this request. |
int net_icmp_get_offload_rsp_handler | ( | struct net_icmp_offload * | ctx, |
net_icmp_handler_t * | resp_handler ) |
#include <zephyr/net/icmp.h>
Get a ICMP response handler function for an offloaded device.
When a ping response is received by the driver, it should call the handler function with proper parameters so that the ICMP response is received by the net stack.
ctx | ICMP offload context used in this request. |
resp_handler | Function to be called when offloaded ping response is received by the offloaded driver. The ICMP response handler function is returned and the caller should call it when appropriate. |
int net_icmp_init_ctx | ( | struct net_icmp_ctx * | ctx, |
uint8_t | type, | ||
uint8_t | code, | ||
net_icmp_handler_t | handler ) |
#include <zephyr/net/icmp.h>
Initialize the ICMP context structure.
Must be called before ICMP messages can be sent. This will register handler to the system.
ctx | ICMP context used in this request. |
type | Type of ICMP message we are handling. |
code | Code of ICMP message we are handling. |
handler | Callback function that is called when a response is received. |
int net_icmp_register_offload_ping | ( | struct net_icmp_offload * | ctx, |
struct net_if * | iface, | ||
net_icmp_offload_ping_handler_t | ping_handler ) |
#include <zephyr/net/icmp.h>
Register a handler function that is called when an Echo-Request is sent to the offloaded device.
This function is typically called by a device driver so that it can do the actual offloaded ping call.
ctx | ICMP offload context used for this interface. |
iface | Network interface of the offloaded device. |
ping_handler | Function to be called when offloaded ping request is done. |
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 ) |
#include <zephyr/net/icmp.h>
Send ICMP echo request message.
ctx | ICMP context used in this request. |
iface | Network interface, can be set to NULL in which case the interface is selected according to destination address. |
dst | IP address of the target host. |
params | Echo-Request specific parameters. May be NULL in which case suitable default parameters are used. |
user_data | User supplied opaque data passed to the handler. May be NULL. |
int net_icmp_unregister_offload_ping | ( | struct net_icmp_offload * | ctx | ) |
#include <zephyr/net/icmp.h>
Unregister the offload handler.
ctx | ICMP offload context used for this interface. |