xref: /original-bsd/sys/netns/ns_error.h (revision 79cf7955)
1 /*
2  * Copyright (c) 1984, 1988 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 the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  *	@(#)ns_error.h	7.4 (Berkeley) 06/29/88
18  */
19 
20 /*
21  * Xerox NS error messages
22  */
23 
24 struct ns_errp {
25 	u_short		ns_err_num;		/* Error Number */
26 	u_short		ns_err_param;		/* Error Parameter */
27 	struct idp	ns_err_idp;		/* Initial segment of offending
28 						   packet */
29 	u_char		ns_err_lev2[12];	/* at least this much higher
30 						   level protocol */
31 };
32 struct  ns_epidp {
33 	struct idp ns_ep_idp;
34 	struct ns_errp ns_ep_errp;
35 };
36 
37 #define	NS_ERR_UNSPEC	0	/* Unspecified Error detected at dest. */
38 #define	NS_ERR_BADSUM	1	/* Bad Checksum detected at dest */
39 #define	NS_ERR_NOSOCK	2	/* Specified socket does not exist at dest*/
40 #define	NS_ERR_FULLUP	3	/* Dest. refuses packet due to resource lim.*/
41 #define	NS_ERR_UNSPEC_T	0x200	/* Unspec. Error occured before reaching dest*/
42 #define	NS_ERR_BADSUM_T	0x201	/* Bad Checksum detected in transit */
43 #define	NS_ERR_UNREACH_HOST	0x202	/* Dest cannot be reached from here*/
44 #define	NS_ERR_TOO_OLD	0x203	/* Packet x'd 15 routers without delivery*/
45 #define	NS_ERR_TOO_BIG	0x204	/* Packet too large to be forwarded through
46 				   some intermediate gateway.  The error
47 				   parameter field contains the max packet
48 				   size that can be accommodated */
49 #define NS_ERR_MAX 20
50 
51 /*
52  * Variables related to this implementation
53  * of the network systems error message protocol.
54  */
55 struct	ns_errstat {
56 /* statistics related to ns_err packets generated */
57 	int	ns_es_error;		/* # of calls to ns_error */
58 	int	ns_es_oldshort;		/* no error 'cuz old ip too short */
59 	int	ns_es_oldns_err;	/* no error 'cuz old was ns_err */
60 	int	ns_es_outhist[NS_ERR_MAX];
61 /* statistics related to input messages processed */
62 	int	ns_es_badcode;		/* ns_err_code out of range */
63 	int	ns_es_tooshort;		/* packet < IDP_MINLEN */
64 	int	ns_es_checksum;		/* bad checksum */
65 	int	ns_es_badlen;		/* calculated bound mismatch */
66 	int	ns_es_reflect;		/* number of responses */
67 	int	ns_es_inhist[NS_ERR_MAX];
68 	u_short	ns_es_codes[NS_ERR_MAX];/* which error code for outhist
69 					   since we might not know all */
70 };
71 
72 #ifdef KERNEL
73 struct	ns_errstat ns_errstat;
74 #endif
75