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