xref: /original-bsd/sys/netiso/iso.h (revision deff14a8)
1 /*-
2  * Copyright (c) 1991, 1993, 1994
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)iso.h	8.2 (Berkeley) 06/30/94
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 /* $Header: iso.h,v 4.9 88/09/11 18:06:38 hagens Exp $ */
37 /* $Source: /usr/argo/sys/netiso/RCS/iso.h,v $ */
38 
39 #ifndef __ISO__
40 #define __ISO__
41 
42 /*
43  *	Return true if this is a multicast address
44  *	This assumes that the bit transmission is lsb first. This
45  *	assumption is valid for 802.3 but not 802.5. There is a
46  *	kludge to get around this for 802.5 -- see if_lan.c
47  *	where subnetwork header is setup.
48  */
49 #define	IS_MULTICAST(snpa)\
50 	((snpa)[0] & 0x01)
51 
52 /*
53  * Protocols
54  */
55 #define	ISOPROTO_TCP	6		/* IETF experiment */
56 #define	ISOPROTO_UDP	17		/* IETF experiment */
57 #define	ISOPROTO_TP0	25		/* connection oriented transport protocol */
58 #define	ISOPROTO_TP1	26		/* not implemented */
59 #define	ISOPROTO_TP2	27		/* not implemented */
60 #define	ISOPROTO_TP3	28		/* not implemented */
61 #define	ISOPROTO_TP4	29		/* connection oriented transport protocol */
62 #define	ISOPROTO_TP		ISOPROTO_TP4	 /* tp-4 with negotiation */
63 #define	ISOPROTO_CLTP	30		/* connectionless transport (not yet impl.) */
64 #define	ISOPROTO_CLNP	31		/* connectionless internetworking protocol */
65 #define	ISOPROTO_X25	32		/* cons */
66 #define	ISOPROTO_INACT_NL	33	/* inactive network layer! */
67 #define	ISOPROTO_ESIS	34		/* ES-IS protocol */
68 #define	ISOPROTO_INTRAISIS	35		/* IS-IS protocol */
69 #define	ISOPROTO_IDRP	36		/* Interdomain Routing Protocol */
70 
71 #define	ISOPROTO_RAW	255		/* raw clnp */
72 #define	ISOPROTO_MAX	256
73 
74 #define	ISO_PORT_RESERVED		1024
75 #define	ISO_PORT_USERRESERVED	5000
76 /*
77  * Port/socket numbers: standard network functions
78  * NOT PRESENTLY USED
79  */
80 #define	ISO_PORT_MAINT		501
81 #define	ISO_PORT_ECHO		507
82 #define	ISO_PORT_DISCARD	509
83 #define	ISO_PORT_SYSTAT		511
84 #define	ISO_PORT_NETSTAT	515
85 /*
86  * Port/socket numbers: non-standard application functions
87  */
88 #define ISO_PORT_LOGIN		513
89 /*
90  * Port/socket numbers: public use
91  */
92 #define ISO_PORT_PUBLIC		1024		/* high bit set --> public */
93 
94 /*
95  *	Network layer protocol identifiers
96  */
97 #define ISO8473_CLNP	0x81
98 #define	ISO9542_ESIS	0x82
99 #define ISO9542X25_ESIS	0x8a
100 #define ISO10589_ISIS		0x83
101 #define ISO8878A_CONS		0x84
102 #define ISO10747_IDRP		0x85
103 
104 
105 #ifndef IN_CLASSA_NET
106 #include <netinet/in.h>
107 #endif /* IN_CLASSA_NET */
108 
109 
110 
111 /* The following looks like a sockaddr
112  * to facilitate using tree lookup routines */
113 struct iso_addr {
114 	u_char	isoa_len;						/* length (in bytes) */
115 	char	isoa_genaddr[20];				/* general opaque address */
116 };
117 
118 struct sockaddr_iso {
119 	u_char	 			siso_len;			/* length */
120 	u_char	 			siso_family;		/* family */
121 	u_char				siso_plen;			/* presentation selector length */
122 	u_char				siso_slen;			/* session selector length */
123 	u_char				siso_tlen;			/* transport selector length */
124 	struct 	iso_addr	siso_addr;			/* network address */
125 	u_char				siso_pad[6];		/* space for gosip v2 sels */
126 											/* makes struct 32 bytes long */
127 };
128 #define siso_nlen siso_addr.isoa_len
129 #define siso_data siso_addr.isoa_genaddr
130 
131 #define TSEL(s) ((caddr_t)((s)->siso_data + (s)->siso_nlen))
132 
133 #define SAME_ISOADDR(a, b) \
134 	(bcmp((a)->siso_data, (b)->siso_data, (unsigned)(a)->siso_nlen) == 0)
135 #define SAME_ISOIFADDR(a, b)  (bcmp((a)->siso_data, (b)->siso_data, \
136 	(unsigned)((b)->siso_nlen - (b)->siso_tlen)) == 0)
137 /*
138  * The following are specific values for siso->siso_data[0],
139  * otherwise known as the AFI:
140  */
141 #define	AFI_37		0x37	/* bcd of "37" */
142 #define AFI_OSINET	0x47	/* bcd of "47" */
143 #define AFI_RFC986	0x47	/* bcd of "47" */
144 #define	AFI_SNA		0x00	/* SubNetwork Address; invalid really...*/
145 
146 #ifdef KERNEL
147 
148 extern int iso_netmatch();
149 extern int iso_hash();
150 extern int iso_addrmatch();
151 extern struct iso_ifaddr *iso_iaonnetof();
152 extern	struct domain isodomain;
153 extern	struct protosw isosw[];
154 
155 #else
156 /* user utilities definitions from the iso library */
157 
158 #include <sys/cdefs.h>
159 
160 __BEGIN_DECLS
161 struct iso_addr *iso_addr __P((const char *));
162 char *iso_ntoa __P((const struct iso_addr *));
163 
164 /* THESE DON'T EXIST YET */
165 struct hostent *iso_gethostbyname(), *iso_gethostbyaddr();
166 __END_DECLS
167 
168 #endif /* KERNEL */
169 
170 #define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m))
171 #endif /* __ISO__ */
172