FreeBSD/Linux Kernel Cross Reference
sys/netiso/eonvar.h
1 /* $NetBSD: eonvar.h,v 1.12 2004/04/20 02:13:26 matt Exp $ */
2
3 /*-
4 * Copyright (c) 1991, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)eonvar.h 8.1 (Berkeley) 6/10/93
32 */
33
34 /***********************************************************
35 Copyright IBM Corporation 1987
36
37 All Rights Reserved
38
39 Permission to use, copy, modify, and distribute this software and its
40 documentation for any purpose and without fee is hereby granted,
41 provided that the above copyright notice appear in all copies and that
42 both that copyright notice and this permission notice appear in
43 supporting documentation, and that the name of IBM not be
44 used in advertising or publicity pertaining to distribution of the
45 software without specific, written prior permission.
46
47 IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
48 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
49 IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
50 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
51 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
52 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
53 SOFTWARE.
54
55 ******************************************************************/
56
57 /*
58 * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
59 */
60
61 #include <sys/ansi.h>
62
63 #ifndef sa_family_t
64 typedef __sa_family_t sa_family_t;
65 #define sa_family_t __sa_family_t
66 #endif
67
68 #define EON_986_VERSION 0x3
69 #define EON_VERSION 0x1
70
71 #define EON_CACHESIZE 30
72
73 #define E_FREE 1
74 #define E_LINK 2
75 #define E_ES 3
76 #define E_IS 4
77
78
79 /*
80 * this overlays a sockaddr_iso
81 */
82
83 struct sockaddr_eon {
84 u_char seon_len; /* Length */
85 sa_family_t seon_family; /* AF_ISO */
86 u_char seon_status; /* overlays session suffixlen */
87 #define EON_ESLINK_UP 0x1
88 #define EON_ESLINK_DOWN 0x2
89 #define EON_ISLINK_UP 0x10
90 #define EON_ISLINK_DOWN 0x20
91 /* no change is neither up or down */
92 u_char seon_pad1; /* 0, overlays tsfxlen */
93 u_char seon_adrlen;
94 u_char seon_afi; /* 47 */
95 u_char seon_idi[2]; /* 0006 */
96 u_char seon_vers; /* 03 */
97 u_char seon_glbnum[2]; /* see RFC 1069 */
98 u_char seon_RDN[2]; /* see RFC 1070 */
99 u_char seon_pad2[3]; /* see RFC 1070 */
100 u_char seon_LAREA[2]; /* see RFC 1070 */
101 u_char seon_pad3[2]; /* see RFC 1070 */
102 /*
103 * right now ip addr is aligned -- be careful -- future revisions
104 * may have it u_char[4]
105 */
106 u_int seon_ipaddr; /* a.b.c.d */
107 u_char seon_protoid; /* NSEL */
108 };
109
110 #ifdef EON_TEMPLATE
111 struct sockaddr_eon eon_template = {
112 sizeof(eon_template), AF_ISO, 0, 0, 0x14,
113 0x47, 0x0, 0x6, 0x3, 0
114 };
115 #endif
116
117 #define DOWNBITS ( EON_ESLINK_DOWN | EON_ISLINK_DOWN )
118 #define UPBITS ( EON_ESLINK_UP | EON_ISLINK_UP )
119
120 struct eon_hdr {
121 u_char eonh_vers; /* value 1 */
122 u_char eonh_class; /* address multicast class, below */
123 #define EON_NORMAL_ADDR 0x0
124 #define EON_MULTICAST_ES 0x1
125 #define EON_MULTICAST_IS 0x2
126 #define EON_BROADCAST 0x3
127 u_short eonh_csum; /* osi checksum (choke) */
128 };
129 struct eon_iphdr {
130 struct ip ei_ip;
131 struct eon_hdr ei_eh;
132 };
133 #define EONIPLEN (sizeof(struct eon_hdr) + sizeof(struct ip))
134
135 /* stole these 2 fields of the flags for I-am-ES and I-am-IS */
136 #define IFF_ES 0x400
137 #define IFF_IS 0x800
138
139 struct eon_stat {
140 int es_in_multi_es;
141 int es_in_multi_is;
142 int es_in_broad;
143 int es_in_normal;
144 int es_out_multi_es;
145 int es_out_multi_is;
146 int es_out_broad;
147 int es_out_normal;
148 int es_ipout;
149
150 int es_icmp[PRC_NCMDS];
151 /* errors */
152 int es_badcsum;
153 int es_badhdr;
154 } eonstat;
155
156 #undef IncStat
157 #define IncStat(xxx) eonstat.xxx++
158
159 typedef struct qhdr {
160 struct qhdr *link, *rlink;
161 } *queue_t;
162
163 struct eon_llinfo {
164 struct qhdr el_qhdr;/* keep all in a list */
165 int el_flags; /* cache valid ? */
166 int el_snpaoffset; /* IP address contained in dst nsap */
167 struct rtentry *el_rt; /* back pointer to parent route */
168 struct eon_iphdr el_ei; /* precomputed portion of hdr */
169 struct route el_iproute; /* if direct route cache IP info */
170 /* if gateway, cache secondary route */
171 };
172 #define el_iphdr el_ei.ei_ip
173 #define el_eonhdr el_ei.ei_eh
174
175 #ifdef _KERNEL
176 void eonprotoinit (void);
177 void eonattach (void);
178 int eonioctl (struct ifnet *, u_long, caddr_t);
179 void eoniphdr (struct eon_iphdr *, caddr_t, struct route *, int, int);
180 void eonrtrequest (int, struct rtentry *, struct rt_addrinfo *);
181 int eonoutput (struct ifnet *, struct mbuf *, struct sockaddr *,
182 struct rtentry *);
183 void eoninput (struct mbuf *, ...);
184 void *eonctlinput (int, struct sockaddr *, void *);
185 #endif
Cache object: 9a0fb7f3f2b1030668f0bed49cece14d
|