Annotation of Net2/netiso/tp_tpdu.h, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.