FreeBSD/Linux Kernel Cross Reference
sys/netiso/iso.h
1 /* $NetBSD: iso.h,v 1.14 2003/08/07 16:33:36 agc 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 * @(#)iso.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 #ifndef _NETISO_ISO_H_
62 #define _NETISO_ISO_H_
63
64 #include <sys/ansi.h>
65
66 #ifndef sa_family_t
67 typedef __sa_family_t sa_family_t;
68 #define sa_family_t __sa_family_t
69 #endif
70
71 /*
72 * Return true if this is a multicast address
73 * This assumes that the bit transmission is lsb first. This
74 * assumption is valid for 802.3 but not 802.5. There is a
75 * kludge to get around this for 802.5 -- see if_lan.c
76 * where subnetwork header is setup.
77 */
78 #define IS_MULTICAST(snpa)\
79 ((snpa)[0] & 0x01)
80
81 /*
82 * Protocols
83 */
84 #define ISOPROTO_TCP 6 /* IETF experiment */
85 #define ISOPROTO_UDP 17 /* IETF experiment */
86 #define ISOPROTO_TP0 25 /* connection oriented transport protocol */
87 #define ISOPROTO_TP1 26 /* not implemented */
88 #define ISOPROTO_TP2 27 /* not implemented */
89 #define ISOPROTO_TP3 28 /* not implemented */
90 #define ISOPROTO_TP4 29 /* connection oriented transport protocol */
91 #define ISOPROTO_TP ISOPROTO_TP4 /* tp-4 with negotiation */
92 #define ISOPROTO_CLTP 30 /* connectionless transport (not yet impl.) */
93 #define ISOPROTO_CLNP 31 /* connectionless internetworking protocol */
94 #define ISOPROTO_X25 32 /* cons */
95 #define ISOPROTO_INACT_NL 33 /* inactive network layer! */
96 #define ISOPROTO_ESIS 34 /* ES-IS protocol */
97 #define ISOPROTO_INTRAISIS 35 /* IS-IS protocol */
98 #define ISOPROTO_IDRP 36 /* Interdomain Routing Protocol */
99
100 #define ISOPROTO_RAW 255 /* raw clnp */
101 #define ISOPROTO_MAX 256
102
103 #define ISO_PORT_RESERVED 1024
104 #define ISO_PORT_USERRESERVED 5000
105 /*
106 * Port/socket numbers: standard network functions
107 * NOT PRESENTLY USED
108 */
109 #define ISO_PORT_MAINT 501
110 #define ISO_PORT_ECHO 507
111 #define ISO_PORT_DISCARD 509
112 #define ISO_PORT_SYSTAT 511
113 #define ISO_PORT_NETSTAT 515
114 /*
115 * Port/socket numbers: non-standard application functions
116 */
117 #define ISO_PORT_LOGIN 513
118 /*
119 * Port/socket numbers: public use
120 */
121 #define ISO_PORT_PUBLIC 1024 /* high bit set --> public */
122
123 /*
124 * Network layer protocol identifiers
125 */
126 #define ISO8473_CLNP 0x81
127 #define ISO9542_ESIS 0x82
128 #define ISO9542X25_ESIS 0x8a
129 #define ISO10589_ISIS 0x83
130 #define ISO8878A_CONS 0x84
131 #define ISO10747_IDRP 0x85
132
133
134 #ifndef IN_CLASSA_NET
135 #include <netinet/in.h>
136 #endif /* IN_CLASSA_NET */
137
138
139
140 /*
141 * The following looks like a sockaddr to facilitate using tree lookup
142 * routines
143 */
144 struct iso_addr {
145 u_char isoa_len; /* length (in bytes) */
146 char isoa_genaddr[20]; /* general opaque address */
147 };
148
149 struct sockaddr_iso {
150 u_char siso_len; /* length */
151 sa_family_t siso_family; /* family */
152 u_char siso_plen; /* presentation selector length */
153 u_char siso_slen; /* session selector length */
154 u_char siso_tlen; /* transport selector length */
155 struct iso_addr siso_addr; /* network address */
156 u_char siso_pad[6]; /* space for gosip v2 sels */
157 /* makes struct 32 bytes long */
158 };
159 #define siso_nlen siso_addr.isoa_len
160 #define siso_data siso_addr.isoa_genaddr
161
162 #define TSEL(s) ((caddr_t)((s)->siso_data + (s)->siso_nlen))
163
164 #define SAME_ISOADDR(a, b) \
165 (bcmp((a)->siso_data, (b)->siso_data, (unsigned)(a)->siso_nlen)==0)
166 #define SAME_ISOIFADDR(a, b) (bcmp((a)->siso_data, (b)->siso_data, \
167 (unsigned)((b)->siso_nlen - (b)->siso_tlen)) == 0)
168 /*
169 * The following are specific values for siso->siso_data[0],
170 * otherwise known as the AFI:
171 */
172 #define AFI_37 0x37 /* bcd of "37" */
173 #define AFI_OSINET 0x47 /* bcd of "47" */
174 #define AFI_RFC986 0x47 /* bcd of "47" */
175 #define AFI_SNA 0x00 /* SubNetwork Address; invalid really... */
176
177 #ifdef _KERNEL
178
179 extern struct domain isodomain;
180 extern struct protosw isosw[];
181
182 #define satosiso(sa) ((struct sockaddr_iso *)(sa))
183 #define sisotosa(siso) ((struct sockaddr *)(siso))
184
185 #else
186 /* user utilities definitions from the iso library */
187
188 #include <sys/cdefs.h>
189
190 __BEGIN_DECLS
191 struct iso_addr *iso_addr __P((const char *));
192 char *iso_ntoa __P((const struct iso_addr *));
193
194 /* THESE DON'T EXIST YET */
195 struct hostent *iso_gethostbyname __P((const char *));
196 struct hostent *iso_gethostbyaddr __P((const char *, int, int));
197 __END_DECLS
198
199 #endif /* _KERNEL */
200
201 #endif /* _NETISO_ISO_H_ */
Cache object: bb20a4cbcfaedfe847ec99a85d9ab3a0
|