date and time created 88/12/14 15:29:41 by sklower
[unix-history] / usr / src / sys / netiso / iso.h
CommitLineData
72a0a0dc
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
26 */
27/* $Header: iso.h,v 4.9 88/09/11 18:06:38 hagens Exp $ */
28/* $Source: /usr/argo/sys/netiso/RCS/iso.h,v $ */
29
30#ifndef __ISO__
31#define __ISO__
32
33/*
34 * Return true if this is a multicast address
35 * This assumes that the bit transmission is lsb first. This
36 * assumption is valid for 802.3 but not 802.5. There is a
37 * kludge to get around this for 802.5 -- see if_lan.c
38 * where subnetwork header is setup.
39 */
40#define IS_MULTICAST(snpa)\
41 ((snpa)[0] & 0x01)
42
43/*
44 * Protocols
45 */
46#define ISOPROTO_TP0 25 /* connection oriented transport protocol */
47#define ISOPROTO_TP1 26 /* not implemented */
48#define ISOPROTO_TP2 27 /* not implemented */
49#define ISOPROTO_TP3 28 /* not implemented */
50#define ISOPROTO_TP4 29 /* connection oriented transport protocol */
51#define ISOPROTO_TP ISOPROTO_TP4 /* tp-4 with negotiation */
52#define ISOPROTO_CLTP 30 /* connectionless transport (not yet impl.) */
53#define ISOPROTO_CLNP 31 /* connectionless internetworking protocol */
54#define ISOPROTO_X25 32 /* cons */
55#define ISOPROTO_INACT_NL 33 /* inactive network layer! */
56#define ISOPROTO_ESIS 34 /* ES-IS protocol */
57
58#define ISOPROTO_RAW 255 /* raw clnp */
59#define ISOPROTO_MAX 256
60
61#define ISO_PORT_RESERVED 1024
62#define ISO_PORT_USERRESERVED 5000
63/*
64 * Port/socket numbers: standard network functions
65 * NOT PRESENTLY USED
66 */
67#define ISO_PORT_MAINT 501
68#define ISO_PORT_ECHO 507
69#define ISO_PORT_DISCARD 509
70#define ISO_PORT_SYSTAT 511
71#define ISO_PORT_NETSTAT 515
72/*
73 * Port/socket numbers: non-standard application functions
74 */
75#define ISO_PORT_LOGIN 513
76/*
77 * Port/socket numbers: public use
78 */
79#define ISO_PORT_PUBLIC 1024 /* high bit set --> public */
80
81/*
82 * Network layer protocol identifiers
83 */
84#define ISO8473_CLNP 0x81
85#define ISO9542_ESIS 0x82
86#define ISO9542X25_ESIS 0x8a
87
88#ifndef IN_CLASSA_NET
89#include "../netinet/in.h"
90#endif IN_CLASSA_NET
91
92/*
93 * Type 37 Address
94 *
95 * This address is named for the value of its AFI (37). This format
96 * supports an X.121 address. A type 37 address has the following format:
97 *
98 * <----- idp -------> <- dsp ->
99 * <- afi -> <- idi -> <- dsp ->
100 * | "37" | 7 bytes | 9 bytes |
101 *
102 * The idi contains 14 bcd digits of X.121 address.
103 * The use of the dsp part is unknown.
104 *
105 * The afi is considered the "network" portion of the address.
106 * This means that you can't have multihoming in the x.25 environment.
107 * Makes loopback a bear.
108 */
109#ifdef BIGSOCKADDRS
110#define ADDR37_IDI_LEN 7 /* 14 bcd digits == 7 octets */
111#define ADDR37_DSP_LEN 9
112#else
113#define ADDR37_IDI_LEN 7 /* 14 bcd digits == 7 octets */
114#define ADDR37_DSP_LEN 3 /* this is a lie to fit in sockaddr */
115#endif BIGSOCKADDRS
116struct addr_37 {
117 u_char a37_idi[ADDR37_IDI_LEN]; /* initial domain identifier */
118 u_char a37_dsp[ADDR37_DSP_LEN]; /* domain specific part */
119};
120
121struct ovl_37 { /* overlay for type 37 address */
122 u_char o37_afi; /* afi */
123 u_char o37_x121[ADDR37_IDI_LEN]; /* X.121 address */
124 u_char o37_dsp[ADDR37_DSP_LEN]; /* unknown use at this time */
125};
126
127/*
128 * OSINET address
129 *
130 * This style address is used by the OSINET group
131 * An OSINET address has the following (variable-length) format
132 *
133 * <----- idp -------> <---------------- dsp --------------------------->
134 * <- afi -> <- idi -> <---------------- dsp --------------------------->
135 * | "47" | "0004" | 11 bytes |
136 * | afi(1)| osinetid | orgid(2) | subnet id(2) | (4-8) | nsap sel(1) |
137 *
138 * the afi, orgid, and subnet id are considered the "network" portion of
139 * the address.
140 */
141#ifdef BIGSOCKADDRS
142#define ADDROSINET_IDI_LEN 2
143#define ADDROSINET_DSP_LEN 11
144#else
145#define ADDROSINET_IDI_LEN 2
146#define ADDROSINET_DSP_LEN 8 /* this is a lie to fit in sockaddr */
147#endif BIGSOCKADDRS
148struct addr_osinet {
149 u_char aosi_idi[ADDROSINET_IDI_LEN]; /* initial domain identifier */
150 u_char aosi_dsp[ADDROSINET_DSP_LEN]; /* domain specific part */
151};
152
153#define OVLOSINET_ID_LEN 2
154#ifdef BIGSOCKADDRS
155#define OVLOSINET_ORGID_LEN 2
156#define OVLOSINET_SNETID_LEN 2
157#define OVLOSINET_SNPA_LEN 8
158#define OVLOSINET_NSAP_LEN 1
159#else
160#define OVLOSINET_ORGID_LEN 2
161#define OVLOSINET_SNETID_LEN 2
162#define OVLOSINET_SNPA_LEN 5 /* this is a lie to fit in sockaddr */
163#define OVLOSINET_NSAP_LEN 1
164#endif BIGSOCKADDRS
165struct ovl_osinet { /* overlay for osinet address */
166 u_char oosi_afi; /* afi */
167 u_char oosi_id[OVLOSINET_ID_LEN]; /* osinet id */
168 u_char oosi_orgid[OVLOSINET_ORGID_LEN]; /* orgid */
169 u_char oosi_snetid[OVLOSINET_SNETID_LEN]; /* subnet id */
170 u_char oosi_snpa[OVLOSINET_SNPA_LEN]; /* snpa */
171 u_char oosi_nsap[OVLOSINET_NSAP_LEN]; /* nsap sel */
172};
173
174/*
175 * RFC 986 address
176 *
177 * This style address is used when DOD internet addresses are used
178 * The format of rfc986 addresses is:
179 *
180 * <----- idp -------> <---------------- dsp -------------------->
181 * <- afi -> <- idi -> <---------------- dsp -------------------->
182 * | "47" | "0006" | 6 bytes |
183 * | afi(1)| idi(2) | version (1) | inet addr (4) | proto id(1) |
184 *
185 * the afi, idi, and network portion of the inet address are considered
186 * the "network" portion of the address.
187 */
188#define ADDRRFC986_IDI_LEN 2
189#define ADDRRFC986_DSP_LEN 6
190struct addr_rfc986 {
191 u_char a986_idi[ADDRRFC986_IDI_LEN]; /* initial domain identifier */
192 u_char a986_dsp[ADDRRFC986_DSP_LEN]; /* domain specific part */
193};
194
195#define OVLRFC986_INET_LEN 4
196struct ovl_rfc986 {
197 u_char o986_afi; /* afi */
198 u_char o986_idi[ADDRRFC986_IDI_LEN]; /* idi */
199 u_char o986_vers; /* version */
200 u_char o986_inetaddr[OVLRFC986_INET_LEN]; /* internet address */
201 u_char o986_upid; /* upper protocol id */
202};
203#define RFC986V1 0x01 /* version of 986 addr */
204
205#define AFI_37 0x37 /* bcd of "37" */
206#define AFI_OSINET 0x47 /* bcd of "47" */
207#define AFI_RFC986 0x47 /* bcd of "47" */
208#define AFI_SNA 0x00 /* SubNetwork Address; invalid really...
209 - used by ES-IS */
210
211/* the idi for type 37 addresses is very different than the others */
212#define IDI_OSINET 0x0004 /* bcd of "0004" */
213#define IDI_RFC986 0x0006 /* bcd of "0006" */
214
215/*
216 * This address type is used to store a subnetwork address in a
217 * sockaddr_iso. The isoa_len field should contain the length of the
218 * subnetwork address plus the length of the afi (ie +1 ).
219 *
220 * This address format is used only by the ES-IS protocol
221 */
222#define ADDRSNA_IDI_LEN 7
223struct addr_sn {
224 char sna_addr[ADDRSNA_IDI_LEN]; /* subnetwork address */
225};
226
227/*
228 * Type 47 is the biggest address: 11 bytes. The length of iso_addr
229 * is 13 bytes.
230 */
231struct iso_addr {
232 u_char isoa_afi; /* authority and format id */
233 union {
234 struct addr_37 addr_37; /* type 37 */
235 struct addr_osinet addr_osinet; /* type osinet */
236 struct addr_rfc986 addr_rfc986; /* type rfc986 */
237 struct addr_sn addr_sn; /* subnetwork address */
238 } isoa_u;
239 u_char isoa_len; /* length (in bytes) */
240};
241
242#define t37_idi isoa_u.addr_37.a37_idi
243#define t37_dsp isoa_u.addr_37.a37_dsp
244#define osinet_idi isoa_u.addr_osinet.aosi_idi
245#define osinet_dsp isoa_u.addr_osinet.aosi_dsp
246#define rfc986_idi isoa_u.addr_rfc986.a986_idi
247#define rfc986_dsp isoa_u.addr_rfc986.a986_dsp
248#define sna_idi isoa_u.addr_sn.sna_addr
249
250/*
251 * An iso_addr is 18 bytes, a sockaddr_iso is therefore 20 bytes.
252 * the struct sockaddr data field has been changed to 22 bytes.
253 *
254 * severly changed osinet and t37 addresses from argo code, we don't want
255 * sockaddrs to grow bigger than the original 16 bytes so we changed the
256 * t37 and osinet addresses so that they were only 10 bytes long
257 */
258struct sockaddr_iso {
259 u_short siso_family; /* family */
260 u_short siso_tsuffix; /* transport suffix */
261 struct iso_addr siso_addr; /* network address */
262};
263
264#define NSAPTYPE_UNKNOWN -1
265#define NSAPTYPE_INET 0
266#define NSAPTYPE_X121BCD 1
267#define NSAPTYPE_X121BIN 2
268#define NSAPTYPE_DCCBCD 3
269#define NSAPTYPE_DCCBIN 4
270#define NSAPTYPE_OSINET 5
271#define NSAPTYPE_RFC986 6
272
273#ifdef KERNEL
274
275extern int iso_netmatch();
276extern int iso_hash();
277extern int iso_addrmatch();
278extern struct iso_ifaddr *iso_iaonnetof();
279extern struct domain isodomain;
280extern struct protosw isosw[];
281
282#else
283/* user utilities definitions from the iso library */
284
285char *iso_ntoa();
286struct hostent *iso_gethostbyname(), *iso_gethostbyaddr();
287
288#endif KERNEL
289
290#endif __ISO__