add POSIX-style byte-level record locking
[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 $ */
d12b96b5 29/* @(#)iso.h 7.4 (Berkeley) %G% */
72a0a0dc
KS
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 */
d12b96b5 58#define ISOPROTO_INTRAISIS 35 /* IS-IS protocol */
72a0a0dc
KS
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
d12b96b5 89#define ISO10589_ISIS 0x83
72a0a0dc 90
44f52ea5 91
72a0a0dc
KS
92#ifndef IN_CLASSA_NET
93#include "../netinet/in.h"
94#endif IN_CLASSA_NET
95
72a0a0dc 96
72a0a0dc 97
a50e2bc0 98/* The following looks like a sockaddr
44f52ea5 99 * to facilitate using tree lookup routines */
a50e2bc0
KS
100struct iso_addr {
101 u_char isoa_len; /* length (in bytes) */
102 char isoa_genaddr[20]; /* general opaque address */
103};
104
72a0a0dc 105struct sockaddr_iso {
a50e2bc0
KS
106 u_char siso_len; /* length */
107 u_char siso_family; /* family */
44f52ea5
KS
108 u_char siso_plen; /* presentation selector length */
109 u_char siso_slen; /* session selector length */
110 u_char siso_tlen; /* transport selector length */
72a0a0dc 111 struct iso_addr siso_addr; /* network address */
44f52ea5
KS
112 u_char siso_pad[6]; /* space for gosip v2 sels */
113 /* makes struct 32 bytes long */
72a0a0dc 114};
a50e2bc0 115#define siso_nlen siso_addr.isoa_len
44f52ea5
KS
116#define siso_data siso_addr.isoa_genaddr
117
a50e2bc0
KS
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)
44f52ea5
KS
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...*/
72a0a0dc
KS
130
131#ifdef KERNEL
132
133extern int iso_netmatch();
134extern int iso_hash();
135extern int iso_addrmatch();
136extern struct iso_ifaddr *iso_iaonnetof();
137extern struct domain isodomain;
138extern struct protosw isosw[];
139
140#else
141/* user utilities definitions from the iso library */
142
143char *iso_ntoa();
144struct hostent *iso_gethostbyname(), *iso_gethostbyaddr();
145
146#endif KERNEL
147
a50e2bc0 148#define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m))
44f52ea5 149#endif __ISO__