xref: /csrg-svn/sys/netns/ns_error.h (revision 26056)
1 /*
2  * Copyright (c) 1984, 1985  Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)ns_error.h	6.3 (Berkeley) 02/03/86
7  */
8 
9 /*
10  * Xerox NS error messages
11  */
12 
13 struct ns_errp {
14 	u_short		ns_err_num;		/* Error Number */
15 	u_short		ns_err_param;		/* Error Parameter */
16 	struct idp	ns_err_idp;		/* Initial segment of offending
17 						   packet */
18 	u_char		ns_err_lev2[12];	/* at least this much higher
19 						   level protocol */
20 };
21 struct  ns_epidp {
22 	struct idp ns_ep_idp;
23 	struct ns_errp ns_ep_errp;
24 };
25 
26 #define	NS_ERR_UNSPEC	0	/* Unspecified Error detected at dest. */
27 #define	NS_ERR_BADSUM	1	/* Bad Checksum detected at dest */
28 #define	NS_ERR_NOSOCK	2	/* Specified socket does not exist at dest*/
29 #define	NS_ERR_FULLUP	3	/* Dest. refuses packet due to resource lim.*/
30 #define	NS_ERR_UNSPEC_T	0x200	/* Unspec. Error occured before reaching dest*/
31 #define	NS_ERR_BADSUM_T	0x201	/* Bad Checksum detected in transit */
32 #define	NS_ERR_UNREACH_HOST	0x202	/* Dest cannot be reached from here*/
33 #define	NS_ERR_TOO_OLD	0x203	/* Packet x'd 15 routers without delivery*/
34 #define	NS_ERR_TOO_BIG	0x204	/* Packet too large to be forwarded through
35 				   some intermediate gateway.  The error
36 				   parameter field contains the max packet
37 				   size that can be accommodated */
38 #define NS_ERR_ATHOST	4
39 #define NS_ERR_ENROUTE	5
40 #define NS_ERR_MAX (NS_ERR_ATHOST + NS_ERR_ENROUTE + 1)
41 #define ns_err_x(c) (((c)&0x200) ? ((c) - 0x200 + NS_ERR_ATHOST) : c )
42 
43 /*
44  * Variables related to this implementation
45  * of the network systems error message protocol.
46  */
47 struct	ns_errstat {
48 /* statistics related to ns_err packets generated */
49 	int	ns_es_error;		/* # of calls to ns_error */
50 	int	ns_es_oldshort;		/* no error 'cuz old ip too short */
51 	int	ns_es_oldns_err;	/* no error 'cuz old was ns_err */
52 	int	ns_es_outhist[NS_ERR_MAX];
53 /* statistics related to input messages processed */
54 	int	ns_es_badcode;		/* ns_err_code out of range */
55 	int	ns_es_tooshort;		/* packet < IDP_MINLEN */
56 	int	ns_es_checksum;		/* bad checksum */
57 	int	ns_es_badlen;		/* calculated bound mismatch */
58 	int	ns_es_reflect;		/* number of responses */
59 	int	ns_es_inhist[NS_ERR_MAX];
60 };
61 
62 #ifdef KERNEL
63 struct	ns_errstat ns_errstat;
64 #endif
65