VSF Documented
ip_icmp.h
Go to the documentation of this file.
1#ifndef __VSF_LINUX_NETINET_IP_ICMP_H__
2#define __VSF_LINUX_NETINET_IP_ICMP_H__
3
5
6#if VSF_LINUX_CFG_RELATIVE_PATH == ENABLED
7# include "../sys/types.h"
8# include "./in.h"
9# include "./ip.h"
10#else
11# include <sys/types.h>
12# include <netinet/in.h>
13# include <netinet/ip.h>
14#endif
15// for stdint.h
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22struct icmphdr {
26 union {
27 struct {
32 struct {
36 } un;
37};
38
39#define ICMP_ECHOREPLY 0
40#define ICMP_DEST_UNREACH 3
41#define ICMP_SOURCE_QUENCH 4
42#define ICMP_REDIRECT 5
43#define ICMP_ECHO 8
44#define ICMP_TIME_EXCEEDED 11
45#define ICMP_PARAMETERPROB 12
46#define ICMP_TIMESTAMP 13
47#define ICMP_TIMESTAMPREPLY 14
48#define ICMP_INFO_REQUEST 15
49#define ICMP_INFO_REPLY 16
50#define ICMP_ADDRESS 17
51#define ICMP_ADDRESSREPLY 18
52#define NR_ICMP_TYPES 18
53
54#define ICMP_NET_UNREACH 0
55#define ICMP_HOST_UNREACH 1
56#define ICMP_PROT_UNREACH 2
57#define ICMP_PORT_UNREACH 3
58#define ICMP_FRAG_NEEDED 4
59#define ICMP_SR_FAILED 5
60#define ICMP_NET_UNKNOWN 6
61#define ICMP_HOST_UNKNOWN 7
62#define ICMP_HOST_ISOLATED 8
63#define ICMP_NET_ANO 9
64#define ICMP_HOST_ANO 10
65#define ICMP_NET_UNR_TOS 11
66#define ICMP_HOST_UNR_TOS 12
67#define ICMP_PKT_FILTERED 13
68#define ICMP_PREC_VIOLATION 14
69#define ICMP_PREC_CUTOFF 15
70#define NR_ICMP_UNREACH 15
71
72#define ICMP_REDIR_NET 0
73#define ICMP_REDIR_HOST 1
74#define ICMP_REDIR_NETTOS 2
75#define ICMP_REDIR_HOSTTOS 3
76
77#define ICMP_EXC_TTL 0
78#define ICMP_EXC_FRAGTIME 1
79
83};
84
85struct icmp {
89 union {
92 struct ih_idseq {
97 struct ih_pmtu {
101 struct ih_rtradv {
107#define icmp_pptr icmp_hun.ih_pptr
108#define icmp_gwaddr icmp_hun.ih_gwaddr
109#define icmp_id icmp_hun.ih_idseq.icd_id
110#define icmp_seq icmp_hun.ih_idseq.icd_seq
111#define icmp_void icmp_hun.ih_void
112#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
113#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
114#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs
115#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa
116#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
117
118 union {
119 struct {
124 struct {
125 struct ip idi_ip;
131#define icmp_otime icmp_dun.id_ts.its_otime
132#define icmp_rtime icmp_dun.id_ts.its_rtime
133#define icmp_ttime icmp_dun.id_ts.its_ttime
134#define icmp_ip icmp_dun.id_ip.idi_ip
135#define icmp_radv icmp_dun.id_radv
136#define icmp_mask icmp_dun.id_mask
137#define icmp_data icmp_dun.id_data
138};
139
140#define ICMP_MINLEN 8
141#define ICMP_TSLEN (8 + 3 * sizeof(uint32_t))
142#define ICMP_MASKLEN 12
143#define ICMP_ADVLENMIN (8 + sizeof(struct ip) + 8)
144#define ICMP_ADVLEN(__P) (8 + ((__P)->icmp_ip.ip_hl << 2) + 8)
145
146#define ICMP_UNREACH 3
147#define ICMP_SOURCEQUENCH 4
148#define ICMP_ROUTERADVERT 9
149#define ICMP_ROUTERSOLICIT 10
150#define ICMP_TIMXCEED 11
151#define ICMP_PARAMPROB 12
152#define ICMP_TSTAMP 13
153#define ICMP_TSTAMPREPLY 14
154#define ICMP_IREQ 15
155#define ICMP_IREQREPLY 16
156#define ICMP_MASKREQ 17
157#define ICMP_MASKREPLY 18
158
159#define ICMP_MAXTYPE 18
160
161#define ICMP_UNREACH_NET 0
162#define ICMP_UNREACH_HOST 1
163#define ICMP_UNREACH_PROTOCOL 2
164#define ICMP_UNREACH_PORT 3
165#define ICMP_UNREACH_NEEDFRAG 4
166#define ICMP_UNREACH_SRCFAIL 5
167#define ICMP_UNREACH_NET_UNKNOWN 6
168#define ICMP_UNREACH_HOST_UNKNOWN 7
169#define ICMP_UNREACH_ISOLATED 8
170#define ICMP_UNREACH_NET_PROHIB 9
171#define ICMP_UNREACH_HOST_PROHIB 10
172#define ICMP_UNREACH_TOSNET 11
173#define ICMP_UNREACH_TOSHOST 12
174#define ICMP_UNREACH_FILTER_PROHIB 13
175#define ICMP_UNREACH_HOST_PRECEDENCE 14
176#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15
177
178#define ICMP_REDIRECT_NET 0
179#define ICMP_REDIRECT_HOST 1
180#define ICMP_REDIRECT_TOSNET 2
181#define ICMP_REDIRECT_TOSHOST 3
182
183#define ICMP_TIMXCEED_INTRANS 0
184#define ICMP_TIMXCEED_REASS 1
185
186#define ICMP_PARAMPROB_OPTABSENT 1
187
188#define ICMP_INFOTYPE(__TYPE) \
189 ( (__TYPE) == ICMP_ECHOREPLY || (__TYPE) == ICMP_ECHO \
190 || (__TYPE) == ICMP_ROUTERADVERT || (__TYPE) == ICMP_ROUTERSOLICIT \
191 || (__TYPE) == ICMP_TSTAMP || (__TYPE) == ICMP_TSTAMPREPLY \
192 || (__TYPE) == ICMP_IREQ || (__TYPE) == ICMP_IREQREPLY \
193 || (__TYPE) == ICMP_MASKREQ || (__TYPE) == ICMP_MASKREPLY \
194 )
195
196#ifdef __cplusplus
197}
198#endif
199
200#endif
unsigned short uint16_t
Definition stdint.h:7
unsigned uint32_t
Definition stdint.h:9
unsigned char uint8_t
Definition stdint.h:5
Definition ip_icmp.h:80
uint32_t irq_preference
Definition ip_icmp.h:82
uint32_t ira_addr
Definition ip_icmp.h:81
Definition ip_icmp.h:85
uint32_t its_otime
Definition ip_icmp.h:120
uint8_t icmp_code
Definition ip_icmp.h:87
uint8_t id_data[1]
Definition ip_icmp.h:129
struct icmp_ra_addr id_radv
Definition ip_icmp.h:127
uint8_t irt_wpa
Definition ip_icmp.h:103
struct in_addr ih_gwaddr
Definition ip_icmp.h:91
uint8_t irt_num_addrs
Definition ip_icmp.h:102
uint32_t its_ttime
Definition ip_icmp.h:122
struct icmp::@898::@900 id_ip
struct icmp::@898::@899 id_ts
uint8_t ih_pptr
Definition ip_icmp.h:90
uint16_t irt_lifetime
Definition ip_icmp.h:104
union icmp::@897 icmp_hun
union icmp::@898 icmp_dun
uint8_t icmp_type
Definition ip_icmp.h:86
uint32_t its_rtime
Definition ip_icmp.h:121
struct icmp::@897::ih_pmtu ih_pmtu
uint16_t ipm_void
Definition ip_icmp.h:98
struct icmp::@897::ih_rtradv ih_rtradv
uint32_t ih_void
Definition ip_icmp.h:96
uint32_t id_mask
Definition ip_icmp.h:128
uint16_t ipm_nextmtu
Definition ip_icmp.h:99
struct icmp::@897::ih_idseq ih_idseq
uint16_t icmp_cksum
Definition ip_icmp.h:88
uint16_t icd_seq
Definition ip_icmp.h:94
struct ip idi_ip
Definition ip_icmp.h:125
uint16_t icd_id
Definition ip_icmp.h:93
Definition ip_icmp.h:22
uint16_t id
Definition ip_icmp.h:28
uint16_t sequence
Definition ip_icmp.h:29
uint32_t gateway
Definition ip_icmp.h:31
uint16_t checksum
Definition ip_icmp.h:25
uint8_t type
Definition ip_icmp.h:23
uint16_t __unused
Definition ip_icmp.h:33
uint8_t code
Definition ip_icmp.h:24
struct icmphdr::@894::@896 frag
union icmphdr::@894 un
uint16_t mtu
Definition ip_icmp.h:34
struct icmphdr::@894::@895 echo
Definition in.h:115
Definition ip.h:54