aboutsummaryrefslogtreecommitdiff
path: root/helper/include/odp/helper/icmp.h
blob: 9dbc02a9f9663f05a5545d06f2da1e9ae7479a58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright (c) 2014-2018 Linaro Limited
 */


/**
 * @file
 *
 * ODP ICMP header
 */

#ifndef ODPH_ICMP_H_
#define ODPH_ICMP_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <odp_api.h>

/**
 * @addtogroup odph_protocols
 * @{
 */

/** ICMP header length */
#define ODPH_ICMPHDR_LEN 8

/** ICMP header */
typedef struct ODP_PACKED {
	uint8_t type;		/**< message type */
	uint8_t code;		/**< type sub-code */
	odp_u16sum_t chksum;	/**< checksum of icmp header */
	/** Variant mappings of ICMP fields */
	union {
		/** Fields used for ICMP echo msgs */
		struct {
			odp_u16be_t id;       /**< id */
			odp_u16be_t sequence; /**< sequence */
		} echo;			/**< echo datagram */
		odp_u32be_t gateway;	/**< gateway address */
		/** Fields used for ICMP frag msgs */
		struct {
			odp_u16be_t __unused; /**< @internal */
			odp_u16be_t mtu;  /**< mtu */
		} frag;			/**< path mtu discovery */
	} un;			/**< icmp sub header */
} odph_icmphdr_t;

#define ODPH_ICMP_ECHOREPLY 0 /**< Echo Reply */
#define ODPH_ICMP_ECHO      8 /**< Echo Request */

/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
ODP_STATIC_ASSERT(sizeof(odph_icmphdr_t) == ODPH_ICMPHDR_LEN,
		  "ODPH_ICMPHDR_T__SIZE_ERROR");
/** @endcond */

/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#endif