xref: /original-bsd/sys/netiso/iso.h (revision 04ace372)
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.3 (Berkeley) 08/29/89 */
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 
59 #define	ISOPROTO_RAW	255		/* raw clnp */
60 #define	ISOPROTO_MAX	256
61 
62 #define	ISO_PORT_RESERVED		1024
63 #define	ISO_PORT_USERRESERVED	5000
64 /*
65  * Port/socket numbers: standard network functions
66  * NOT PRESENTLY USED
67  */
68 #define	ISO_PORT_MAINT		501
69 #define	ISO_PORT_ECHO		507
70 #define	ISO_PORT_DISCARD	509
71 #define	ISO_PORT_SYSTAT		511
72 #define	ISO_PORT_NETSTAT	515
73 /*
74  * Port/socket numbers: non-standard application functions
75  */
76 #define ISO_PORT_LOGIN		513
77 /*
78  * Port/socket numbers: public use
79  */
80 #define ISO_PORT_PUBLIC		1024		/* high bit set --> public */
81 
82 /*
83  *	Network layer protocol identifiers
84  */
85 #define ISO8473_CLNP	0x81
86 #define	ISO9542_ESIS	0x82
87 #define ISO9542X25_ESIS	0x8a
88 
89 
90 #ifndef IN_CLASSA_NET
91 #include "../netinet/in.h"
92 #endif IN_CLASSA_NET
93 
94 
95 
96 /* The following looks like a sockaddr
97  * to facilitate using tree lookup routines */
98 struct iso_addr {
99 	u_char	isoa_len;						/* length (in bytes) */
100 	char	isoa_genaddr[20];				/* general opaque address */
101 };
102 
103 struct sockaddr_iso {
104 	u_char	 			siso_len;			/* length */
105 	u_char	 			siso_family;		/* family */
106 	u_char				siso_plen;			/* presentation selector length */
107 	u_char				siso_slen;			/* session selector length */
108 	u_char				siso_tlen;			/* transport selector length */
109 	struct 	iso_addr	siso_addr;			/* network address */
110 	u_char				siso_pad[6];		/* space for gosip v2 sels */
111 											/* makes struct 32 bytes long */
112 };
113 #define siso_nlen siso_addr.isoa_len
114 #define siso_data siso_addr.isoa_genaddr
115 
116 #define TSEL(s) ((caddr_t)((s)->siso_data + (s)->siso_nlen))
117 
118 #define SAME_ISOADDR(a, b) \
119 	(bcmp((a)->siso_data, (b)->siso_data, (unsigned)(a)->siso_nlen)==0)
120 /*
121  * The following are specific values for siso->siso_data[0],
122  * otherwise known as the AFI:
123  */
124 #define	AFI_37		0x37	/* bcd of "37" */
125 #define AFI_OSINET	0x47	/* bcd of "47" */
126 #define AFI_RFC986	0x47	/* bcd of "47" */
127 #define	AFI_SNA		0x00	/* SubNetwork Address; invalid really...*/
128 
129 #ifdef KERNEL
130 
131 extern int iso_netmatch();
132 extern int iso_hash();
133 extern int iso_addrmatch();
134 extern struct iso_ifaddr *iso_iaonnetof();
135 extern	struct domain isodomain;
136 extern	struct protosw isosw[];
137 
138 #else
139 /* user utilities definitions from the iso library */
140 
141 char *iso_ntoa();
142 struct hostent *iso_gethostbyname(), *iso_gethostbyaddr();
143 
144 #endif KERNEL
145 
146 #define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m))
147 #endif __ISO__
148