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