iPXE
icmp.h
Go to the documentation of this file.
1#ifndef _IPXE_ICMP_H
2#define _IPXE_ICMP_H
3
4/** @file
5 *
6 * ICMP protocol
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <stdint.h>
14#include <ipxe/iobuf.h>
15#include <ipxe/socket.h>
16#include <ipxe/tcpip.h>
17#include <ipxe/tables.h>
18
19/** An ICMP header */
21 /** Type */
23 /** Code */
25 /** Checksum */
27} __attribute__ (( packed ));
28
29/** An ICMP echo request/reply */
30struct icmp_echo {
31 /** ICMPv6 header */
33 /** Identifier */
35 /** Sequence number */
37 /** Data */
39} __attribute__ (( packed ));
40
41/** An ICMP echo protocol */
43 /** Address family */
45 /** Request type */
47 /** Reply type */
49 /** TCP/IP protocol */
51 /** Include network-layer checksum within packet */
53};
54
55/** ICMP echo protocol table */
56#define ICMP_ECHO_PROTOCOLS \
57 __table ( struct icmp_echo_protocol, "icmp_echo_protocols" )
58
59/** Declare an ICMP echo protocol */
60#define __icmp_echo_protocol __table_entry ( ICMP_ECHO_PROTOCOLS, 01 )
61
62#define ICMP_ECHO_REPLY 0
63#define ICMP_ECHO_REQUEST 8
64
65extern int icmp_tx_echo_request ( struct io_buffer *iobuf,
66 struct sockaddr_tcpip *st_dest );
67
68extern int icmp_rx_echo_request ( struct io_buffer *iobuf,
69 struct sockaddr_tcpip *st_src,
70 struct icmp_echo_protocol *echo_protocol );
71extern int icmp_rx_echo_reply ( struct io_buffer *iobuf,
72 struct sockaddr_tcpip *st_src );
73
74#endif /* _IPXE_ICMP_H */
unsigned short uint16_t
Definition stdint.h:11
unsigned char uint8_t
Definition stdint.h:10
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
int icmp_tx_echo_request(struct io_buffer *iobuf, struct sockaddr_tcpip *st_dest)
Transmit ICMP echo request.
Definition icmp.c:106
int icmp_rx_echo_request(struct io_buffer *iobuf, struct sockaddr_tcpip *st_src, struct icmp_echo_protocol *echo_protocol)
Process a received ICMP echo request.
Definition icmp.c:166
int icmp_rx_echo_reply(struct io_buffer *iobuf, struct sockaddr_tcpip *st_src)
Process a received ICMP echo request.
Definition icmp.c:197
#define __attribute__(x)
Definition compiler.h:10
Transport-network layer interface.
I/O buffers.
Socket addresses.
uint16_t sa_family_t
A socket address family.
Definition socket.h:86
An ICMP echo protocol.
Definition icmp.h:42
int net_checksum
Include network-layer checksum within packet.
Definition icmp.h:52
uint8_t reply
Reply type.
Definition icmp.h:48
sa_family_t family
Address family.
Definition icmp.h:44
struct tcpip_protocol * tcpip_protocol
TCP/IP protocol.
Definition icmp.h:50
uint8_t request
Request type.
Definition icmp.h:46
An ICMP echo request/reply.
Definition icmp.h:30
uint16_t ident
Identifier.
Definition icmp.h:34
struct icmp_header icmp
ICMPv6 header.
Definition icmp.h:32
uint8_t data[0]
Data.
Definition icmp.h:38
uint16_t sequence
Sequence number.
Definition icmp.h:36
An ICMP header.
Definition icmp.h:20
uint8_t type
Type.
Definition icmp.h:22
uint16_t chksum
Checksum.
Definition icmp.h:26
uint8_t code
Code.
Definition icmp.h:24
A persistent I/O buffer.
Definition iobuf.h:38
TCP/IP socket address.
Definition tcpip.h:76
Linker tables.