advance snd_max even when persisting
[unix-history] / usr / src / sys / netinet / ip_icmp.h
CommitLineData
39674d5f 1/* ip_icmp.h 4.5 82/04/25 */
9fc9afc2
BJ
2
3/*
4 * Interface Control Message Protocol Definitions.
5 * Per RFC 792, September 1981.
6 */
7
8/*
9 * Structure of an icmp header.
10 */
11struct icmp {
12 u_char icmp_type; /* type of message, see below */
13 u_char icmp_code; /* type sub code */
14 u_short icmp_cksum; /* ones complement cksum of struct */
15 union {
16 u_char ih_pptr; /* ICMP_PARAMPROB */
2b4b57cd 17 struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
9fc9afc2
BJ
18 struct ih_idseq {
19 n_short icd_id;
20 n_short icd_seq;
21 } ih_idseq;
72e4f44e 22 int ih_void;
9fc9afc2
BJ
23 } icmp_hun;
24#define icmp_pptr icmp_hun.ih_pptr
25#define icmp_gwaddr icmp_hun.ih_gwaddr
26#define icmp_id icmp_hun.ih_idseq.icd_id
27#define icmp_seq icmp_hun.ih_idseq.icd_seq
72e4f44e 28#define icmp_void icmp_hun.ih_void
9fc9afc2
BJ
29 union {
30 struct id_ts {
31 n_time its_otime;
32 n_time its_rtime;
33 n_time its_ttime;
34 } id_ts;
35 struct id_ip {
36 struct ip idi_ip;
37 /* options and then 64 bits of data */
38 } id_ip;
39 } icmp_dun;
40#define icmp_otime icmp_dun.id_ts.its_otime
41#define icmp_rtime icmp_dun.id_ts.its_rtime
42#define icmp_ttime icmp_dun.id_ts.its_ttime
43#define icmp_ip icmp_dun.id_ip.idi_ip
44};
45
46/*
47 * Lower bounds on packet lengths for various types.
48 * For the error advice packets must first insure that the
49 * packet is large enought to contain the returned ip header.
50 * Only then can we do the check to see if 64 bits of packet
51 * data have been returned, since we need to check the returned
52 * ip header length.
53 */
54#define ICMP_MINLEN 8 /* abs minimum */
55#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */
56#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
39674d5f 57#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
9fc9afc2
BJ
58 /* N.B.: must separately check that ip_hl >= 5 */
59
60/*
61 * Definition of type and code field values.
62 */
63#define ICMP_ECHOREPLY 0 /* echo reply */
64#define ICMP_UNREACH 3 /* dest unreachable, codes: */
65#define ICMP_UNREACH_NET 0 /* bad net */
66#define ICMP_UNREACH_HOST 1 /* bad host */
67#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
68#define ICMP_UNREACH_PORT 3 /* bad port */
69#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
70#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
71#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */
72#define ICMP_REDIRECT 5 /* shorter route, codes: */
73#define ICMP_REDIRECT_NET 0 /* for network */
74#define ICMP_REDIRECT_HOST 1 /* for host */
75#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */
76#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */
77#define ICMP_ECHO 8 /* echo service */
78#define ICMP_TIMXCEED 11 /* time exceeded, code: */
79#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
80#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */
b454c3ea 81#define ICMP_PARAMPROB 12 /* ip header bad */
9fc9afc2
BJ
82#define ICMP_TSTAMP 13 /* timestamp request */
83#define ICMP_TSTAMPREPLY 14 /* timestamp reply */
84#define ICMP_IREQ 15 /* information request */
85#define ICMP_IREQREPLY 16 /* information reply */