File indexing completed on 2025-01-18 09:54:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 #ifndef LIBBSD_NETINET_IP_ICMP_H
0034 #define LIBBSD_NETINET_IP_ICMP_H
0035
0036 #include <sys/types.h> /* uint32_t */
0037 #include <netinet/in.h> /* in_addr */
0038 #include <netinet/in_systm.h> /* n_short */
0039 #include <netinet/ip.h> /* idi_ip */
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049 struct icmp_ra_addr {
0050 uint32_t ira_addr;
0051 uint32_t ira_preference;
0052 };
0053
0054
0055
0056
0057 struct icmp {
0058 unsigned char icmp_type;
0059 unsigned char icmp_code;
0060 unsigned short icmp_cksum;
0061 union {
0062 unsigned char ih_pptr;
0063 struct in_addr ih_gwaddr;
0064 struct ih_idseq {
0065 n_short icd_id;
0066 n_short icd_seq;
0067 } ih_idseq;
0068 int ih_void;
0069
0070
0071 struct ih_pmtu {
0072 n_short ipm_void;
0073 n_short ipm_nextmtu;
0074 } ih_pmtu;
0075
0076 struct ih_rtradv {
0077 unsigned char irt_num_addrs;
0078 unsigned char irt_wpa;
0079 uint16_t irt_lifetime;
0080 } ih_rtradv;
0081 } icmp_hun;
0082 #define icmp_pptr icmp_hun.ih_pptr
0083 #define icmp_gwaddr icmp_hun.ih_gwaddr
0084 #define icmp_id icmp_hun.ih_idseq.icd_id
0085 #define icmp_seq icmp_hun.ih_idseq.icd_seq
0086 #define icmp_void icmp_hun.ih_void
0087 #define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
0088 #define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
0089 #define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs
0090 #define icmp_wpa icmp_hun.ih_rtradv.irt_wpa
0091 #define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
0092 union {
0093 struct id_ts {
0094 n_time its_otime;
0095 n_time its_rtime;
0096 n_time its_ttime;
0097 } id_ts;
0098 struct id_ip {
0099 struct ip idi_ip;
0100
0101 } id_ip;
0102 struct icmp_ra_addr id_radv;
0103 uint32_t id_mask;
0104 char id_data[1];
0105 } icmp_dun;
0106 #define icmp_otime icmp_dun.id_ts.its_otime
0107 #define icmp_rtime icmp_dun.id_ts.its_rtime
0108 #define icmp_ttime icmp_dun.id_ts.its_ttime
0109 #define icmp_ip icmp_dun.id_ip.idi_ip
0110 #define icmp_radv icmp_dun.id_radv
0111 #define icmp_mask icmp_dun.id_mask
0112 #define icmp_data icmp_dun.id_data
0113 };
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123 #define ICMP_MINLEN 8
0124 #define ICMP_TSLEN (8 + 3 * sizeof (n_time))
0125 #define ICMP_MASKLEN 12
0126 #define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8)
0127 #define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
0128
0129
0130
0131
0132
0133 #define ICMP_ECHOREPLY 0
0134 #define ICMP_UNREACH 3
0135 #define ICMP_UNREACH_NET 0
0136 #define ICMP_UNREACH_HOST 1
0137 #define ICMP_UNREACH_PROTOCOL 2
0138 #define ICMP_UNREACH_PORT 3
0139 #define ICMP_UNREACH_NEEDFRAG 4
0140 #define ICMP_UNREACH_SRCFAIL 5
0141 #define ICMP_UNREACH_NET_UNKNOWN 6
0142 #define ICMP_UNREACH_HOST_UNKNOWN 7
0143 #define ICMP_UNREACH_ISOLATED 8
0144 #define ICMP_UNREACH_NET_PROHIB 9
0145 #define ICMP_UNREACH_HOST_PROHIB 10
0146 #define ICMP_UNREACH_TOSNET 11
0147 #define ICMP_UNREACH_TOSHOST 12
0148 #define ICMP_UNREACH_FILTER_PROHIB 13
0149 #define ICMP_UNREACH_HOST_PRECEDENCE 14
0150 #define ICMP_UNREACH_PRECEDENCE_CUTOFF 15
0151 #define ICMP_SOURCEQUENCH 4
0152 #define ICMP_REDIRECT 5
0153 #define ICMP_REDIRECT_NET 0
0154 #define ICMP_REDIRECT_HOST 1
0155 #define ICMP_REDIRECT_TOSNET 2
0156 #define ICMP_REDIRECT_TOSHOST 3
0157 #define ICMP_ALTHOSTADDR 6
0158 #define ICMP_ECHO 8
0159 #define ICMP_ROUTERADVERT 9
0160 #define ICMP_ROUTERADVERT_NORMAL 0
0161 #define ICMP_ROUTERADVERT_NOROUTE_COMMON 16
0162 #define ICMP_ROUTERSOLICIT 10
0163 #define ICMP_TIMXCEED 11
0164 #define ICMP_TIMXCEED_INTRANS 0
0165 #define ICMP_TIMXCEED_REASS 1
0166 #define ICMP_PARAMPROB 12
0167 #define ICMP_PARAMPROB_ERRATPTR 0
0168 #define ICMP_PARAMPROB_OPTABSENT 1
0169 #define ICMP_PARAMPROB_LENGTH 2
0170 #define ICMP_TSTAMP 13
0171 #define ICMP_TSTAMPREPLY 14
0172 #define ICMP_IREQ 15
0173 #define ICMP_IREQREPLY 16
0174 #define ICMP_MASKREQ 17
0175 #define ICMP_MASKREPLY 18
0176 #define ICMP_TRACEROUTE 30
0177 #define ICMP_DATACONVERR 31
0178 #define ICMP_MOBILE_REDIRECT 32
0179 #define ICMP_IPV6_WHEREAREYOU 33
0180 #define ICMP_IPV6_IAMHERE 34
0181 #define ICMP_MOBILE_REGREQUEST 35
0182 #define ICMP_MOBILE_REGREPLY 36
0183 #define ICMP_SKIP 39
0184 #define ICMP_PHOTURIS 40
0185 #define ICMP_PHOTURIS_UNKNOWN_INDEX 1
0186 #define ICMP_PHOTURIS_AUTH_FAILED 2
0187 #define ICMP_PHOTURIS_DECRYPT_FAILED 3
0188
0189 #define ICMP_MAXTYPE 40
0190
0191 #define ICMP_INFOTYPE(type) \
0192 ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
0193 (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
0194 (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
0195 (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
0196 (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
0197
0198 #ifdef _KERNEL
0199 void icmp_error(struct mbuf *, int, int, n_long, struct ifnet *);
0200 void icmp_input(struct mbuf *, int);
0201 #endif
0202
0203 #endif