7 #define UIP_ICMP_TTL 255
9 #define UIP_ICMP_ER 0 /* echo reply */
10 #define UIP_ICMP_DUR 3 /* destination unreachable */
11 #define UIP_ICMP_SQ 4 /* source quench */
12 #define UIP_ICMP_RD 5 /* redirect */
13 #define UIP_ICMP_ECHO 8 /* echo */
14 #define UIP_ICMP_TE 11 /* time exceeded */
15 #define UIP_ICMP_PP 12 /* parameter problem */
16 #define UIP_ICMP_TS 13 /* timestamp */
17 #define UIP_ICMP_TSR 14 /* timestamp reply */
18 #define UIP_ICMP_IRQ 15 /* information request */
19 #define UIP_ICMP_IR 16 /* information reply */
21 #define UIP_ICMPH_TYPE(hdr) (ntohs((hdr)->_type_code) >> 8)
22 #define UIP_ICMPH_CODE(hdr) (ntohs((hdr)->_type_code) & 0xff)
24 #define UIP_ICMPH_TYPE_SET(hdr, type) ((hdr)->_type_code = htons(UIP_ICMPH_CODE(hdr) | ((type) << 8)))
25 #define UIP_ICMPH_CODE_SET(hdr, code) ((hdr)->_type_code = htons((code) | (UIP_ICMPH_TYPE(hdr) << 8)))
27 enum uip_icmp_dur_type
{
28 UIP_ICMP_DUR_NET
= 0, /* net unreachable */
29 UIP_ICMP_DUR_HOST
= 1, /* host unreachable */
30 UIP_ICMP_DUR_PROTO
= 2, /* protocol unreachable */
31 UIP_ICMP_DUR_PORT
= 3, /* port unreachable */
32 UIP_ICMP_DUR_FRAG
= 4, /* fragmentation needed and DF set */
33 UIP_ICMP_DUR_SR
= 5 /* source route failed */
37 struct uip_icmp_echo_hdr
{
38 PACK_STRUCT_FIELD(u16_t _type_code
);
39 PACK_STRUCT_FIELD(u16_t chksum
);
40 PACK_STRUCT_FIELD(u16_t id
);
41 PACK_STRUCT_FIELD(u16_t seqno
);
46 struct uip_icmp_dur_hdr
{
47 PACK_STRUCT_FIELD(u16_t _type_code
);
48 PACK_STRUCT_FIELD(u16_t chksum
);
49 PACK_STRUCT_FIELD(u32_t unused
);
57 void uip_icmpinput(struct uip_pbuf
*p
,struct uip_netif
*inp
);
58 void uip_icmp_destunreach(struct uip_pbuf
*p
,enum uip_icmp_dur_type t
);