1*4923Swnj /* ip_icmp.h 4.2 81/11/18 */ 24807Swnj 34807Swnj /* 44807Swnj * Interface Control Message Protocol Definitions. 54807Swnj * Per RFC 792, September 1981. 64807Swnj */ 74807Swnj 84807Swnj /* 94807Swnj * Structure of an icmp header. 104807Swnj */ 114807Swnj struct icmp { 124807Swnj u_char icmp_type; /* type of message, see below */ 134807Swnj u_char icmp_code; /* type sub code */ 144807Swnj u_short icmp_cksum; /* ones complement cksum of struct */ 154807Swnj union { 164807Swnj u_char ih_pptr; /* ICMP_PARAMPROB */ 17*4923Swnj struct in_addr ih_gwaddr; /* ICMP_REDIRECT */ 184807Swnj struct ih_idseq { 194807Swnj n_short icd_id; 204807Swnj n_short icd_seq; 214807Swnj } ih_idseq; 224807Swnj } icmp_hun; 234807Swnj #define icmp_pptr icmp_hun.ih_pptr 244807Swnj #define icmp_gwaddr icmp_hun.ih_gwaddr 254807Swnj #define icmp_id icmp_hun.ih_idseq.icd_id 264807Swnj #define icmp_seq icmp_hun.ih_idseq.icd_seq 274807Swnj union { 284807Swnj struct id_ts { 294807Swnj n_time its_otime; 304807Swnj n_time its_rtime; 314807Swnj n_time its_ttime; 324807Swnj } id_ts; 334807Swnj struct id_ip { 344807Swnj struct ip idi_ip; 354807Swnj /* options and then 64 bits of data */ 364807Swnj } id_ip; 374807Swnj } icmp_dun; 384807Swnj #define icmp_otime icmp_dun.id_ts.its_otime 394807Swnj #define icmp_rtime icmp_dun.id_ts.its_rtime 404807Swnj #define icmp_ttime icmp_dun.id_ts.its_ttime 414807Swnj #define icmp_ip icmp_dun.id_ip.idi_ip 424807Swnj }; 434807Swnj 444807Swnj /* 454807Swnj * Lower bounds on packet lengths for various types. 464807Swnj * For the error advice packets must first insure that the 474807Swnj * packet is large enought to contain the returned ip header. 484807Swnj * Only then can we do the check to see if 64 bits of packet 494807Swnj * data have been returned, since we need to check the returned 504807Swnj * ip header length. 514807Swnj */ 524807Swnj #define ICMP_MINLEN 8 /* abs minimum */ 534807Swnj #define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */ 544807Swnj #define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */ 554807Swnj #define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_len << 2) + 8) 564807Swnj /* N.B.: must separately check that ip_hl >= 5 */ 574807Swnj 584807Swnj /* 594807Swnj * Definition of type and code field values. 604807Swnj */ 614807Swnj #define ICMP_ECHOREPLY 0 /* echo reply */ 624807Swnj #define ICMP_UNREACH 3 /* dest unreachable, codes: */ 634807Swnj #define ICMP_UNREACH_NET 0 /* bad net */ 644807Swnj #define ICMP_UNREACH_HOST 1 /* bad host */ 654807Swnj #define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ 664807Swnj #define ICMP_UNREACH_PORT 3 /* bad port */ 674807Swnj #define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ 684807Swnj #define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ 694807Swnj #define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ 704807Swnj #define ICMP_REDIRECT 5 /* shorter route, codes: */ 714807Swnj #define ICMP_REDIRECT_NET 0 /* for network */ 724807Swnj #define ICMP_REDIRECT_HOST 1 /* for host */ 734807Swnj #define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ 744807Swnj #define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ 754807Swnj #define ICMP_ECHO 8 /* echo service */ 764807Swnj #define ICMP_TIMXCEED 11 /* time exceeded, code: */ 774807Swnj #define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ 784807Swnj #define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ 794807Swnj #define ICMP_TSTAMP 13 /* timestamp request */ 804807Swnj #define ICMP_TSTAMPREPLY 14 /* timestamp reply */ 814807Swnj #define ICMP_IREQ 15 /* information request */ 824807Swnj #define ICMP_IREQREPLY 16 /* information reply */ 834807Swnj #define ICMP_PARAMPROB 12 /* ip header bad */ 84