xref: /original-bsd/sys/deprecated/bbnnet/icmp.h (revision 0fc6f013)
1 #define RCSICMPHDR	"$Header: icmp.h,v 1.6 85/07/31 09:29:40 walsh Exp $"
2 
3 
4 struct icmp {				/* icmp header */
5 	u_char ic_type;				/* icmp message type */
6 	u_char ic_code;				/* icmp message sub-type */
7 	u_short ic_sum;	 			/* checksum */
8 	union {
9 		u_char I_off;			/* parameter error offset */
10 		struct in_addr I_gaddr;		/* redirect gateway addr */
11 		struct {
12 			u_short I_id;		/* echo/timestamp id */
13 			u_short I_seq;		/* echo/timestamp sequence */
14 		} I_iseq;
15 		long I_misc;			/* the whole field */
16 	} I_un1;
17 #define ic_off		I_un1.I_off
18 #define ic_gaddr 	I_un1.I_gaddr
19 #define ic_id 		I_un1.I_iseq.I_id
20 #define ic_seq 		I_un1.I_iseq.I_seq
21 #define ic_misc 	I_un1.I_misc
22 	union {
23 		struct ip I_iphdr;		/* ip/{proto} hdr of original
24 						 * IP datagram.  Has >=
25 						 * ICMP_ERRLEN bytes  of
26 						 * protocol header
27 						 */
28 		struct {
29 			long I_torg;		/* originate timestamp */
30 			long I_trcv;		/* receive timestamp */
31 			long I_txmt;		/* transmit timestamp */
32 		} I_time;
33 		char I_data[1];			/* echo data */
34 	} I_un2;
35 };
36 #define ic_iphdr	I_un2.I_iphdr
37 #define ic_torg		I_un2.I_time.I_torg
38 #define ic_trcv		I_un2.I_time.I_trcv
39 #define ic_txmt		I_un2.I_time.I_txmt
40 #define ic_data		I_un2.I_data
41 
42 					/* icmp message types */
43 #define ICMP_ECHOR	0			/* echo reply */
44 #define ICMP_UNRCH	3			/* destination unreachable */
45 #define		ICMP_UNRCH_NET		0		/* net unreachable */
46 #define		ICMP_UNRCH_HOST		1		/* host unreachable */
47 #define		ICMP_UNRCH_PR		2		/* protocol unrch */
48 #define		ICMP_UNRCH_PORT		3		/* port unreachable */
49 #define 	ICMP_UNRCH_FRAG		4		/* DF on fragment */
50 #define		ICMP_UNRCH_SRC		5		/* bad source route */
51 #define		ICMP_UNRCH_NUM		6
52 #define	ICMP_SRCQ	4			/* source quench */
53 #define ICMP_REDIR	5			/* redirect */
54 #define 	ICMP_REDIR_NET		0		/* network */
55 #define		ICMP_REDIR_HOST		1		/* host */
56 #define		ICMP_REDIR_TNET		2		/* TOS & network */
57 #define		ICMP_REDIR_THOST	3		/* TOS & host */
58 #define ICMP_ECHO	8			/* echo */
59 #define ICMP_TIMEX	11			/* time exceeded */
60 #define 	ICMP_TIMEX_XMT		0		/* in transit */
61 #define		ICMP_TIMEX_REASS	1		/* reassembly */
62 #define ICMP_PARM	12			/* parameter problem */
63 #define ICMP_TIMES	13			/* timestamp */
64 #define ICMP_TIMESR	14			/* timestamp reply */
65 #define ICMP_INFO	15			/* information request */
66 #define ICMP_INFOR	16			/* information reply */
67 
68 #define ICMPSIZE 8	/* size of min. echo packet */
69 #define PINGTIME 8	/* ping interval (in sec/2) */
70 #define MAXPING 5	/* no. of pings before decide gway is down */
71 
72 #define RT_REINSTATE 2	/* number of ping intervals a gateway stays down.
73 			 * See ip_gdown() and check_ping().
74 			 */
75 
76 #define ICMP_ERRLEN 8	 /* 64 bits  == 8 bytes */
77 
78 #define MY_ECHO_ID	0xffff
79 
80 /*
81  * icmp statistics
82  */
83 
84 struct icmp_stat {
85     struct in_stat ic_in;
86 #define ic_total	ic_in.in_total
87 #define ic_badsum	ic_in.in_badsum
88 #define ic_tooshort	ic_in.in_tooshort
89 #define ic_drops	ic_in.in_drops
90     int ic_broadcast;		/* #icmp pkts rcv that were broadcast (ign) */
91     int ic_quenches;		/* #icmp source quenches received */
92     int ic_redirects;		/* #icmp redirects received */
93     int ic_echoes;		/* #icmp echo requests respond to */
94     int ic_svpings;		/* #pings saved by -1 hack */
95     int ic_pings;		/* #pings actually sent */
96     int ic_timex;		/* #icmp time exceeded messages received */
97     int ic_parm;		/* #icmp parameter problem received */
98 };
99 
100 #ifdef KERNEL
101 extern struct icmp_stat icmpstat;
102 #endif
103