xref: /csrg-svn/sys/netiso/esis.h (revision 36380)
1*36380Ssklower /***********************************************************
2*36380Ssklower 		Copyright IBM Corporation 1987
3*36380Ssklower 
4*36380Ssklower                       All Rights Reserved
5*36380Ssklower 
6*36380Ssklower Permission to use, copy, modify, and distribute this software and its
7*36380Ssklower documentation for any purpose and without fee is hereby granted,
8*36380Ssklower provided that the above copyright notice appear in all copies and that
9*36380Ssklower both that copyright notice and this permission notice appear in
10*36380Ssklower supporting documentation, and that the name of IBM not be
11*36380Ssklower used in advertising or publicity pertaining to distribution of the
12*36380Ssklower software without specific, written prior permission.
13*36380Ssklower 
14*36380Ssklower IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15*36380Ssklower ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16*36380Ssklower IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17*36380Ssklower ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18*36380Ssklower WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19*36380Ssklower ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20*36380Ssklower SOFTWARE.
21*36380Ssklower 
22*36380Ssklower ******************************************************************/
23*36380Ssklower 
24*36380Ssklower /*
25*36380Ssklower  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
26*36380Ssklower  */
27*36380Ssklower /*
28*36380Ssklower  *	$Header: esis.h,v 4.7 88/09/15 11:24:18 hagens Exp $
29*36380Ssklower  *	$Source: /usr/argo/sys/netiso/RCS/esis.h,v $
30*36380Ssklower  */
31*36380Ssklower 
32*36380Ssklower #ifndef BYTE_ORDER
33*36380Ssklower /*
34*36380Ssklower  * Definitions for byte order,
35*36380Ssklower  * according to byte significance from low address to high.
36*36380Ssklower  */
37*36380Ssklower #define	LITTLE_ENDIAN	1234	/* least-significant byte first (vax) */
38*36380Ssklower #define	BIG_ENDIAN	4321	/* most-significant byte first (IBM, net) */
39*36380Ssklower #define	PDP_ENDIAN	3412	/* LSB first in word, MSW first in long (pdp) */
40*36380Ssklower 
41*36380Ssklower #ifdef vax
42*36380Ssklower #define	BYTE_ORDER	LITTLE_ENDIAN
43*36380Ssklower #else
44*36380Ssklower #define	BYTE_ORDER	BIG_ENDIAN	/* mc68000, tahoe, most others */
45*36380Ssklower #endif
46*36380Ssklower #endif BYTE_ORDER
47*36380Ssklower 
48*36380Ssklower #define	SNPAC_AGE		60			/* seconds */
49*36380Ssklower #define	ESIS_CONFIG		60			/* seconds */
50*36380Ssklower #define	ESIS_HT			(ESIS_CONFIG * 2)
51*36380Ssklower 
52*36380Ssklower /*
53*36380Ssklower  *	Fixed part of an ESIS header
54*36380Ssklower  */
55*36380Ssklower struct esis_fixed {
56*36380Ssklower 	u_char	esis_proto_id;		/* network layer protocol identifier */
57*36380Ssklower 	u_char	esis_hdr_len;		/* length indicator (octets) */
58*36380Ssklower 	u_char	esis_vers;			/* version/protocol identifier extension */
59*36380Ssklower 	u_char	esis_res1;			/* reserved */
60*36380Ssklower #if BYTE_ORDER == LITTLE_ENDIAN
61*36380Ssklower 	u_char		esis_type:5,		/* type code */
62*36380Ssklower 			esis_res4:1,		/* reserved */
63*36380Ssklower 			esis_res3:1,		/* reserved */
64*36380Ssklower 			esis_res2:1;		/* reserved */
65*36380Ssklower #define ESIS_ESH	0x02		/* End System Hello */
66*36380Ssklower #define ESIS_ISH	0x04		/* Intermediate System Hello */
67*36380Ssklower #define ESIS_RD		0x06		/* Redirect */
68*36380Ssklower #endif
69*36380Ssklower #if BYTE_ORDER == BIG_ENDIAN
70*36380Ssklower 	u_char	esis_res2:1,		/* reserved */
71*36380Ssklower 			esis_res3:1,		/* reserved */
72*36380Ssklower 			esis_res4:1,		/* reserved */
73*36380Ssklower 			esis_type:5;		/* type code */
74*36380Ssklower #define ESIS_ESH	0x02		/* End System Hello */
75*36380Ssklower #define ESIS_ISH	0x04		/* Intermediate System Hello */
76*36380Ssklower #define ESIS_RD		0x06		/* Redirect */
77*36380Ssklower #endif
78*36380Ssklower 	u_char	esis_ht_msb;		/* holding time (seconds) high byte */
79*36380Ssklower 	u_char	esis_ht_lsb;		/* holding time (seconds) low byte */
80*36380Ssklower 	u_char	esis_cksum_msb;		/* checksum high byte */
81*36380Ssklower 	u_char	esis_cksum_lsb;		/* checksum low byte */
82*36380Ssklower };
83*36380Ssklower 
84*36380Ssklower #define	ESIS_CKSUM_OFF		0x07
85*36380Ssklower #define ESIS_CKSUM_REQUIRED(pdu)\
86*36380Ssklower 	((pdu->esis_cksum_msb != 0) || (pdu->esis_cksum_lsb != 0))
87*36380Ssklower 
88*36380Ssklower #define	ESIS_VERSION	1
89*36380Ssklower 
90*36380Ssklower struct esis_stat {
91*36380Ssklower 	u_short		es_nomem;			/* insufficient memory to send hello */
92*36380Ssklower 	u_short		es_badcsum;			/* incorrect checksum */
93*36380Ssklower 	u_short		es_badvers;			/* incorrect version number */
94*36380Ssklower 	u_short		es_badtype;			/* unknown pdu type field */
95*36380Ssklower 	u_short		es_toosmall;		/* packet too small */
96*36380Ssklower 	u_short		es_eshsent;			/* ESH sent */
97*36380Ssklower 	u_short		es_eshrcvd;			/* ESH rcvd */
98*36380Ssklower 	u_short		es_ishsent;			/* ISH sent */
99*36380Ssklower 	u_short		es_ishrcvd;			/* ISH rcvd */
100*36380Ssklower 	u_short		es_rdsent;			/* RD sent */
101*36380Ssklower 	u_short		es_rdrcvd;			/* RD rcvd */
102*36380Ssklower };
103*36380Ssklower 
104*36380Ssklower #ifdef	KERNEL
105*36380Ssklower struct esis_stat esis_stat;
106*36380Ssklower #endif	KERNEL
107