change PAD_ScanPads()s behaviour. the return value now contains a bitmask of the...
[libogc.git] / libdb / uIP / uip_icmp.h
blob42928a0fab1ba9dad1b3f4b06975f774a4b04c03
1 #ifndef __UIP_ICMP_H__
2 #define __UIP_ICMP_H__
4 #include "uip.h"
5 #include "uip_arch.h"
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 */
36 PACK_STRUCT_BEGIN
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);
42 } PACK_STRUCT_STRUCT;
43 PACK_STRUCT_END
45 PACK_STRUCT_BEGIN
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);
50 } PACK_STRUCT_STRUCT;
51 PACK_STRUCT_END
53 struct uip_pbuf;
54 struct uip_netif;
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);
60 #endif