Watt-32 tcp/ip  2.2 dev-rel.10
pcicmp.h
Go to the documentation of this file.
1 
3 #ifndef _w32_PCICMP_H
4 #define _w32_PCICMP_H
5 
6 #include <sys/pack_on.h>
7 
11 struct ICMP_unused {
12  BYTE type;
13  BYTE code;
14  WORD checksum;
15  DWORD unused;
16  in_Header ip;
17  BYTE spares [8];
18  };
19 
22 struct ICMP_pointer {
23  BYTE type;
24  BYTE code;
25  WORD checksum;
26  BYTE pointer;
27  BYTE unused [3];
28  in_Header ip;
29  };
30 
34 struct ICMP_ip {
35  BYTE type;
36  BYTE code;
37  WORD checksum;
38  DWORD ipaddr; /* redirect gateway */
39  in_Header ip; /* original ip-header */
40  };
41 
44 struct ICMP_echo {
45  BYTE type;
46  BYTE code;
47  WORD checksum;
48  WORD identifier;
49  WORD sequence;
50  DWORD index;
51  };
52 
56  BYTE type;
57  BYTE code;
58  WORD checksum;
59  WORD identifier;
60  WORD sequence;
61  DWORD original; /* original timestamp */
62  DWORD receive; /* receive timestamp */
63  DWORD transmit; /* transmit timestamp */
64  };
65 
68 struct ICMP_info {
69  BYTE type;
70  BYTE code;
71  WORD checksum;
72  WORD identifier;
73  WORD sequence;
74  };
75 
79  BYTE type;
80  BYTE code;
81  WORD checksum;
82  WORD identifier;
83  WORD sequence;
84  DWORD mask;
85  };
86 
90  BYTE type;
91  BYTE code;
92  WORD checksum;
93  WORD identifier;
94  WORD unused;
95  WORD outbound_hop;
96  WORD return_hop;
97  DWORD link_speed;
98  DWORD link_mtu;
99  };
100 
101 
106  BYTE type;
107  BYTE code;
108  WORD checksum;
109  WORD unused; /* 32-bit 0 here for router that doesn't support RFC-1191 */
110  WORD next_mtu;
111  };
112 
115 typedef union ICMP_PKT {
116  struct ICMP_unused unused;
117  struct ICMP_pointer pointer;
118  struct ICMP_ip ip;
119  struct ICMP_echo echo;
120  struct ICMP_timestamp timestamp;
121  struct ICMP_info info;
122  struct ICMP_addr_mask mask;
123  struct ICMP_traceroute tracert;
124  struct ICMP_needfrag needfrag;
125  } ICMP_PKT;
126 
130 struct ping_pkt {
131  in_Header in;
132  struct ICMP_echo icmp;
133  /* BYTE data[]; */
134  };
135 
136 #include <sys/pack_off.h>
137 
138 
142 #define ICMP_ECHOREPLY 0
143 #define ICMP_UNREACH 3
144 #define ICMP_SOURCEQUENCH 4
145 #define ICMP_REDIRECT 5
146 #define ICMP_ECHO 8
147 #define ICMP_ROUTERADVERT 9
148 #define ICMP_ROUTERSOLICIT 10
149 #define ICMP_TIMXCEED 11
150 #define ICMP_PARAMPROB 12
151 #define ICMP_TSTAMP 13
152 #define ICMP_TSTAMPREPLY 14
153 #define ICMP_IREQ 15
154 #define ICMP_IREQREPLY 16
155 #define ICMP_MASKREQ 17
156 #define ICMP_MASKREPLY 18
158 #ifndef ICMP_MAXTYPE
159 #define ICMP_MAXTYPE 18
160 #endif
161 
162 
163 /*
164  * ICMP_UNREACH codes. E.g. 'struct ICMP_unused::code'.
165  */
166 #define ICMP_UNREACH_NET 0
167 #define ICMP_UNREACH_HOST 1
168 #define ICMP_UNREACH_PROTOCOL 2
169 #define ICMP_UNREACH_PORT 3
170 #define ICMP_UNREACH_NEEDFRAG 4
171 #define ICMP_UNREACH_SRCFAIL 5
172 #define ICMP_UNREACH_NET_UNKNOWN 6
173 #define ICMP_UNREACH_HOST_UNKNOWN 7
174 #define ICMP_UNREACH_ISOLATED 8
175 #define ICMP_UNREACH_NET_PROHIB 9
176 #define ICMP_UNREACH_HOST_PROHIB 10
177 #define ICMP_UNREACH_TOSNET 11
178 #define ICMP_UNREACH_TOSHOST 12
179 #define ICMP_UNREACH_FILTER_PROHIB 13
180 #define ICMP_UNREACH_HOST_PRECEDENCE 14
181 #define ICMP_UNREACH_PRECEDENCE_CUTOFF 15
182 
183 extern const char *icmp_type_str [ICMP_MAXTYPE+1];
184 extern const char *icmp_unreach_str [16];
185 extern const char *icmp_redirect_str [4];
186 extern const char *icmp_exceed_str [2];
187 
188 extern void icmp_handler (const in_Header *ip, BOOL broadcast);
189 extern void icmp_doredirect (const char *value);
190 extern int icmp_send_timexceed (const in_Header *ip, const void *mac_dest);
191 extern int icmp_send_unreach (const in_Header *ip, int code);
192 extern int icmp_send_mask_req (void);
193 
194 #endif
void icmp_doredirect(const char *value)
Determine which protocols we shall act upon when ICMP redirect is received.
Definition: pcicmp.c:597
void icmp_handler(const in_Header *ip, BOOL broadcast)
Handler for incoming ICMP packets.
Definition: pcicmp.c:376
int icmp_send_timexceed(const in_Header *ip, const void *mac_dest)
Send an "ICMP Time Exceeded" (reassebly timeout) back to 'ip->source'.
Definition: pcicmp.c:225
Definition: ip.h:67
Definition: pcicmp.h:34
Definition: zinftree.h:24
int icmp_send_unreach(const in_Header *ip, int code)
Send an ICMP destination/protocol unreachable back to 'ip->source'.
Definition: pcicmp.c:194