iPXE
|
ICMP ping protocol. More...
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/refcnt.h>
#include <ipxe/list.h>
#include <ipxe/iobuf.h>
#include <ipxe/tcpip.h>
#include <ipxe/icmp.h>
#include <ipxe/interface.h>
#include <ipxe/xfer.h>
#include <ipxe/open.h>
#include <ipxe/netdevice.h>
#include <ipxe/ping.h>
Go to the source code of this file.
Data Structures | |
struct | ping_connection |
A ping connection. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static | LIST_HEAD (ping_conns) |
List of registered ping connections. More... | |
static struct ping_connection * | ping_demux (unsigned int port) |
Identify ping connection by local port number. More... | |
static int | ping_port_available (int port) |
Check if local port number is available. More... | |
int | ping_rx (struct io_buffer *iobuf, struct sockaddr_tcpip *st_src) |
Process ICMP ping reply. More... | |
static struct io_buffer * | ping_alloc_iob (struct ping_connection *ping __unused, size_t len) |
Allocate I/O buffer for ping. More... | |
static int | ping_deliver (struct ping_connection *ping, struct io_buffer *iobuf, struct xfer_metadata *meta) |
Deliver datagram as I/O buffer. More... | |
static void | ping_close (struct ping_connection *ping, int rc) |
Close ping connection. More... | |
static int | ping_open (struct interface *xfer, struct sockaddr *peer, struct sockaddr *local) |
Open a ping connection. More... | |
Variables | |
static struct interface_operation | ping_xfer_operations [] |
Ping data transfer interface operations. More... | |
static struct interface_descriptor | ping_xfer_desc |
Ping data transfer interface descriptor. More... | |
struct socket_opener ping_socket_opener | __socket_opener |
Ping socket opener. More... | |
int | ping_sock_echo = PING_SOCK_ECHO |
Linkage hack. More... | |
ICMP ping protocol.
Definition in file ping.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
List of registered ping connections.
|
static |
Identify ping connection by local port number.
port | Local port number |
ping | Ping connection, or NULL |
Definition at line 75 of file ping.c.
References ping_connection::list, list_for_each_entry, NULL, ping(), and port.
Referenced by ping_port_available(), and ping_rx().
|
static |
Check if local port number is available.
port | Local port number |
port | Local port number, or negative error |
Definition at line 91 of file ping.c.
References EADDRINUSE, ping_demux(), and port.
Referenced by ping_open().
int ping_rx | ( | struct io_buffer * | iobuf, |
struct sockaddr_tcpip * | st_src | ||
) |
Process ICMP ping reply.
iobuf | I/O buffer |
st_src | Source address |
rc | Return status code |
Definition at line 103 of file ping.c.
References assert(), io_buffer::data, DBGC, echo(), ENOTCONN, free_iob(), iob_disown, iob_len(), iob_pull, memset(), meta(), ntohs, ping(), ping_demux(), rc, xfer_deliver(), and XFER_FL_ABS_OFFSET.
|
static |
Allocate I/O buffer for ping.
ping | Ping connection |
len | Payload size |
iobuf | I/O buffer, or NULL |
Definition at line 142 of file ping.c.
References alloc_iob(), iob_reserve, len, and MAX_LL_NET_HEADER_LEN.
|
static |
Deliver datagram as I/O buffer.
ping | Ping connection |
iobuf | I/O buffer |
meta | Data transfer metadata |
rc | Return status code |
Definition at line 161 of file ping.c.
References DBGC, echo(), htons, icmp_tx_echo_request(), iob_disown, iob_push, memset(), meta(), ping(), rc, and strerror().
|
static |
Close ping connection.
ping | Ping connection |
rc | Reason for close |
Definition at line 188 of file ping.c.
References DBGC, intf_shutdown(), list_del, ping(), rc, and ref_put.
|
static |
Open a ping connection.
xfer | Data transfer interface |
peer | Peer socket address |
local | Local socket address, or NULL |
rc | Return status code |
Definition at line 219 of file ping.c.
References DBGC, ENOMEM, intf_init(), intf_plug_plug(), list_add, memcpy(), NULL, peer, ping(), ping_port_available(), ping_xfer_desc, port, rc, ref_init, ref_put, strerror(), tcpip_bind(), ping_connection::xfer, and zalloc().
|
static |
Ping data transfer interface operations.
|
static |
Ping data transfer interface descriptor.
Definition at line 208 of file ping.c.
Referenced by ping_open().
struct socket_opener ping_socket_opener __socket_opener |
Ping socket opener.