xref: /dpdk/lib/net/rte_icmp.h (revision 7917b0d38e92e8b9ec5a870415b791420e10f11a)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 1982, 1986, 1990, 1993
3  *      The Regents of the University of California.
4  * Copyright(c) 2013 6WIND S.A.
5  * All rights reserved.
6  */
7 
8 #ifndef _RTE_ICMP_H_
9 #define _RTE_ICMP_H_
10 
11 /**
12  * @file
13  *
14  * ICMP-related defines
15  */
16 
17 #include <stdint.h>
18 
19 #include <rte_byteorder.h>
20 
21 /**
22  * ICMP base header
23  */
24 struct rte_icmp_base_hdr {
25 	uint8_t type;
26 	uint8_t code;
27 	rte_be16_t checksum;
28 } __rte_packed;
29 
30 /**
31  * ICMP echo header
32  */
33 struct rte_icmp_echo_hdr {
34 	struct rte_icmp_base_hdr base;
35 	rte_be16_t identifier;
36 	rte_be16_t sequence;
37 } __rte_packed;
38 
39 /**
40  * ICMP Header
41  *
42  * @see rte_icmp_echo_hdr which is similar.
43  */
44 struct rte_icmp_hdr {
45 	uint8_t  icmp_type;     /* ICMP packet type. */
46 	uint8_t  icmp_code;     /* ICMP packet code. */
47 	rte_be16_t icmp_cksum;  /* ICMP packet checksum. */
48 	rte_be16_t icmp_ident;  /* ICMP packet identifier. */
49 	rte_be16_t icmp_seq_nb; /* ICMP packet sequence number. */
50 } __rte_packed;
51 
52 /* ICMP packet types */
53 #define RTE_IP_ICMP_ECHO_REPLY   0
54 #define RTE_IP_ICMP_ECHO_REQUEST 8
55 #define RTE_ICMP6_ECHO_REQUEST 128
56 #define RTE_ICMP6_ECHO_REPLY   129
57 
58 #endif /* RTE_ICMP_H_ */
59