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