Annotation of Net2/netiso/tp_param.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_param.h  7.8 (Berkeley) 6/27/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_param.h,v 5.3 88/11/18 17:28:18 nhall Exp $
        !            66:  * $Source: /usr/argo/sys/netiso/RCS/tp_param.h,v $
        !            67:  *
        !            68:  */
        !            69: 
        !            70: #ifndef __TP_PARAM__
        !            71: #define __TP_PARAM__
        !            72: 
        !            73: 
        !            74: /******************************************************
        !            75:  * compile time parameters that can be changed
        !            76:  *****************************************************/
        !            77: 
        !            78: #define        TP_CLASSES_IMPLEMENTED 0x11 /* zero and 4 */
        !            79: 
        !            80: #define                TP_DECBIT_CLEAR_COUNT   3
        !            81: 
        !            82: /*#define      N_TPREF                         100 */
        !            83: #ifdef KERNEL
        !            84: extern int N_TPREF;
        !            85: #endif
        !            86: 
        !            87: #define        TP_SOCKBUFSIZE          ((u_long)4096)
        !            88: #define        TP0_SOCKBUFSIZE         ((u_long)512)
        !            89: #define                MAX_TSAP_SEL_LEN        64
        !            90: 
        !            91: /* maximum tpdu size we'll accept: */
        !            92: #define        TP_TPDUSIZE                     0xc             /* 4096 octets for classes 1-4*/
        !            93: #define        TP0_TPDUSIZE            0xb             /* 2048 octets for class 0 */
        !            94: #define        TP_DFL_TPDUSIZE         0x7             /* 128 octets default */
        !            95:        /* NOTE: don't ever negotiate 8192 because could get 
        !            96:         * wraparound in checksumming
        !            97:         * (No mtu is likely to be larger than 4K anyway...)
        !            98:         */
        !            99: #define                TP_NRETRANS                     5 /* was 1; cray uses 6 */
        !           100: #define                TP_MAXPORT                      0xefff
        !           101: 
        !           102: #define                TP_RTT_NUM                      0x7
        !           103: /* ALPHA: to be used in the context: gain= 1/(2**alpha), or 
        !           104:  * put another way, gaintimes(x) (x)>>alpha (forgetting the case alpha==0) 
        !           105:  */
        !           106: #define        TP_RTT_ALPHA            3 
        !           107: #define        TP_RTV_ALPHA            2
        !           108: 
        !           109: /*
        !           110:  * not sure how to treat data on disconnect 
        !           111:  */
        !           112: #define        T_CONN_DATA                     0x1
        !           113: #define        T_DISCONNECT            0x2
        !           114: #define        T_DISC_DATA                     0x4
        !           115: #define        T_XDATA                         0x8
        !           116: 
        !           117: #define ISO_CLNS        0
        !           118: #define IN_CLNS                 1
        !           119: #define ISO_CONS        2
        !           120: #define ISO_COSNS       3
        !           121: #define TP_MAX_NETSERVICES 3
        !           122: 
        !           123: /* Indices into tp stats ackreason[i] */
        !           124: #define _ACK_DONT_ 0
        !           125: #define _ACK_STRAT_EACH_ 0x1
        !           126: #define _ACK_STRAT_FULLWIN_ 0x2
        !           127: #define _ACK_DUP_ 0x3
        !           128: #define _ACK_EOT_ 0x4
        !           129: #define _ACK_REORDER_ 0x5
        !           130: #define _ACK_USRRCV_ 0x6
        !           131: #define _ACK_FCC_ 0x7
        !           132: #define _ACK_NUM_REASONS_ 0x8
        !           133: 
        !           134: /* masks for use in tp_stash() */
        !           135: #define ACK_DONT                       0
        !           136: #define ACK_STRAT_EACH         (1<< _ACK_STRAT_EACH_)
        !           137: #define ACK_STRAT_FULLWIN      (1<< _ACK_STRAT_FULLWIN_)
        !           138: #define ACK_DUP                        (1<< _ACK_DUP_)
        !           139: #define ACK_EOT                                (1<< _ACK_EOT_)
        !           140: #define ACK_REORDER                    (1<< _ACK_REORDER_)
        !           141: 
        !           142: /******************************************************
        !           143:  * constants used in the protocol 
        !           144:  *****************************************************/
        !           145: 
        !           146: #define                TP_VERSION                      0x1
        !           147: 
        !           148: #define        TP_MAX_HEADER_LEN       256
        !           149: 
        !           150: #define        TP_MIN_TPDUSIZE         0x7             /* 128 octets */
        !           151: #define        TP_MAX_TPDUSIZE         0xd             /* 8192 octets */
        !           152: 
        !           153: #define                TP_MAX_XPD_DATA         0x10    /* 16 octets */
        !           154: #define                TP_MAX_CC_DATA          0x20    /* 32 octets */
        !           155: #define                TP_MAX_CR_DATA          TP_MAX_CC_DATA
        !           156: #define                TP_MAX_DR_DATA          0x40    /* 64 octets */
        !           157: 
        !           158: #define                TP_XTD_FMT_BIT  0x80000000
        !           159: #define                TP_XTD_FMT_MASK 0x7fffffff
        !           160: #define                TP_NML_FMT_BIT  0x80
        !           161: #define                TP_NML_FMT_MASK 0x7f
        !           162: 
        !           163: /*  
        !           164:  * values for the tpdu_type field, 2nd byte in a tpdu 
        !           165:  */
        !           166: 
        !           167: #define TP_MIN_TPDUTYPE 0x1
        !           168: 
        !           169: #define XPD_TPDU_type  0x1
        !           170: #define XAK_TPDU_type  0x2
        !           171: #define GR_TPDU_type   0x3     
        !           172: #define AK_TPDU_type   0x6
        !           173: #define ER_TPDU_type   0x7
        !           174: #define DR_TPDU_type   0x8
        !           175: #define DC_TPDU_type   0xc
        !           176: #define CC_TPDU_type   0xd
        !           177: #define CR_TPDU_type   0xe
        !           178: #define DT_TPDU_type   0xf
        !           179: 
        !           180: #define TP_MAX_TPDUTYPE 0xf
        !           181: 
        !           182: /*
        !           183:  * identifiers for the variable-length options in tpdus 
        !           184:  */
        !           185: 
        !           186: #define                TPP_acktime                     0x85
        !           187: #define                TPP_residER                     0x86
        !           188: #define                TPP_priority            0x87
        !           189: #define                TPP_transdelay          0x88
        !           190: #define                TPP_throughput          0x89
        !           191: #define                TPP_subseq                      0x8a
        !           192: #define                TPP_flow_cntl_conf      0x8c    /* not implemented */
        !           193: #define                TPP_addl_info           0xe0
        !           194: #define                TPP_tpdu_size           0xc0
        !           195: #define                TPP_calling_sufx        0xc1
        !           196: #define                TPP_invalid_tpdu        0xc1    /* the bozos used a value twice */
        !           197: #define                TPP_called_sufx         0xc2
        !           198: #define                TPP_checksum            0xc3
        !           199: #define                TPP_vers                        0xc4
        !           200: #define                TPP_security            0xc5
        !           201: #define                TPP_addl_opt            0xc6
        !           202: #define                TPP_alt_class           0xc7
        !           203: #define                TPP_perf_meas           0xc8    /* local item : perf meas on, svp */
        !           204: 
        !           205: /******************************************************
        !           206:  * Some fundamental data types
        !           207:  *****************************************************/
        !           208: #ifndef                TRUE
        !           209: #define                TRUE                            1
        !           210: #endif         TRUE
        !           211: 
        !           212: #ifndef                FALSE
        !           213: #define                FALSE                           0
        !           214: #endif         FALSE
        !           215: 
        !           216: #define                TP_LOCAL                                22
        !           217: #define                TP_FOREIGN                              33
        !           218: 
        !           219: #ifndef        EOK
        !           220: #define        EOK     0
        !           221: #endif         EOK
        !           222: 
        !           223: #define        TP_CLASS_0      (1<<0)
        !           224: #define        TP_CLASS_1      (1<<1)
        !           225: #define        TP_CLASS_2      (1<<2)
        !           226: #define        TP_CLASS_3      (1<<3)
        !           227: #define        TP_CLASS_4      (1<<4)
        !           228: 
        !           229: #define        TP_FORCE        0x1
        !           230: #define        TP_STRICT       0x2
        !           231: 
        !           232: #ifndef        MNULL
        !           233: #define        MNULL                           (struct mbuf *)0
        !           234: #endif         MNULL
        !           235:        /* if ../sys/mbuf.h gets MT_types up to 0x40, these will 
        !           236:         * have to be changed:
        !           237:         */
        !           238: #define        MT_XPD                          0x44    
        !           239: #define        MT_EOT                          0x40
        !           240: 
        !           241: #define                TP_ENOREF                       0x80000000
        !           242: 
        !           243: typedef        unsigned int    SeqNum;
        !           244: typedef                unsigned short  RefNum;
        !           245: typedef                int                             ProtoHook;
        !           246: 
        !           247: 
        !           248: /******************************************************
        !           249:  * Some fundamental constants
        !           250:  *****************************************************/
        !           251: 
        !           252: #define TP_MIN_WIN     2048
        !           253: #define TP_MAX_WIN 16384
        !           254: #define TP_MAX_WIN_UNPRIV 8192
        !           255: 
        !           256: /******************************************************
        !           257:  * Macro used all over, for driver
        !           258:  *****************************************************/
        !           259: 
        !           260: #define  DoEvent(x) \
        !           261:   ((E.ev_number=(x)),(tp_driver(tpcb,&E)))
        !           262: 
        !           263: /******************************************************
        !           264:  * Some macros used all over, for timestamping
        !           265:  *****************************************************/
        !           266: 
        !           267: #define GET_CUR_TIME(tvalp) ((*tvalp) = time)
        !           268: 
        !           269: #define GET_TIME_SINCE(oldtvalp, diffp) {\
        !           270:        (diffp)->tv_sec = time.tv_sec - (oldtvalp)->tv_sec;\
        !           271:        (diffp)->tv_usec = time.tv_usec - (oldtvalp)->tv_usec;\
        !           272:        if( (diffp)->tv_usec <0 ) {\
        !           273:                (diffp)->tv_sec --;\
        !           274:                (diffp)->tv_usec = 1000000 - (diffp)->tv_usec;\
        !           275:        }\
        !           276: }
        !           277:                        
        !           278: /******************************************************
        !           279:  * Some macros used for address families
        !           280:  *****************************************************/
        !           281: 
        !           282: #define satosiso(ADDR) ((struct sockaddr_iso *)(ADDR))
        !           283: #define satosin(ADDR) ((struct sockaddr_in *)(ADDR))
        !           284: 
        !           285: /******************************************************
        !           286:  * Macro used for changing types of mbufs
        !           287:  *****************************************************/
        !           288: 
        !           289: #define CHANGE_MTYPE(m, TYPE)\
        !           290:        if((m)->m_type != TYPE) { \
        !           291:                mbstat.m_mtypes[(m)->m_type]--; mbstat.m_mtypes[TYPE]++; \
        !           292:                (m)->m_type = TYPE; \
        !           293:        }
        !           294: 
        !           295: /******************************************************
        !           296:  * Macros used for adding options to a tpdu header and for
        !           297:  * parsing the headers.
        !           298:  * Options are variable-length and must be bcopy-d because on the
        !           299:  * RT your assignments must be N-word aligned for objects of length
        !           300:  * N.  Such a drag.
        !           301:  *****************************************************/
        !           302: 
        !           303: struct tp_vbp {
        !           304:        u_char  tpv_code;
        !           305:        char    tpv_len;
        !           306:        char    tpv_val;
        !           307: };
        !           308: #define vbptr(x) ((struct tp_vbp *)(x))
        !           309: #define vbval(x,type) (*((type *)&(((struct tp_vbp *)(x))->tpv_val)))
        !           310: #define vbcode(x) (vbptr(x)->tpv_code)
        !           311: #define vblen(x) (vbptr(x)->tpv_len)
        !           312: 
        !           313: #define vb_putval(dst,type,src)\
        !           314:        bcopy((caddr_t)&(src),(caddr_t)&(((struct tp_vbp *)(dst))->tpv_val),\
        !           315:        sizeof(type))
        !           316: 
        !           317: #define vb_getval(src,type,dst)\
        !           318: bcopy((caddr_t)&(((struct tp_vbp *)(src))->tpv_val),(caddr_t)&(dst),sizeof(type))
        !           319: 
        !           320: #define ADDOPTION(type, DU, len, src)\
        !           321: {      register caddr_t P;\
        !           322:        P = (caddr_t)(DU) + (int)((DU)->tpdu_li);\
        !           323:        vbptr(P)->tpv_code = type;\
        !           324:        vbptr(P)->tpv_len = len;\
        !           325:        bcopy((caddr_t)&src, (caddr_t)&(vbptr(P)->tpv_val), (unsigned)len);\
        !           326:        DU->tpdu_li += len+2;/* 1 for code, 1 for length */\
        !           327: }
        !           328: /******************************************************
        !           329:  * Macro for the local credit:
        !           330:  * uses max transmission unit for the ll
        !           331:  * (as modified by the max TPDU size negotiated) 
        !           332:  *****************************************************/
        !           333: 
        !           334: #if defined(ARGO_DEBUG)&&!defined(LOCAL_CREDIT_EXPAND)
        !           335: #define LOCAL_CREDIT(tpcb) tp_local_credit(tpcb)
        !           336: #else
        !           337: #define LOCAL_CREDIT( tpcb ) {\
        !           338:     register struct sockbuf *xxsb = &((tpcb)->tp_sock->so_rcv);\
        !           339:     register int xxi = ((xxsb)->sb_hiwat-(xxsb)->sb_cc);\
        !           340:     register int maxcredit = ((tpcb)->tp_xtd_format?0xffff:0xf);\
        !           341:     xxi = (xxi<0) ? 0 : ((xxi)>>(tpcb)->tp_tpdusize);\
        !           342:     xxi = MIN(xxi, maxcredit); \
        !           343:     if (!(tpcb->tp_cebit_off)) { \
        !           344:         (tpcb)->tp_lcredit = ROUND((tpcb)->tp_win_recv); \
        !           345:         if (xxi < (tpcb)->tp_lcredit) { \
        !           346:             (tpcb)->tp_lcredit = xxi; \
        !           347:         } \
        !           348:     } \
        !           349:     else { \
        !           350:         (tpcb)->tp_lcredit = xxi; \
        !           351:     } \
        !           352: }
        !           353: #endif ARGO_DEBUG
        !           354: 
        !           355: #ifdef KERNEL
        !           356: 
        !           357: #ifndef  tp_NSTATES 
        !           358: 
        !           359: #include "tp_states.h"
        !           360: #include "tp_events.h"
        !           361: #if defined(__STDC__) || defined(__cplusplus)
        !           362: #undef ATTR
        !           363: #define ATTR(X) ev_union.EV_ ## X
        !           364: #endif /* defined(__STDC__) || defined(__cplusplus) */
        !           365: 
        !           366: #endif  tp_NSTATES 
        !           367: #endif KERNEL
        !           368: 
        !           369: #endif __TP_PARAM__

unix.superglobalmegacorp.com

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