00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 struct icmp {
00045 u_char icmp_type;
00046 u_char icmp_code;
00047 u_short icmp_cksum;
00048 union {
00049 u_char ih_pptr;
00050 struct in_addr ih_gwaddr;
00051 struct ih_idseq {
00052 n_short icd_id;
00053 n_short icd_seq;
00054 } ih_idseq;
00055 int ih_void;
00056
00057
00058 struct ih_pmtu {
00059 n_short ipm_void;
00060 n_short ipm_nextmtu;
00061 } ih_pmtu;
00062 } icmp_hun;
00063 #define icmp_pptr icmp_hun.ih_pptr
00064 #define icmp_gwaddr icmp_hun.ih_gwaddr
00065 #define icmp_id icmp_hun.ih_idseq.icd_id
00066 #define icmp_seq icmp_hun.ih_idseq.icd_seq
00067 #define icmp_void icmp_hun.ih_void
00068 #define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
00069 #define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
00070 union {
00071 struct id_ts {
00072 n_time its_otime;
00073 n_time its_rtime;
00074 n_time its_ttime;
00075 } id_ts;
00076 struct id_ip {
00077 struct ip idi_ip;
00078
00079 } id_ip;
00080 u_int id_mask;
00081 char id_data[1];
00082 } icmp_dun;
00083 #define icmp_otime icmp_dun.id_ts.its_otime
00084 #define icmp_rtime icmp_dun.id_ts.its_rtime
00085 #define icmp_ttime icmp_dun.id_ts.its_ttime
00086 #define icmp_ip icmp_dun.id_ip.idi_ip
00087 #define icmp_mask icmp_dun.id_mask
00088 #define icmp_data icmp_dun.id_data
00089 };
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 #define ICMP_MINLEN 8
00100 #define ICMP_TSLEN (8 + 3 * sizeof (n_time))
00101 #define ICMP_MASKLEN 12
00102 #define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8)
00103 #define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
00104
00105
00106
00107
00108
00109 #define ICMP_ECHOREPLY 0
00110 #define ICMP_UNREACH 3
00111 #define ICMP_UNREACH_NET 0
00112 #define ICMP_UNREACH_HOST 1
00113 #define ICMP_UNREACH_PROTOCOL 2
00114 #define ICMP_UNREACH_PORT 3
00115 #define ICMP_UNREACH_NEEDFRAG 4
00116 #define ICMP_UNREACH_SRCFAIL 5
00117 #define ICMP_UNREACH_NET_UNKNOWN 6
00118 #define ICMP_UNREACH_HOST_UNKNOWN 7
00119 #define ICMP_UNREACH_ISOLATED 8
00120 #define ICMP_UNREACH_NET_PROHIB 9
00121 #define ICMP_UNREACH_HOST_PROHIB 10
00122 #define ICMP_UNREACH_TOSNET 11
00123 #define ICMP_UNREACH_TOSHOST 12
00124 #define ICMP_SOURCEQUENCH 4
00125 #define ICMP_REDIRECT 5
00126 #define ICMP_REDIRECT_NET 0
00127 #define ICMP_REDIRECT_HOST 1
00128 #define ICMP_REDIRECT_TOSNET 2
00129 #define ICMP_REDIRECT_TOSHOST 3
00130 #define ICMP_ECHO 8
00131 #define ICMP_ROUTERADVERT 9
00132 #define ICMP_ROUTERSOLICIT 10
00133 #define ICMP_TIMXCEED 11
00134 #define ICMP_TIMXCEED_INTRANS 0
00135 #define ICMP_TIMXCEED_REASS 1
00136 #define ICMP_PARAMPROB 12
00137 #define ICMP_PARAMPROB_OPTABSENT 1
00138 #define ICMP_TSTAMP 13
00139 #define ICMP_TSTAMPREPLY 14
00140 #define ICMP_IREQ 15
00141 #define ICMP_IREQREPLY 16
00142 #define ICMP_MASKREQ 17
00143 #define ICMP_MASKREPLY 18
00144
00145 #define ICMP_MAXTYPE 18
00146
00147 #define ICMP_INFOTYPE(type) \
00148 ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
00149 (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
00150 (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
00151 (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
00152 (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
00153
00154 #ifdef KERNEL
00155 void icmp_error __P((struct mbuf *, int, int, n_int, struct ifnet *));
00156 void icmp_input __P((struct mbuf *, int));
00157 void icmp_reflect __P((struct mbuf *));
00158 void icmp_send __P((struct mbuf *, struct mbuf *));
00159 int icmp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
00160 #endif