ICMP ping protocol.
Definition in file ping.c.
Process ICMP ping reply.
- Parameters
-
| iobuf | I/O buffer |
| st_src | Source address |
- Return values
-
Definition at line 104 of file ping.c.
104 {
109
110
112
113
115 DBGC (
ping,
"PING %p reply id %#04x seq %#04x\n",
119 goto discard;
120 }
121
122
129
130 discard:
133}
struct arbelprm_rc_send_wqe rc
#define assert(condition)
Assert a condition at run-time.
uint8_t meta
Metadata flags.
#define ENOTCONN
The socket is not connected.
void * memset(void *dest, int character, size_t len) __nonnull
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
#define iob_disown(iobuf)
Disown an I/O buffer.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define iob_pull(iobuf, len)
An ICMP echo request/reply.
void * data
Start of data.
Generalized socket address structure.
int xfer_deliver(struct interface *intf, struct io_buffer *iobuf, struct xfer_metadata *meta)
Deliver datagram.
#define XFER_FL_ABS_OFFSET
Offset is absolute.
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.
Deliver datagram as I/O buffer.
- Parameters
-
| ping | Ping connection |
| iobuf | I/O buffer |
| meta | Data transfer metadata |
- Return values
-
Definition at line 162 of file ping.c.
163 {
166
167
171
172
174 &
ping->peer ) ) != 0 ) {
175 DBGC (
ping,
"PING %p could not transmit: %s\n",
178 }
179
180 return 0;
181}
int icmp_tx_echo_request(struct io_buffer *iobuf, struct sockaddr_tcpip *st_dest)
Transmit ICMP echo request.
#define iob_push(iobuf, len)
char * strerror(int errno)
Retrieve string representation of error number.
References DBGC, echo(), htons, icmp_tx_echo_request(), iob_disown, iob_push, memset(), meta, ping(), rc, and strerror().
Open a ping connection.
- Parameters
-
| xfer | Data transfer interface |
| peer | Peer socket address |
| local | Local socket address, or NULL |
- Return values
-
Definition at line 220 of file ping.c.
221 {
227
228
232 goto err_alloc;
233 }
238
239
243 DBGC (
ping,
"PING %p could not bind: %s\n",
245 goto err_bind;
246 }
249
250
251
252
255 return 0;
256
257 err_bind:
259 err_alloc:
261}
#define ENOMEM
Not enough space.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
#define list_add(new, head)
Add a new entry to the head of a list.
void * zalloc(size_t size)
Allocate cleared memory.
struct mschapv2_challenge peer
Peer challenge.
static int ping_port_available(int port)
Check if local port number is available.
static struct interface_descriptor ping_xfer_desc
Ping data transfer interface descriptor.
#define ref_init(refcnt, free)
Initialise a reference counter.
struct interface xfer
Data transfer interface.
int tcpip_bind(struct sockaddr_tcpip *st_local, int(*available)(int port))
Bind to local TCP/IP port.
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().