]>
git.saurik.com Git - apple/xnu.git/blob - bsd/netiso/tp_tpdu.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1991, 1993
24 * The Regents of the University of California. All rights reserved.
26 * Redistribution and use in source and binary forms, with or without
27 * modification, are permitted provided that the following conditions
29 * 1. Redistributions of source code must retain the above copyright
30 * notice, this list of conditions and the following disclaimer.
31 * 2. Redistributions in binary form must reproduce the above copyright
32 * notice, this list of conditions and the following disclaimer in the
33 * documentation and/or other materials provided with the distribution.
34 * 3. All advertising materials mentioning features or use of this software
35 * must display the following acknowledgement:
36 * This product includes software developed by the University of
37 * California, Berkeley and its contributors.
38 * 4. Neither the name of the University nor the names of its contributors
39 * may be used to endorse or promote products derived from this software
40 * without specific prior written permission.
42 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
43 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
46 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
47 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
48 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
50 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
51 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
54 * @(#)tp_tpdu.h 8.1 (Berkeley) 6/10/93
57 /***********************************************************
58 Copyright IBM Corporation 1987
62 Permission to use, copy, modify, and distribute this software and its
63 documentation for any purpose and without fee is hereby granted,
64 provided that the above copyright notice appear in all copies and that
65 both that copyright notice and this permission notice appear in
66 supporting documentation, and that the name of IBM not be
67 used in advertising or publicity pertaining to distribution of the
68 software without specific, written prior permission.
70 IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
71 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
72 IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
73 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
74 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
75 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
78 ******************************************************************/
81 * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
86 * This ghastly set of macros makes it possible to
87 * refer to tpdu structures without going mad.
95 * Definitions for byte order,
96 * according to byte significance from low address to high.
98 #define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */
99 #define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
100 #define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */
103 #define BYTE_ORDER LITTLE_ENDIAN
105 #define BYTE_ORDER BIG_ENDIAN /* mc68000, tahoe, most others */
107 #endif /* BYTE_ORDER */
109 /* This much of a tpdu is the same for all types of tpdus (except
110 * DT tpdus in class 0; their exceptions are handled by the data
114 u_char _tpduf_li
:8, /* length indicator */
115 #if BYTE_ORDER == LITTLE_ENDIAN
116 _tpduf_cdt
: 4, /* credit */
117 _tpduf_type
: 4; /* type of tpdu (DT, CR, etc.) */
119 #if BYTE_ORDER == BIG_ENDIAN
120 _tpduf_type
: 4, /* type of tpdu (DT, CR, etc.) */
121 _tpduf_cdt
: 4; /* credit */
123 u_short _tpduf_dref
; /* destination ref; not in DT in class 0 */
126 #define tpdu_li _tpduf._tpduf_li
127 #define tpdu_type _tpduf._tpduf_type
128 #define tpdu_cdt _tpduf._tpduf_cdt
129 #define tpdu_dref _tpduf._tpduf_dref
133 _tp0_cdt_type
, /* same as in tpdu_fixed */
134 #if BYTE_ORDER == BIG_ENDIAN
135 _tp0_eot
: 1, /* eot */
136 _tp0_mbz
: 7, /* must be zero */
138 #if BYTE_ORDER == LITTLE_ENDIAN
139 _tp0_mbz
: 7, /* must be zero */
140 _tp0_eot
: 1, /* eot */
142 _tp0_notused
: 8; /* data begins on this octet */
145 #define tp0du_eot _tp0_eot
146 #define tp0du_mbz _tp0_mbz
149 * This is used when the extended format seqence numbers are
150 * being sent and received.
153 * the seqeot field is an int that overlays the seq
154 * and eot fields, this allows the htonl operation
155 * to be applied to the entire 32 bit quantity, and
156 * simplifies the structure definitions.
160 #if BYTE_ORDER == BIG_ENDIAN
161 unsigned int st_eot
:1, /* end-of-tsdu */
162 st_seq
:31; /* 31 bit sequence number */
164 #if BYTE_ORDER == LITTLE_ENDIAN
165 unsigned int st_seq
:31, /* 31 bit sequence number */
166 st_eot
:1; /* end-of-tsdu */
169 unsigned int s_seqeot
;
170 #define s_eot st.st_eot
171 #define s_seq st.st_seq
174 /* Then most tpdu types have a portion that is always present but
175 * differs among the tpdu types :
177 union tpdu_fixed_rest
{
180 u_short _tpdufr_sref
, /* source reference */
181 #if BYTE_ORDER == BIG_ENDIAN
182 _tpdufr_class
: 4, /* class [ ISO 8073 13.3.3.e ] */
183 _tpdufr_opt
: 4, /* options [ ISO 8073 13.3.3.e ] */
185 #if BYTE_ORDER == LITTLE_ENDIAN
186 _tpdufr_opt
: 4, /* options [ ISO 8073 13.3.3.e ] */
187 _tpdufr_class
: 4, /* class [ ISO 8073 13.3.3.e ] */
189 _tpdufr_xx
: 8; /* unused */
192 #define tpdu_CRli _tpduf._tpduf_li
193 #define tpdu_CRtype _tpduf._tpduf_type
194 #define tpdu_CRcdt _tpduf._tpduf_cdt
195 #define tpdu_CRdref_0 _tpduf._tpduf_dref
196 #define tpdu_CRsref _tpdufr.CRCC._tpdufr_sref
197 #define tpdu_sref _tpdufr.CRCC._tpdufr_sref
198 #define tpdu_CRclass _tpdufr.CRCC._tpdufr_class
199 #define tpdu_CRoptions _tpdufr.CRCC._tpdufr_opt
201 #define tpdu_CCli _tpduf._tpduf_li
202 #define tpdu_CCtype _tpduf._tpduf_type
203 #define tpdu_CCcdt _tpduf._tpduf_cdt
204 #define tpdu_CCdref _tpduf._tpduf_dref
205 #define tpdu_CCsref _tpdufr.CRCC._tpdufr_sref
206 #define tpdu_CCclass _tpdufr.CRCC._tpdufr_class
207 #define tpdu_CCoptions _tpdufr.CRCC._tpdufr_opt
209 /* OPTIONS and ADDL OPTIONS bits */
210 #define TPO_USE_EFC 0x1
211 #define TPO_XTD_FMT 0x2
212 #define TPAO_USE_TXPD 0x1
213 #define TPAO_NO_CSUM 0x2
214 #define TPAO_USE_RCC 0x4
215 #define TPAO_USE_NXPD 0x8
218 unsigned short _tpdufr_sref
; /* source reference */
219 unsigned char _tpdufr_reason
; /* [ ISO 8073 13.5.3.d ] */
221 #define tpdu_DRli _tpduf._tpduf_li
222 #define tpdu_DRtype _tpduf._tpduf_type
223 #define tpdu_DRdref _tpduf._tpduf_dref
224 #define tpdu_DRsref _tpdufr.DR._tpdufr_sref
225 #define tpdu_DRreason _tpdufr.DR._tpdufr_reason
227 unsigned short _tpdufr_sref
; /* source reference */
229 #define tpdu_DCli _tpduf._tpduf_li
230 #define tpdu_DCtype _tpduf._tpduf_type
231 #define tpdu_DCdref _tpduf._tpduf_dref
232 #define tpdu_DCsref _tpdufr._tpdufr_sref
235 #if BYTE_ORDER == BIG_ENDIAN
236 unsigned char _tpdufr_eot
:1, /* end-of-tsdu */
237 _tpdufr_seq
:7; /* 7 bit sequence number */
239 #if BYTE_ORDER == LITTLE_ENDIAN
240 unsigned char _tpdufr_seq
:7, /* 7 bit sequence number */
241 _tpdufr_eot
:1; /* end-of-tsdu */
245 #if BYTE_ORDER == BIG_ENDIAN
246 unsigned int _tpdufr_Xeot
:1, /* end-of-tsdu */
247 _tpdufr_Xseq
:31; /* 31 bit sequence number */
249 #if BYTE_ORDER == LITTLE_ENDIAN
250 unsigned int _tpdufr_Xseq
:31, /* 31 bit sequence number */
251 _tpdufr_Xeot
:1; /* end-of-tsdu */
254 unsigned int _tpdufr_Xseqeot
;
255 #define tpdu_seqeotX _tpdufr._tpdufr_Xseqeot
257 #define tpdu_DTli _tpduf._tpduf_li
258 #define tpdu_DTtype _tpduf._tpduf_type
259 #define tpdu_DTdref _tpduf._tpduf_dref
260 #define tpdu_DTseq _tpdufr.SEQEOT._tpdufr_seq
261 #define tpdu_DTeot _tpdufr.SEQEOT._tpdufr_eot
262 #define tpdu_DTseqX _tpdufr.SEQEOT31._tpdufr_Xseq
263 #define tpdu_DTeotX _tpdufr.SEQEOT31._tpdufr_Xeot
265 #define tpdu_XPDli _tpduf._tpduf_li
266 #define tpdu_XPDtype _tpduf._tpduf_type
267 #define tpdu_XPDdref _tpduf._tpduf_dref
268 #define tpdu_XPDseq _tpdufr.SEQEOT._tpdufr_seq
269 #define tpdu_XPDeot _tpdufr.SEQEOT._tpdufr_eot
270 #define tpdu_XPDseqX _tpdufr.SEQEOT31._tpdufr_Xseq
271 #define tpdu_XPDeotX _tpdufr.SEQEOT31._tpdufr_Xeot
274 #if BYTE_ORDER == BIG_ENDIAN
275 unsigned _tpdufr_yrseq0
:1, /* always zero */
276 _tpdufr_yrseq
:31; /* [ ISO 8073 13.9.3.d ] */
278 #if BYTE_ORDER == LITTLE_ENDIAN
279 unsigned _tpdufr_yrseq
:31, /* [ ISO 8073 13.9.3.d ] */
280 _tpdufr_yrseq0
:1; /* always zero */
282 unsigned short _tpdufr_cdt
; /* [ ISO 8073 13.9.3.b ] */
285 #define tpdu_AKli _tpduf._tpduf_li
286 #define tpdu_AKtype _tpduf._tpduf_type
287 #define tpdu_AKdref _tpduf._tpduf_dref
288 #define tpdu_AKseq _tpdufr.SEQEOT._tpdufr_seq
289 #define tpdu_AKseqX _tpdufr.AK31._tpdufr_yrseq
290 /* location of cdt depends on size of seq. numbers */
291 #define tpdu_AKcdt _tpduf._tpduf_cdt
292 #define tpdu_AKcdtX _tpdufr.AK31._tpdufr_cdt
294 #define tpdu_XAKli _tpduf._tpduf_li
295 #define tpdu_XAKtype _tpduf._tpduf_type
296 #define tpdu_XAKdref _tpduf._tpduf_dref
297 #define tpdu_XAKseq _tpdufr.SEQEOT._tpdufr_seq
298 #define tpdu_XAKseqX _tpdufr.SEQEOT31._tpdufr_Xseq
300 unsigned char _tpdu_ERreason
; /* [ ISO 8073 13.12.3.c ] */
302 #define tpdu_ERli _tpduf._tpduf_li
303 #define tpdu_ERtype _tpduf._tpduf_type
304 #define tpdu_ERdref _tpduf._tpduf_dref
305 #define tpdu_ERreason _tpdufr._tpdu_ERreason
310 struct tpdu_fixed _tpduf
;
311 union tpdu_fixed_rest _tpdufr
;
314 #endif /* __TP_TPDU__ */