Annotation of kernel/bsd/netiso/tp_tpdu.h, revision 1.1.1.1

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