2005-12-11 03:01:36 +03:00
|
|
|
/* $NetBSD: tp_tpdu.h,v 1.11 2005/12/11 00:01:36 elad Exp $ */
|
1994-06-29 10:39:25 +04:00
|
|
|
|
1993-04-09 16:00:07 +04:00
|
|
|
/*-
|
1994-05-13 10:08:03 +04:00
|
|
|
* Copyright (c) 1991, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2003-08-07 20:26:28 +04:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1993-04-09 16:00:07 +04:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1994-06-29 10:39:25 +04:00
|
|
|
* @(#)tp_tpdu.h 8.1 (Berkeley) 6/10/93
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/***********************************************************
|
|
|
|
Copyright IBM Corporation 1987
|
|
|
|
|
|
|
|
All Rights Reserved
|
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
Permission to use, copy, modify, and distribute this software and its
|
|
|
|
documentation for any purpose and without fee is hereby granted,
|
1993-04-09 16:00:07 +04:00
|
|
|
provided that the above copyright notice appear in all copies and that
|
1996-02-14 01:07:57 +03:00
|
|
|
both that copyright notice and this permission notice appear in
|
1993-04-09 16:00:07 +04:00
|
|
|
supporting documentation, and that the name of IBM not be
|
|
|
|
used in advertising or publicity pertaining to distribution of the
|
1996-02-14 01:07:57 +03:00
|
|
|
software without specific, written prior permission.
|
1993-04-09 16:00:07 +04:00
|
|
|
|
|
|
|
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
|
|
|
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
|
|
|
IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
|
|
|
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
|
|
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
|
|
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
|
|
SOFTWARE.
|
|
|
|
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
|
|
|
|
*/
|
1996-02-14 01:07:57 +03:00
|
|
|
/*
|
|
|
|
* This ghastly set of macros makes it possible to refer to tpdu structures
|
|
|
|
* without going mad.
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
|
|
|
|
1994-05-13 10:08:03 +04:00
|
|
|
#ifndef _NETISO_TP_TPDU_H_
|
|
|
|
#define _NETISO_TP_TPDU_H_
|
|
|
|
|
1994-07-21 11:10:12 +04:00
|
|
|
#include <machine/endian.h> /* for BYTE_ORDER */
|
1994-05-13 10:08:03 +04:00
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
/*
|
|
|
|
* This much of a tpdu is the same for all types of tpdus (except DT tpdus
|
|
|
|
* in class 0; their exceptions are handled by the data structure below
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
|
|
|
struct tpdu_fixed {
|
1996-02-14 01:07:57 +03:00
|
|
|
u_char _tpduf_li:8, /* length indicator */
|
1993-04-09 16:00:07 +04:00
|
|
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
1996-02-14 01:07:57 +03:00
|
|
|
_tpduf_cdt:4, /* credit */
|
|
|
|
_tpduf_type:4; /* type of tpdu (DT, CR, etc.) */
|
1993-04-09 16:00:07 +04:00
|
|
|
#endif
|
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
1996-02-14 01:07:57 +03:00
|
|
|
_tpduf_type:4, /* type of tpdu (DT, CR, etc.) */
|
|
|
|
_tpduf_cdt:4; /* credit */
|
1993-04-09 16:00:07 +04:00
|
|
|
#endif
|
1996-02-14 01:07:57 +03:00
|
|
|
u_short _tpduf_dref; /* destination ref; not in DT in
|
|
|
|
* class 0 */
|
1993-04-09 16:00:07 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#define tpdu_li _tpduf._tpduf_li
|
|
|
|
#define tpdu_type _tpduf._tpduf_type
|
|
|
|
#define tpdu_cdt _tpduf._tpduf_cdt
|
|
|
|
#define tpdu_dref _tpduf._tpduf_dref
|
1996-02-14 01:07:57 +03:00
|
|
|
|
1993-04-09 16:00:07 +04:00
|
|
|
struct tp0du {
|
1996-02-14 01:07:57 +03:00
|
|
|
u_char _tp0_li, _tp0_cdt_type, /* same as in tpdu_fixed */
|
1993-04-09 16:00:07 +04:00
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
1996-02-14 01:07:57 +03:00
|
|
|
_tp0_eot:1, /* eot */
|
|
|
|
_tp0_mbz:7, /* must be zero */
|
1993-04-09 16:00:07 +04:00
|
|
|
#endif
|
|
|
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
1996-02-14 01:07:57 +03:00
|
|
|
_tp0_mbz:7, /* must be zero */
|
|
|
|
_tp0_eot:1, /* eot */
|
1993-04-09 16:00:07 +04:00
|
|
|
#endif
|
1996-02-14 01:07:57 +03:00
|
|
|
_tp0_notused:8; /* data begins on this octet */
|
1993-04-09 16:00:07 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#define tp0du_eot _tp0_eot
|
|
|
|
#define tp0du_mbz _tp0_mbz
|
1996-02-14 01:07:57 +03:00
|
|
|
|
1993-04-09 16:00:07 +04:00
|
|
|
/*
|
|
|
|
* This is used when the extended format seqence numbers are
|
1996-02-14 01:07:57 +03:00
|
|
|
* being sent and received.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* the seqeot field is an int that overlays the seq
|
|
|
|
* and eot fields, this allows the htonl operation
|
|
|
|
* to be applied to the entire 32 bit quantity, and
|
|
|
|
* simplifies the structure definitions.
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
|
|
|
union seq_type {
|
|
|
|
struct {
|
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
1996-02-14 01:07:57 +03:00
|
|
|
unsigned int st_eot:1, /* end-of-tsdu */
|
|
|
|
st_seq:31; /* 31 bit sequence number */
|
1993-04-09 16:00:07 +04:00
|
|
|
#endif
|
|
|
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
1996-02-14 01:07:57 +03:00
|
|
|
unsigned int st_seq:31, /* 31 bit sequence number */
|
|
|
|
st_eot:1; /* end-of-tsdu */
|
1993-04-09 16:00:07 +04:00
|
|
|
#endif
|
|
|
|
} st;
|
1996-02-14 01:07:57 +03:00
|
|
|
unsigned int s_seqeot;
|
1993-04-09 16:00:07 +04:00
|
|
|
#define s_eot st.st_eot
|
|
|
|
#define s_seq st.st_seq
|
|
|
|
};
|
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
/*
|
|
|
|
* Then most tpdu types have a portion that is always present but differs
|
|
|
|
* among the tpdu types :
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
1996-02-14 01:07:57 +03:00
|
|
|
union tpdu_fixed_rest {
|
1993-04-09 16:00:07 +04:00
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
struct {
|
|
|
|
u_short _tpdufr_sref, /* source reference */
|
2005-02-27 01:31:44 +03:00
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
1996-02-14 01:07:57 +03:00
|
|
|
_tpdufr_class:4, /* class [ISO 8073 13.3.3.e] */
|
|
|
|
_tpdufr_opt:4, /* options [ISO 8073 13.3.3.e] */
|
1993-04-09 16:00:07 +04:00
|
|
|
#endif
|
|
|
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
1996-02-14 01:07:57 +03:00
|
|
|
_tpdufr_opt:4, /* options [ISO 8073 13.3.3.e] */
|
|
|
|
_tpdufr_class:4, /* class [ISO 8073 13.3.3.e] */
|
1993-04-09 16:00:07 +04:00
|
|
|
#endif
|
1996-02-14 01:07:57 +03:00
|
|
|
_tpdufr_xx:8; /* unused */
|
|
|
|
} CRCC;
|
1993-04-09 16:00:07 +04:00
|
|
|
|
|
|
|
#define tpdu_CRli _tpduf._tpduf_li
|
|
|
|
#define tpdu_CRtype _tpduf._tpduf_type
|
|
|
|
#define tpdu_CRcdt _tpduf._tpduf_cdt
|
|
|
|
#define tpdu_CRdref_0 _tpduf._tpduf_dref
|
|
|
|
#define tpdu_CRsref _tpdufr.CRCC._tpdufr_sref
|
|
|
|
#define tpdu_sref _tpdufr.CRCC._tpdufr_sref
|
|
|
|
#define tpdu_CRclass _tpdufr.CRCC._tpdufr_class
|
|
|
|
#define tpdu_CRoptions _tpdufr.CRCC._tpdufr_opt
|
|
|
|
|
|
|
|
#define tpdu_CCli _tpduf._tpduf_li
|
|
|
|
#define tpdu_CCtype _tpduf._tpduf_type
|
|
|
|
#define tpdu_CCcdt _tpduf._tpduf_cdt
|
|
|
|
#define tpdu_CCdref _tpduf._tpduf_dref
|
|
|
|
#define tpdu_CCsref _tpdufr.CRCC._tpdufr_sref
|
|
|
|
#define tpdu_CCclass _tpdufr.CRCC._tpdufr_class
|
|
|
|
#define tpdu_CCoptions _tpdufr.CRCC._tpdufr_opt
|
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
/* OPTIONS and ADDL OPTIONS bits */
|
1993-04-09 16:00:07 +04:00
|
|
|
#define TPO_USE_EFC 0x1
|
|
|
|
#define TPO_XTD_FMT 0x2
|
|
|
|
#define TPAO_USE_TXPD 0x1
|
|
|
|
#define TPAO_NO_CSUM 0x2
|
|
|
|
#define TPAO_USE_RCC 0x4
|
|
|
|
#define TPAO_USE_NXPD 0x8
|
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
struct {
|
|
|
|
unsigned short _tpdufr_sref; /* source reference */
|
|
|
|
unsigned char _tpdufr_reason; /* [ ISO 8073 13.5.3.d ] */
|
|
|
|
} DR;
|
1993-04-09 16:00:07 +04:00
|
|
|
#define tpdu_DRli _tpduf._tpduf_li
|
|
|
|
#define tpdu_DRtype _tpduf._tpduf_type
|
|
|
|
#define tpdu_DRdref _tpduf._tpduf_dref
|
|
|
|
#define tpdu_DRsref _tpdufr.DR._tpdufr_sref
|
|
|
|
#define tpdu_DRreason _tpdufr.DR._tpdufr_reason
|
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
unsigned short _tpdufr_sref; /* source reference */
|
1993-04-09 16:00:07 +04:00
|
|
|
|
|
|
|
#define tpdu_DCli _tpduf._tpduf_li
|
|
|
|
#define tpdu_DCtype _tpduf._tpduf_type
|
|
|
|
#define tpdu_DCdref _tpduf._tpduf_dref
|
|
|
|
#define tpdu_DCsref _tpdufr._tpdufr_sref
|
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
struct {
|
1993-04-09 16:00:07 +04:00
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
1996-02-14 01:07:57 +03:00
|
|
|
unsigned char _tpdufr_eot:1, /* end-of-tsdu */
|
|
|
|
_tpdufr_seq:7; /* 7 bit sequence number */
|
1993-04-09 16:00:07 +04:00
|
|
|
#endif
|
|
|
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
1996-02-14 01:07:57 +03:00
|
|
|
unsigned char _tpdufr_seq:7, /* 7 bit sequence number */
|
|
|
|
_tpdufr_eot:1; /* end-of-tsdu */
|
1993-04-09 16:00:07 +04:00
|
|
|
#endif
|
1996-02-14 01:07:57 +03:00
|
|
|
} SEQEOT;
|
|
|
|
struct {
|
1993-04-09 16:00:07 +04:00
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
1996-02-14 01:07:57 +03:00
|
|
|
unsigned int _tpdufr_Xeot:1, /* end-of-tsdu */
|
|
|
|
_tpdufr_Xseq:31; /* 31 bit sequence
|
|
|
|
* number */
|
1993-04-09 16:00:07 +04:00
|
|
|
#endif
|
|
|
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
1996-02-14 01:07:57 +03:00
|
|
|
unsigned int _tpdufr_Xseq:31, /* 31 bit sequence
|
|
|
|
* number */
|
|
|
|
_tpdufr_Xeot:1; /* end-of-tsdu */
|
1993-04-09 16:00:07 +04:00
|
|
|
#endif
|
1996-02-14 01:07:57 +03:00
|
|
|
} SEQEOT31;
|
|
|
|
unsigned int _tpdufr_Xseqeot;
|
1993-04-09 16:00:07 +04:00
|
|
|
#define tpdu_seqeotX _tpdufr._tpdufr_Xseqeot
|
|
|
|
|
|
|
|
#define tpdu_DTli _tpduf._tpduf_li
|
|
|
|
#define tpdu_DTtype _tpduf._tpduf_type
|
|
|
|
#define tpdu_DTdref _tpduf._tpduf_dref
|
|
|
|
#define tpdu_DTseq _tpdufr.SEQEOT._tpdufr_seq
|
|
|
|
#define tpdu_DTeot _tpdufr.SEQEOT._tpdufr_eot
|
|
|
|
#define tpdu_DTseqX _tpdufr.SEQEOT31._tpdufr_Xseq
|
|
|
|
#define tpdu_DTeotX _tpdufr.SEQEOT31._tpdufr_Xeot
|
|
|
|
|
|
|
|
#define tpdu_XPDli _tpduf._tpduf_li
|
|
|
|
#define tpdu_XPDtype _tpduf._tpduf_type
|
|
|
|
#define tpdu_XPDdref _tpduf._tpduf_dref
|
|
|
|
#define tpdu_XPDseq _tpdufr.SEQEOT._tpdufr_seq
|
|
|
|
#define tpdu_XPDeot _tpdufr.SEQEOT._tpdufr_eot
|
|
|
|
#define tpdu_XPDseqX _tpdufr.SEQEOT31._tpdufr_Xseq
|
|
|
|
#define tpdu_XPDeotX _tpdufr.SEQEOT31._tpdufr_Xeot
|
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
struct {
|
1993-04-09 16:00:07 +04:00
|
|
|
#if BYTE_ORDER == BIG_ENDIAN
|
1996-02-14 01:07:57 +03:00
|
|
|
unsigned _tpdufr_yrseq0:1, /* always zero */
|
|
|
|
_tpdufr_yrseq:31; /* [ ISO 8073 13.9.3.d ] */
|
1993-04-09 16:00:07 +04:00
|
|
|
#endif
|
|
|
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
1996-02-14 01:07:57 +03:00
|
|
|
unsigned _tpdufr_yrseq:31, /* [ ISO 8073 13.9.3.d ] */
|
|
|
|
_tpdufr_yrseq0:1; /* always zero */
|
1993-04-09 16:00:07 +04:00
|
|
|
#endif
|
1996-02-14 01:07:57 +03:00
|
|
|
unsigned short _tpdufr_cdt; /* [ ISO 8073 13.9.3.b ] */
|
|
|
|
} AK31;
|
1993-04-09 16:00:07 +04:00
|
|
|
|
|
|
|
#define tpdu_AKli _tpduf._tpduf_li
|
|
|
|
#define tpdu_AKtype _tpduf._tpduf_type
|
|
|
|
#define tpdu_AKdref _tpduf._tpduf_dref
|
|
|
|
#define tpdu_AKseq _tpdufr.SEQEOT._tpdufr_seq
|
|
|
|
#define tpdu_AKseqX _tpdufr.AK31._tpdufr_yrseq
|
1996-02-14 01:07:57 +03:00
|
|
|
/* location of cdt depends on size of seq. numbers */
|
1993-04-09 16:00:07 +04:00
|
|
|
#define tpdu_AKcdt _tpduf._tpduf_cdt
|
|
|
|
#define tpdu_AKcdtX _tpdufr.AK31._tpdufr_cdt
|
|
|
|
|
|
|
|
#define tpdu_XAKli _tpduf._tpduf_li
|
|
|
|
#define tpdu_XAKtype _tpduf._tpduf_type
|
|
|
|
#define tpdu_XAKdref _tpduf._tpduf_dref
|
|
|
|
#define tpdu_XAKseq _tpdufr.SEQEOT._tpdufr_seq
|
|
|
|
#define tpdu_XAKseqX _tpdufr.SEQEOT31._tpdufr_Xseq
|
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
unsigned char _tpdu_ERreason; /* [ ISO 8073 13.12.3.c ] */
|
1993-04-09 16:00:07 +04:00
|
|
|
|
|
|
|
#define tpdu_ERli _tpduf._tpduf_li
|
|
|
|
#define tpdu_ERtype _tpduf._tpduf_type
|
|
|
|
#define tpdu_ERdref _tpduf._tpduf_dref
|
|
|
|
#define tpdu_ERreason _tpdufr._tpdu_ERreason
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tpdu {
|
1996-02-14 01:07:57 +03:00
|
|
|
struct tpdu_fixed _tpduf;
|
|
|
|
union tpdu_fixed_rest _tpdufr;
|
1993-04-09 16:00:07 +04:00
|
|
|
};
|
|
|
|
|
2005-12-11 03:01:36 +03:00
|
|
|
#endif /* !_NETISO_TP_TPDU_H_ */
|