xref: /original-bsd/sys/netiso/iso.h (revision c6d5c0d7)
1 /***********************************************************
2 		Copyright IBM Corporation 1987
3 
4                       All Rights Reserved
5 
6 Permission to use, copy, modify, and distribute this software and its
7 documentation for any purpose and without fee is hereby granted,
8 provided that the above copyright notice appear in all copies and that
9 both that copyright notice and this permission notice appear in
10 supporting documentation, and that the name of IBM not be
11 used in advertising or publicity pertaining to distribution of the
12 software without specific, written prior permission.
13 
14 IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16 IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20 SOFTWARE.
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 /*	@(#)iso.h	7.5 (Berkeley) 02/22/91 */
30 
31 #ifndef __ISO__
32 #define __ISO__
33 
34 /*
35  *	Return true if this is a multicast address
36  *	This assumes that the bit transmission is lsb first. This
37  *	assumption is valid for 802.3 but not 802.5. There is a
38  *	kludge to get around this for 802.5 -- see if_lan.c
39  *	where subnetwork header is setup.
40  */
41 #define	IS_MULTICAST(snpa)\
42 	((snpa)[0] & 0x01)
43 
44 /*
45  * Protocols
46  */
47 #define	ISOPROTO_TP0	25		/* connection oriented transport protocol */
48 #define	ISOPROTO_TP1	26		/* not implemented */
49 #define	ISOPROTO_TP2	27		/* not implemented */
50 #define	ISOPROTO_TP3	28		/* not implemented */
51 #define	ISOPROTO_TP4	29		/* connection oriented transport protocol */
52 #define	ISOPROTO_TP		ISOPROTO_TP4	 /* tp-4 with negotiation */
53 #define	ISOPROTO_CLTP	30		/* connectionless transport (not yet impl.) */
54 #define	ISOPROTO_CLNP	31		/* connectionless internetworking protocol */
55 #define	ISOPROTO_X25	32		/* cons */
56 #define	ISOPROTO_INACT_NL	33	/* inactive network layer! */
57 #define	ISOPROTO_ESIS	34		/* ES-IS protocol */
58 #define	ISOPROTO_INTRAISIS	35		/* IS-IS protocol */
59 
60 #define	ISOPROTO_RAW	255		/* raw clnp */
61 #define	ISOPROTO_MAX	256
62 
63 #define	ISO_PORT_RESERVED		1024
64 #define	ISO_PORT_USERRESERVED	5000
65 /*
66  * Port/socket numbers: standard network functions
67  * NOT PRESENTLY USED
68  */
69 #define	ISO_PORT_MAINT		501
70 #define	ISO_PORT_ECHO		507
71 #define	ISO_PORT_DISCARD	509
72 #define	ISO_PORT_SYSTAT		511
73 #define	ISO_PORT_NETSTAT	515
74 /*
75  * Port/socket numbers: non-standard application functions
76  */
77 #define ISO_PORT_LOGIN		513
78 /*
79  * Port/socket numbers: public use
80  */
81 #define ISO_PORT_PUBLIC		1024		/* high bit set --> public */
82 
83 /*
84  *	Network layer protocol identifiers
85  */
86 #define ISO8473_CLNP	0x81
87 #define	ISO9542_ESIS	0x82
88 #define ISO9542X25_ESIS	0x8a
89 #define ISO10589_ISIS		0x83
90 
91 
92 #ifndef IN_CLASSA_NET
93 #include "../netinet/in.h"
94 #endif IN_CLASSA_NET
95 
96 
97 
98 /* The following looks like a sockaddr
99  * to facilitate using tree lookup routines */
100 struct iso_addr {
101 	u_char	isoa_len;						/* length (in bytes) */
102 	char	isoa_genaddr[20];				/* general opaque address */
103 };
104 
105 struct sockaddr_iso {
106 	u_char	 			siso_len;			/* length */
107 	u_char	 			siso_family;		/* family */
108 	u_char				siso_plen;			/* presentation selector length */
109 	u_char				siso_slen;			/* session selector length */
110 	u_char				siso_tlen;			/* transport selector length */
111 	struct 	iso_addr	siso_addr;			/* network address */
112 	u_char				siso_pad[6];		/* space for gosip v2 sels */
113 											/* makes struct 32 bytes long */
114 };
115 #define siso_nlen siso_addr.isoa_len
116 #define siso_data siso_addr.isoa_genaddr
117 
118 #define TSEL(s) ((caddr_t)((s)->siso_data + (s)->siso_nlen))
119 
120 #define SAME_ISOADDR(a, b) \
121 	(bcmp((a)->siso_data, (b)->siso_data, (unsigned)(a)->siso_nlen)==0)
122 /*
123  * The following are specific values for siso->siso_data[0],
124  * otherwise known as the AFI:
125  */
126 #define	AFI_37		0x37	/* bcd of "37" */
127 #define AFI_OSINET	0x47	/* bcd of "47" */
128 #define AFI_RFC986	0x47	/* bcd of "47" */
129 #define	AFI_SNA		0x00	/* SubNetwork Address; invalid really...*/
130 
131 #ifdef KERNEL
132 
133 extern int iso_netmatch();
134 extern int iso_hash();
135 extern int iso_addrmatch();
136 extern struct iso_ifaddr *iso_iaonnetof();
137 extern	struct domain isodomain;
138 extern	struct protosw isosw[];
139 
140 #else
141 /* user utilities definitions from the iso library */
142 
143 #include <sys/cdefs.h>
144 
145 __BEGIN_DECLS
146 struct iso_addr *iso_addr __P((const char *));
147 char *iso_ntoa __P((const struct iso_addr *));
148 
149 /* THESE DON'T EXIST YET */
150 struct hostent *iso_gethostbyname(), *iso_gethostbyaddr();
151 __END_DECLS
152 
153 #endif /* KERNEL */
154 
155 #define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m))
156 #endif __ISO__
157