iPXE
|
ICMP ping sender. More...
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ipxe/refcnt.h>
#include <ipxe/interface.h>
#include <ipxe/job.h>
#include <ipxe/xfer.h>
#include <ipxe/iobuf.h>
#include <ipxe/open.h>
#include <ipxe/socket.h>
#include <ipxe/retry.h>
#include <ipxe/pinger.h>
Go to the source code of this file.
Data Structures | |
struct | pinger |
A pinger. More... | |
Macros | |
#define | EPROTO_LEN __einfo_error ( EINFO_EPROTO_LEN ) |
#define | EINFO_EPROTO_LEN |
#define | EPROTO_DATA __einfo_error ( EINFO_EPROTO_DATA ) |
#define | EINFO_EPROTO_DATA |
#define | EPROTO_SEQ __einfo_error ( EINFO_EPROTO_SEQ ) |
#define | EINFO_EPROTO_SEQ |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static void | pinger_generate (struct pinger *pinger, void *data) |
Generate payload. More... | |
static int | pinger_verify (struct pinger *pinger, const void *data) |
Verify payload. More... | |
static void | pinger_close (struct pinger *pinger, int rc) |
Close pinger. More... | |
static void | pinger_window_changed (struct pinger *pinger) |
Handle data transfer window change. More... | |
static void | pinger_expired (struct retry_timer *timer, int over __unused) |
Handle timer expiry. More... | |
static int | pinger_deliver (struct pinger *pinger, struct io_buffer *iobuf, struct xfer_metadata *meta) |
Handle received data. More... | |
int | create_pinger (struct interface *job, const char *hostname, unsigned long timeout, size_t len, unsigned int count, void(*callback)(struct sockaddr *src, unsigned int sequence, size_t len, int rc)) |
Create pinger. More... | |
Variables | |
static struct interface_operation | pinger_xfer_op [] |
Pinger data transfer interface operations. More... | |
static struct interface_descriptor | pinger_xfer_desc |
Pinger data transfer interface descriptor. More... | |
static struct interface_operation | pinger_job_op [] |
Pinger job control interface operations. More... | |
static struct interface_descriptor | pinger_job_desc |
Pinger job control interface descriptor. More... | |
ICMP ping sender.
Definition in file pinger.c.
#define EPROTO_LEN __einfo_error ( EINFO_EPROTO_LEN ) |
#define EINFO_EPROTO_LEN |
#define EPROTO_DATA __einfo_error ( EINFO_EPROTO_DATA ) |
#define EINFO_EPROTO_DATA |
#define EPROTO_SEQ __einfo_error ( EINFO_EPROTO_SEQ ) |
#define EINFO_EPROTO_SEQ |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Generate payload.
pinger | Pinger |
data | Data buffer |
Definition at line 99 of file pinger.c.
References bytes, data, and pinger::len.
Referenced by pinger_expired().
|
static |
Verify payload.
pinger | Pinger |
data | Data buffer |
rc | Return status code |
Definition at line 115 of file pinger.c.
References bytes, data, EPROTO_DATA, and pinger::len.
Referenced by pinger_deliver().
|
static |
Close pinger.
pinger | Pinger |
rc | Reason for close |
Definition at line 134 of file pinger.c.
References intf_shutdown(), pinger::job, rc, stop_timer(), pinger::timer, and pinger::xfer.
Referenced by create_pinger(), pinger_deliver(), and pinger_expired().
|
static |
Handle data transfer window change.
pinger | Pinger |
Definition at line 149 of file pinger.c.
References start_timer_nodelay(), pinger::timer, pinger::xfer, and xfer_window().
|
static |
Handle timer expiry.
timer | Timer |
over | Failure indicator |
Definition at line 166 of file pinger.c.
References pinger::callback, container_of, DBGC, ETIMEDOUT, iob_put, pinger::len, memset(), meta(), NULL, pinger::pending, pinger_close(), pinger_generate(), pinger::rc, rc, pinger::remaining, pinger::sequence, start_timer_fixed(), strerror(), pinger::timeout, pinger::timer, pinger::xfer, xfer_alloc_iob(), xfer_deliver(), and XFER_FL_ABS_OFFSET.
Referenced by create_pinger().
|
static |
Handle received data.
pinger | Pinger |
iobuf | I/O buffer |
meta | Data transfer metadata |
rc | Return status code |
Definition at line 223 of file pinger.c.
References pinger::callback, io_buffer::data, DBGC, DBGC_HDA, EPROTO_LEN, EPROTO_SEQ, free_iob(), iob_len(), len, pinger::len, meta(), pinger::pending, pinger_close(), pinger_verify(), pinger::rc, rc, pinger::remaining, and pinger::sequence.
int create_pinger | ( | struct interface * | job, |
const char * | hostname, | ||
unsigned long | timeout, | ||
size_t | len, | ||
unsigned int | count, | ||
void(*)(struct sockaddr *src, unsigned int sequence, size_t len, int rc) | callback | ||
) |
Create pinger.
job | Job control interface |
hostname | Hostname to ping |
timeout | Timeout (in ticks) |
len | Payload length |
count | Number of packets to send (or zero for no limit) |
callback | Callback function (or NULL) |
rc | Return status code |
Definition at line 312 of file pinger.c.
References pinger::callback, count, DBGC, EINVAL, ENOMEM, ETIMEDOUT, intf_init(), intf_plug_plug(), pinger::job, len, pinger::len, NULL, pinger_close(), pinger_expired(), pinger_job_desc, pinger_xfer_desc, pinger::rc, rc, ref_init, ref_put, pinger::refcnt, pinger::remaining, SOCK_ECHO, strerror(), pinger::timeout, timeout(), pinger::timer, pinger::xfer, xfer_open_named_socket(), and zalloc().
Referenced by ping().
|
static |
Pinger data transfer interface operations.
|
static |
Pinger data transfer interface descriptor.
Definition at line 289 of file pinger.c.
Referenced by create_pinger().
|
static |
Pinger job control interface operations.
|
static |
Pinger job control interface descriptor.
Definition at line 298 of file pinger.c.
Referenced by create_pinger().