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