xref: /original-bsd/sys/netiso/eonvar.h (revision 3705696b)
1 /*-
2  * Copyright (c) 1991, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)eonvar.h	8.1 (Berkeley) 06/10/93
8  */
9 
10 /***********************************************************
11 		Copyright IBM Corporation 1987
12 
13                       All Rights Reserved
14 
15 Permission to use, copy, modify, and distribute this software and its
16 documentation for any purpose and without fee is hereby granted,
17 provided that the above copyright notice appear in all copies and that
18 both that copyright notice and this permission notice appear in
19 supporting documentation, and that the name of IBM not be
20 used in advertising or publicity pertaining to distribution of the
21 software without specific, written prior permission.
22 
23 IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
24 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
25 IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
26 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
27 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
28 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
29 SOFTWARE.
30 
31 ******************************************************************/
32 
33 /*
34  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
35  */
36 
37 #define EON_986_VERSION 0x3
38 #define EON_VERSION 0x1
39 
40 #define EON_CACHESIZE 30
41 
42 #define E_FREE 	1
43 #define E_LINK	2
44 #define E_ES 	3
45 #define E_IS 	4
46 
47 
48 /*
49  * this overlays a sockaddr_iso
50  */
51 
52 struct sockaddr_eon {
53 	u_char 			seon_len;	/* Length */
54 	u_char 			seon_family;	/* AF_ISO */
55 	u_char			seon_status;	/* overlays session suffixlen */
56 #define EON_ESLINK_UP		0x1
57 #define EON_ESLINK_DOWN		0x2
58 #define EON_ISLINK_UP		0x10
59 #define EON_ISLINK_DOWN		0x20
60 /* no change is neither up or down */
61 	u_char			seon_pad1;	/* 0, overlays tsfxlen */
62 	u_char			seon_adrlen;
63 	u_char			seon_afi;		/* 47 */
64 	u_char			seon_idi[2];	/* 0006 */
65 	u_char			seon_vers;		/* 03 */
66 	u_char			seon_glbnum[2];	/* see RFC 1069 */
67 	u_char			seon_RDN[2];	/* see RFC 1070 */
68 	u_char			seon_pad2[3];	/* see RFC 1070 */
69 	u_char			seon_LAREA[2];	/* see RFC 1070 */
70 	u_char			seon_pad3[2];	/* see RFC 1070 */
71 		/* right now ip addr is  aligned  -- be careful --
72 		 * future revisions may have it u_char[4]
73 		 */
74 	u_int			seon_ipaddr;	/* a.b.c.d */
75 	u_char			seon_protoid;	/* NSEL */
76 };
77 
78 #ifdef EON_TEMPLATE
79 struct sockaddr_eon eon_template = {
80 	sizeof (eon_template), AF_ISO, 0, 0, 0x14,
81 	0x47, 0x0, 0x6, 0x3, 0
82 };
83 #endif
84 
85 #define DOWNBITS ( EON_ESLINK_DOWN | EON_ISLINK_DOWN )
86 #define UPBITS ( EON_ESLINK_UP | EON_ISLINK_UP )
87 
88 #define	SIOCSEONCORE _IOWR('i',10, struct iso_ifreq) /* EON core member */
89 #define	SIOCGEONCORE _IOWR('i',11, struct iso_ifreq) /* EON core member */
90 
91 struct eon_hdr {
92 	u_char 	eonh_vers; /* value 1 */
93 	u_char 	eonh_class;  /* address multicast class, below */
94 #define		EON_NORMAL_ADDR		0x0
95 #define		EON_MULTICAST_ES	0x1
96 #define		EON_MULTICAST_IS	0x2
97 #define		EON_BROADCAST		0x3
98 	u_short eonh_csum;  /* osi checksum (choke)*/
99 };
100 struct eon_iphdr {
101 	struct	ip	ei_ip;
102 	struct	eon_hdr	ei_eh;
103 };
104 #define EONIPLEN (sizeof(struct eon_hdr) + sizeof(struct ip))
105 
106 /* stole these 2 fields of the flags for I-am-ES and I-am-IS */
107 #define	IFF_ES	0x400
108 #define	IFF_IS	0x800
109 
110 struct eon_stat {
111 	int	es_in_multi_es;
112 	int	es_in_multi_is;
113 	int	es_in_broad;
114 	int	es_in_normal;
115 	int	es_out_multi_es;
116 	int	es_out_multi_is;
117 	int	es_out_broad;
118 	int	es_out_normal;
119 	int	es_ipout;
120 
121 	int	es_icmp[PRC_NCMDS];
122 	/* errors */
123 	int	es_badcsum;
124 	int	es_badhdr;
125 } eonstat;
126 
127 #undef IncStat
128 #define IncStat(xxx) eonstat.xxx++
129 
130 typedef struct qhdr {
131 	struct qhdr *link, *rlink;
132 } *queue_t;
133 
134 struct eon_llinfo {
135 	struct	qhdr el_qhdr;		/* keep all in a list */
136 	int	el_flags;		/* cache valid ? */
137 	int	el_snpaoffset;		/* IP address contained in dst nsap */
138 	struct	rtentry *el_rt;		/* back pointer to parent route */
139 	struct	eon_iphdr el_ei;	/* precomputed portion of hdr */
140 	struct	route el_iproute;	/* if direct route cache IP info */
141 					/* if gateway, cache secondary route */
142 };
143 #define el_iphdr el_ei.ei_ip
144 #define el_eonhdr el_ei.ei_eh
145