must have directory vnode as first op
[unix-history] / usr / src / sys / netiso / tp_tpdu.h
CommitLineData
7bcd1bb8
KB
1/*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 *
7 * @(#)tp_tpdu.h 7.4 (Berkeley) %G%
8 */
9
1c490f1b
KS
10/***********************************************************
11 Copyright IBM Corporation 1987
12
13 All Rights Reserved
14
15Permission to use, copy, modify, and distribute this software and its
16documentation for any purpose and without fee is hereby granted,
17provided that the above copyright notice appear in all copies and that
18both that copyright notice and this permission notice appear in
19supporting documentation, and that the name of IBM not be
20used in advertising or publicity pertaining to distribution of the
21software without specific, written prior permission.
22
23IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
24ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
25IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
26ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
27WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
28ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
29SOFTWARE.
30
31******************************************************************/
32
33/*
34 * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
35 */
36/*
37 * ARGO TP
38 *
39 * $Header: tp_tpdu.h,v 4.4 88/07/26 16:45:40 nhall Exp $
40 * $Source: /usr/argo/sys/netiso/RCS/tp_tpdu.h,v $
41 *
42 * This ghastly set of macros makes it possible to
43 * refer to tpdu structures without going mad.
44 */
45
46#ifndef __TP_TPDU__
47#define __TP_TPDU__
48
49#ifndef BYTE_ORDER
50/*
51 * Definitions for byte order,
52 * according to byte significance from low address to high.
53 */
54#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */
55#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
56#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */
57
58#ifdef vax
59#define BYTE_ORDER LITTLE_ENDIAN
60#else
61#define BYTE_ORDER BIG_ENDIAN /* mc68000, tahoe, most others */
62#endif
63#endif BYTE_ORDER
64
65/* This much of a tpdu is the same for all types of tpdus (except
66 * DT tpdus in class 0; their exceptions are handled by the data
67 * structure below
68 */
69struct tpdu_fixed {
a50e2bc0 70 u_char _tpduf_li:8, /* length indicator */
1c490f1b
KS
71#if BYTE_ORDER == LITTLE_ENDIAN
72 _tpduf_cdt: 4, /* credit */
a50e2bc0 73 _tpduf_type: 4; /* type of tpdu (DT, CR, etc.) */
1c490f1b
KS
74#endif
75#if BYTE_ORDER == BIG_ENDIAN
76 _tpduf_type: 4, /* type of tpdu (DT, CR, etc.) */
a50e2bc0 77 _tpduf_cdt: 4; /* credit */
1c490f1b 78#endif
a50e2bc0 79 u_short _tpduf_dref; /* destination ref; not in DT in class 0 */
1c490f1b
KS
80};
81
82#define tpdu_li _tpduf._tpduf_li
83#define tpdu_type _tpduf._tpduf_type
84#define tpdu_cdt _tpduf._tpduf_cdt
85#define tpdu_dref _tpduf._tpduf_dref
86
87struct tp0du {
a50e2bc0
KS
88 u_char _tp0_li,
89 _tp0_cdt_type, /* same as in tpdu_fixed */
1c490f1b
KS
90#if BYTE_ORDER == BIG_ENDIAN
91 _tp0_eot: 1, /* eot */
92 _tp0_mbz: 7, /* must be zero */
93#endif
94#if BYTE_ORDER == LITTLE_ENDIAN
95 _tp0_mbz: 7, /* must be zero */
96 _tp0_eot: 1, /* eot */
97#endif
98 _tp0_notused: 8; /* data begins on this octet */
99};
100
101#define tp0du_eot _tp0_eot
102#define tp0du_mbz _tp0_mbz
103
104/*
105 * This is used when the extended format seqence numbers are
106 * being sent and received.
107 */
108 /*
109 * the seqeot field is an int that overlays the seq
110 * and eot fields, this allows the htonl operation
111 * to be applied to the entire 32 bit quantity, and
112 * simplifies the structure definitions.
113 */
114union seq_type {
115 struct {
116#if BYTE_ORDER == BIG_ENDIAN
117 unsigned int st_eot:1, /* end-of-tsdu */
118 st_seq:31; /* 31 bit sequence number */
119#endif
120#if BYTE_ORDER == LITTLE_ENDIAN
121 unsigned int st_seq:31, /* 31 bit sequence number */
122 st_eot:1; /* end-of-tsdu */
123#endif
124 } st;
125 unsigned int s_seqeot;
126#define s_eot st.st_eot
127#define s_seq st.st_seq
128};
129
130/* Then most tpdu types have a portion that is always present but
131 * differs among the tpdu types :
132 */
133union tpdu_fixed_rest {
134
135 struct {
a50e2bc0 136 u_short _tpdufr_sref, /* source reference */
1c490f1b
KS
137#if BYTE_ORDER == BIG_ENDIAN
138 _tpdufr_class: 4, /* class [ ISO 8073 13.3.3.e ] */
139 _tpdufr_opt: 4, /* options [ ISO 8073 13.3.3.e ] */
140#endif
141#if BYTE_ORDER == LITTLE_ENDIAN
142 _tpdufr_opt: 4, /* options [ ISO 8073 13.3.3.e ] */
143 _tpdufr_class: 4, /* class [ ISO 8073 13.3.3.e ] */
144#endif
145 _tpdufr_xx: 8; /* unused */
146 } CRCC;
147
148#define tpdu_CRli _tpduf._tpduf_li
149#define tpdu_CRtype _tpduf._tpduf_type
150#define tpdu_CRcdt _tpduf._tpduf_cdt
151#define tpdu_CRdref_0 _tpduf._tpduf_dref
152#define tpdu_CRsref _tpdufr.CRCC._tpdufr_sref
153#define tpdu_sref _tpdufr.CRCC._tpdufr_sref
154#define tpdu_CRclass _tpdufr.CRCC._tpdufr_class
155#define tpdu_CRoptions _tpdufr.CRCC._tpdufr_opt
156
157#define tpdu_CCli _tpduf._tpduf_li
158#define tpdu_CCtype _tpduf._tpduf_type
159#define tpdu_CCcdt _tpduf._tpduf_cdt
160#define tpdu_CCdref _tpduf._tpduf_dref
161#define tpdu_CCsref _tpdufr.CRCC._tpdufr_sref
162#define tpdu_CCclass _tpdufr.CRCC._tpdufr_class
163#define tpdu_CCoptions _tpdufr.CRCC._tpdufr_opt
164
165/* OPTIONS and ADDL OPTIONS bits */
166#define TPO_USE_EFC 0x1
167#define TPO_XTD_FMT 0x2
168#define TPAO_USE_TXPD 0x1
169#define TPAO_NO_CSUM 0x2
170#define TPAO_USE_RCC 0x4
171#define TPAO_USE_NXPD 0x8
172
173 struct {
174 unsigned short _tpdufr_sref; /* source reference */
175 unsigned char _tpdufr_reason; /* [ ISO 8073 13.5.3.d ] */
176 } DR;
177#define tpdu_DRli _tpduf._tpduf_li
178#define tpdu_DRtype _tpduf._tpduf_type
179#define tpdu_DRdref _tpduf._tpduf_dref
180#define tpdu_DRsref _tpdufr.DR._tpdufr_sref
181#define tpdu_DRreason _tpdufr.DR._tpdufr_reason
182
183 unsigned short _tpdufr_sref; /* source reference */
184
185#define tpdu_DCli _tpduf._tpduf_li
186#define tpdu_DCtype _tpduf._tpduf_type
187#define tpdu_DCdref _tpduf._tpduf_dref
188#define tpdu_DCsref _tpdufr._tpdufr_sref
189
190 struct {
191#if BYTE_ORDER == BIG_ENDIAN
192 unsigned char _tpdufr_eot:1, /* end-of-tsdu */
193 _tpdufr_seq:7; /* 7 bit sequence number */
194#endif
195#if BYTE_ORDER == LITTLE_ENDIAN
196 unsigned char _tpdufr_seq:7, /* 7 bit sequence number */
197 _tpdufr_eot:1; /* end-of-tsdu */
198#endif
199 }SEQEOT;
200 struct {
201#if BYTE_ORDER == BIG_ENDIAN
202 unsigned int _tpdufr_Xeot:1, /* end-of-tsdu */
203 _tpdufr_Xseq:31; /* 31 bit sequence number */
204#endif
205#if BYTE_ORDER == LITTLE_ENDIAN
206 unsigned int _tpdufr_Xseq:31, /* 31 bit sequence number */
207 _tpdufr_Xeot:1; /* end-of-tsdu */
208#endif
209 }SEQEOT31;
210 unsigned int _tpdufr_Xseqeot;
211#define tpdu_seqeotX _tpdufr._tpdufr_Xseqeot
212
213#define tpdu_DTli _tpduf._tpduf_li
214#define tpdu_DTtype _tpduf._tpduf_type
215#define tpdu_DTdref _tpduf._tpduf_dref
216#define tpdu_DTseq _tpdufr.SEQEOT._tpdufr_seq
217#define tpdu_DTeot _tpdufr.SEQEOT._tpdufr_eot
218#define tpdu_DTseqX _tpdufr.SEQEOT31._tpdufr_Xseq
219#define tpdu_DTeotX _tpdufr.SEQEOT31._tpdufr_Xeot
220
221#define tpdu_XPDli _tpduf._tpduf_li
222#define tpdu_XPDtype _tpduf._tpduf_type
223#define tpdu_XPDdref _tpduf._tpduf_dref
224#define tpdu_XPDseq _tpdufr.SEQEOT._tpdufr_seq
225#define tpdu_XPDeot _tpdufr.SEQEOT._tpdufr_eot
226#define tpdu_XPDseqX _tpdufr.SEQEOT31._tpdufr_Xseq
227#define tpdu_XPDeotX _tpdufr.SEQEOT31._tpdufr_Xeot
228
229 struct {
230#if BYTE_ORDER == BIG_ENDIAN
231 unsigned _tpdufr_yrseq0:1, /* always zero */
232 _tpdufr_yrseq:31; /* [ ISO 8073 13.9.3.d ] */
233#endif
234#if BYTE_ORDER == LITTLE_ENDIAN
235 unsigned _tpdufr_yrseq:31, /* [ ISO 8073 13.9.3.d ] */
236 _tpdufr_yrseq0:1; /* always zero */
237#endif
238 unsigned short _tpdufr_cdt; /* [ ISO 8073 13.9.3.b ] */
239 } AK31;
240
241#define tpdu_AKli _tpduf._tpduf_li
242#define tpdu_AKtype _tpduf._tpduf_type
243#define tpdu_AKdref _tpduf._tpduf_dref
244#define tpdu_AKseq _tpdufr.SEQEOT._tpdufr_seq
245#define tpdu_AKseqX _tpdufr.AK31._tpdufr_yrseq
246/* location of cdt depends on size of seq. numbers */
247#define tpdu_AKcdt _tpduf._tpduf_cdt
248#define tpdu_AKcdtX _tpdufr.AK31._tpdufr_cdt
249
250#define tpdu_XAKli _tpduf._tpduf_li
251#define tpdu_XAKtype _tpduf._tpduf_type
252#define tpdu_XAKdref _tpduf._tpduf_dref
253#define tpdu_XAKseq _tpdufr.SEQEOT._tpdufr_seq
254#define tpdu_XAKseqX _tpdufr.SEQEOT31._tpdufr_Xseq
255
256 unsigned char _tpdu_ERreason; /* [ ISO 8073 13.12.3.c ] */
257
258#define tpdu_ERli _tpduf._tpduf_li
259#define tpdu_ERtype _tpduf._tpduf_type
260#define tpdu_ERdref _tpduf._tpduf_dref
261#define tpdu_ERreason _tpdufr._tpdu_ERreason
262
263};
264
265struct tpdu {
266 struct tpdu_fixed _tpduf;
267 union tpdu_fixed_rest _tpdufr;
268};
269
270#endif __TP_TPDU__