Annotation of ntddk/src/network/streams/inc/xti.h, revision 1.1.1.1

1.1       root        1: /*++
                      2: 
                      3: Copyright (c) 1991  Microsoft Corporation
                      4: 
                      5: Module Name:
                      6: 
                      7:     xti.h
                      8: 
                      9: Abstract:
                     10: 
                     11:     This include file is Appendix F.1 from the X/Open CAE Specification (1992)
                     12:     for the X/Open Transport Interface (XTI).
                     13: 
                     14: Author:
                     15: 
                     16:     Eric Chin (ericc)           November 11, 1991
                     17: 
                     18: Revision History:
                     19: 
                     20: 
                     21: --*/
                     22: 
                     23: #ifndef _XTI_HEADER_
                     24: #define _XTI_HEADER_
                     25: 
                     26: /*
                     27:  * The following are the error codes needed by both the kernel
                     28:  * level transport providers and the user level library.
                     29:  */
                     30: #define TBADADDR            1           /* incorrect addr format */
                     31: #define TBADOPT             2           /* incorrect option format */
                     32: #define TACCES              3           /* incorrect permissions */
                     33: #define TBADF               4           /* illegal transport fd */
                     34: #define TNOADDR             5           /* couldn't allocate addr */
                     35: #define TOUTSTATE           6           /* out of state */
                     36: #define TBADSEQ             7           /* bad call sequence number */
                     37: #define TSYSERR             8           /* system error */
                     38: #define TLOOK               9           /* event requires attention */
                     39: #define TBADDATA            10          /* illegal amount of data */
                     40: #define TBUFOVFLW           11          /* buffer not large enough */
                     41: #define TFLOW               12          /* flow control */
                     42: #define TNODATA             13          /* no data */
                     43: #define TNODIS              14          /* discon_ind not found on queue */
                     44: #define TNOUDERR            15          /* unitdata error not found */
                     45: #define TBADFLAG            16          /* bad flags */
                     46: #define TNOREL              17          /* no ord rel found on queue */
                     47: #define TNOTSUPPORT         18          /* primitive/action not supported */
                     48: #define TSTATECHNG          19          /* state is in process of changing */
                     49: #define TNOSTRUCTYPE        20          /* unsupported struct-type requested */
                     50: #define TBADNAME            21          /* invalid transport provider name */
                     51: #define TBADQLEN            22          /* qlen is zero */
                     52: #define TADDRBUSY           23          /* address in use */
                     53: #define TINDOUT             24          /* outstanding connection indications */
                     54: #define TPROVMISMATCH       25          /* transport provide mismatch */
                     55: #define TRESQLEN            26          /* resfd to accept w/ qlen > 0 */
                     56: #define TRESADDR            27          /* resfd not bound to same addr as fd */
                     57: #define TQFULL              28          /* incoming connection queue full */
                     58: #define TPROTO              29          /* XTI protocol error */
                     59: #define TNTERROR           101          /* NT status code */
                     60: 
                     61: 
                     62: /*
                     63:  * The following are the events returned
                     64:  */
                     65: #define T_LISTEN            0x0001      /* connection indication received */
                     66: #define T_CONNECT           0x0002      /* connect confirmation received */
                     67: #define T_DATA              0x0004      /* normal data received */
                     68: #define T_EXDATA            0x0008      /* expedited data received */
                     69: #define T_DISCONNECT        0x0010      /* disconnect received */
                     70: #define T_UDERR             0x0040      /* datagram error indication */
                     71: #define T_ORDREL            0x0080      /* orderly release indication */
                     72: #define T_GODATA            0x0100      /* sending normal data is possible */
                     73: #define T_GOEXDATA          0x0200      /* sending expedited data is possible */
                     74: #define T_ERROR             0x0400      /* defined for TLI */
                     75: 
                     76: 
                     77: /*
                     78:  * The following are the flag definitions needed by the user level library
                     79:  * routines.
                     80:  */
                     81: #define T_MORE              0x001       /* more data */
                     82: #define T_EXPEDITED         0x002       /* expedited data */
                     83: #define T_NEGOTIATE         0x004       /* set opts */
                     84: #define T_CHECK             0x008       /* check opts */
                     85: #define T_DEFAULT           0x010       /* get default opts */
                     86: #define T_SUCCESS           0x020       /* successful */
                     87: #define T_FAILURE           0x040       /* failure */
                     88: #define T_CURRENT           0x080       /* get current options */
                     89: 
                     90: 
                     91: /*
                     92:  * XTI error return
                     93:  *
                     94:  * BUGBUG:
                     95:  * This is no good for multi-threaded processes.
                     96:  *
                     97: extern int t_errno;
                     98:  */
                     99: 
                    100: 
                    101: /*
                    102:  * Protocol-specific service limits
                    103:  */
                    104: struct t_info {
                    105:     long        addr;           /* max size of protocol address */
                    106:     long        options;        /* max bytes of protocol-specific options */
                    107:     long        tsdu;           /* max size of a transport service data unit */
                    108:     long        etsdu;          /* max size of expedited service data unit */
                    109:     long        connect;        /* max amount of data allowed on connection */
                    110:                                 /* establishment functions */
                    111:     long        discon;         /* max data allowed on t_snddis and t_rcvdis */
                    112:     long        servtype;       /* service type supported by provider */
                    113:     long        flags;          /* other info about the transport provider */
                    114: };
                    115: 
                    116: 
                    117: /*
                    118:  * Service type defines
                    119:  */
                    120: #define T_COTS              01  /* connection-oriented transport service */
                    121: #define T_COTS_ORD          02  /* connection-oriented with orderly release */
                    122: #define T_CLTS              03  /* connectionless transport service */
                    123: 
                    124: 
                    125: /*
                    126:  * Flags defines (other info about the transport provider).
                    127:  */
                    128: #define T_SENDZERO         0x001 /* supports 0-length TSDUs */
                    129: 
                    130: 
                    131: /*
                    132:  * netbuf structure
                    133:  */
                    134: struct netbuf {
                    135:     unsigned int    maxlen;
                    136:     unsigned int    len;
                    137:     char           *buf;
                    138: };
                    139: 
                    140: 
                    141: /*
                    142:  * t_opthdr structure
                    143:  */
                    144: struct t_opthdr {
                    145:     unsigned long   len;                    /* total length of option; ie.
                    146:                                                sizeof(struct t_opthdr) + length
                    147:                                                of option value in bytes */
                    148:     unsigned long   level;                  /* protocol affected */
                    149:     unsigned long   name;                   /* option name */
                    150:     unsigned long   status;                 /* status value */
                    151:                                             /* followed by the option value */
                    152: };
                    153: 
                    154: 
                    155: /*
                    156:  * t_bind - format of the address and options arguments of bind
                    157:  */
                    158: struct t_bind {
                    159:     struct netbuf   addr;
                    160:     unsigned        qlen;
                    161: };
                    162: 
                    163: 
                    164: /*
                    165:  * Options management structure
                    166:  */
                    167: struct t_optmgmt {
                    168:     struct netbuf   opt;
                    169:     long            flags;
                    170: };
                    171: 
                    172: 
                    173: /*
                    174:  * Disconnect structure
                    175:  */
                    176: struct t_discon {
                    177:     struct netbuf   udata;                  /* user data */
                    178:     int             reason;                 /* reason code */
                    179:     int             sequence;               /* sequence number */
                    180: };
                    181: 
                    182: 
                    183: /*
                    184:  * Call structure
                    185:  */
                    186: struct t_call {
                    187:     struct netbuf   addr;                   /* address */
                    188:     struct netbuf   opt;                    /* options */
                    189:     struct netbuf   udata;                  /* user data */
                    190:     int             sequence;               /* sequence number */
                    191: };
                    192: 
                    193: 
                    194: /*
                    195:  * Datagram structure
                    196:  */
                    197: struct t_unitdata {
                    198:     struct netbuf   addr;                   /* address */
                    199:     struct netbuf   opt;                    /* options */
                    200:     struct netbuf   udata;                  /* user data */
                    201: };
                    202: 
                    203: 
                    204: /*
                    205:  * Unitdata error structure
                    206:  */
                    207: struct t_uderr {
                    208:     struct netbuf  addr;                    /* address */
                    209:     struct netbuf  opt;                     /* options */
                    210:     long           error;                   /* error code */
                    211: };
                    212: 
                    213: 
                    214: /*
                    215:  * The following are structure types used when dynamically allocating the
                    216:  * above structures via t_alloc().
                    217:  */
                    218: #define T_BIND              1           /* struct t_bind */
                    219: #define T_OPTMGMT           2           /* struct t_optmgmt */
                    220: #define T_CALL              3           /* struct t_call */
                    221: #define T_DIS               4           /* struct t_discon */
                    222: #define T_UNITDATA          5           /* struct t_unitdata */
                    223: #define T_UDERROR           6           /* struct t_uderr */
                    224: #define T_INFO              7           /* struct t_info */
                    225: 
                    226: 
                    227: /*
                    228:  * The following bits specify which fields of the above structures should
                    229:  * be allocated by t_alloc().
                    230:  */
                    231: #define T_ADDR              0x01        /* address */
                    232: #define T_OPT               0x02        /* options */
                    233: #define T_UDATA             0x04        /* user data */
                    234: #define T_ALL               0xffff      /* all the above fields supported */
                    235: 
                    236: 
                    237: /*
                    238:  * The following are the states for the user.
                    239:  */
                    240: #define T_UNBND             1           /* unbound */
                    241: #define T_IDLE              2           /* idle */
                    242: #define T_OUTCON            3           /* outgoing connection pending */
                    243: #define T_INCON             4           /* incoming connection pending */
                    244: #define T_DATAXFER          5           /* data transfer */
                    245: #define T_OUTREL            6           /* outgoing release pending */
                    246: #define T_INREL             7           /* incoming release pending */
                    247: 
                    248: 
                    249: /*
                    250:  * General purpose defines
                    251:  */
                    252: #define T_YES               1
                    253: #define T_NO                0
                    254: #define T_UNUSED           -1
                    255: #define T_NULL              0
                    256: #define T_ABSREQ       0x8000
                    257: #define T_INFINITE         -1
                    258: #define T_INVALID          -2
                    259: 
                    260: /* T_INFINITE and T_INVALID are values of t_info */
                    261: 
                    262: /*
                    263:  * General definitions for option management
                    264:  */
                    265: #define T_UNSPEC            (~0 - 2)    /* applicable to u_long, long, ... */
                    266: #define T_ALLOPT            0
                    267: #define T_ALIGN(p)          (((unsigned long) (p) + (sizeof(long) - 1)) \
                    268:                                                     & ~(sizeof(long) - 1))
                    269: 
                    270: #define OPT_NEXTHDR(pbuf, buflen, popt) \
                    271:                             (((char *) (popt) + T_ALIGN((popt)->len) < \
                    272:                                 pbuf + buflen) ? \
                    273:                             (struct t_opthdr *) ((char *) (popt) + \
                    274:                                 T_ALIGN((popt)->len)) : \
                    275:                             (struct t_opthdr *) NULL)
                    276: 
                    277: 
                    278: /*
                    279:  * OPTIONS ON XTI LEVEL
                    280:  */
                    281: #define XTI_GENERIC         0xffff
                    282: 
                    283: /*
                    284:  * XTI-level Options
                    285:  */
                    286: #define XTI_DEBUG           0x0001      /* enable debugging */
                    287: #define XTI_LINGER          0x0080      /* linger on close if data present */
                    288: #define XTI_RCVBUF          0x1002      /* receive buffer size */
                    289: #define XTI_RCVLOWAT        0x1004      /* receive low-water mark */
                    290: #define XTI_SNDBUF          0x1001      /* send buffer size */
                    291: #define XTI_SNDLOWAT        0x1003      /* send low-water mark */
                    292: 
                    293: 
                    294: /*
                    295:  * Structure used with linger option
                    296:  */
                    297: struct t_linger {
                    298:     long           l_onoff;                 /* option on/off */
                    299:     long           l_linger;                /* linger time */
                    300: };
                    301: 
                    302: 
                    303: /*
                    304:  * SPECIFIC ISO OPTION AND MANAGEMENT PARAMETERS
                    305:  */
                    306: 
                    307: /*
                    308:  * Definition of the ISO transport classes
                    309:  */
                    310: #define T_CLASS0            0
                    311: #define T_CLASS1            1
                    312: #define T_CLASS2            2
                    313: #define T_CLASS3            3
                    314: #define T_CLASS4            4
                    315: 
                    316: 
                    317: /*
                    318:  * Definition of the priorities
                    319:  */
                    320: #define T_PRITOP            0
                    321: #define T_PRIHIGH           1
                    322: #define T_PRIMID            2
                    323: #define T_PRILOW            3
                    324: #define T_PRIDFLT           4
                    325: 
                    326: 
                    327: /*
                    328:  * Definitions of the protection levels
                    329:  */
                    330: #define T_NOPROTECT         1
                    331: #define T_PASSIVEPROTECT    2
                    332: #define T_ACTIVEPROTECT     4
                    333: 
                    334: 
                    335: /*
                    336:  * Default value for the length of TPDUs.
                    337:  */
                    338: #define T_LTPDUDFLT         128         /* define obsolete in XPG4 */
                    339: 
                    340: 
                    341: /*
                    342:  * rate structure
                    343:  */
                    344: struct rate {
                    345:     long            targetvalue;            /* target value */
                    346:     long            minacceptvalue;         /* minimum acceptable quality */
                    347: };
                    348: 
                    349: 
                    350: /*
                    351:  * reqvalue structure.
                    352:  */
                    353: struct reqvalue {
                    354:     struct rate     called;                 /* called rate */
                    355:     struct rate     calling;                /* calling rate */
                    356: };
                    357: 
                    358: 
                    359: /*
                    360:  * thrpt structure.
                    361:  */
                    362: struct thrpt {
                    363:     struct reqvalue maxthrpt;               /* maximum throughput */
                    364:     struct reqvalue avgthrpt;               /* average throughput */
                    365: };
                    366: 
                    367: 
                    368: /*
                    369:  * transdel structure
                    370:  */
                    371: struct transdel {
                    372:     struct reqvalue maxdel;                 /* maximum transit delay */
                    373:     struct reqvalue avgdel;                 /* average transit delay */
                    374: };
                    375: 
                    376: 
                    377: 
                    378: /*
                    379:  * Protocol Levels
                    380:  */
                    381: #define ISO_TP              0x0100
                    382: 
                    383: 
                    384: /*
                    385:  * Options for Quality of Service and Expedited Data (ISO 8072:1986)
                    386:  */
                    387: #define TCO_THROUGHPUT      0x0001
                    388: #define TCO_TRANSDEL        0x0002
                    389: #define TCO_RESERRORRATE    0x0003
                    390: #define TCO_TRANSFFAILPROB  0x0004
                    391: #define TCO_ESTFAILPROB     0x0005
                    392: #define TCO_RELFAILPROB     0x0006
                    393: #define TCO_ESTDELAY        0x0007
                    394: #define TCO_RELDELAY        0x0008
                    395: #define TCO_CONNRESIL       0x0009
                    396: #define TCO_PROTECTION      0x000a
                    397: #define TCO_PRIORITY        0x000b
                    398: #define TCO_EXPD            0x000c
                    399: 
                    400: #define TCL_TRANSDEL        0x000d
                    401: #define TCL_RESERRORRATE    TCO_RESERRORRATE
                    402: #define TCL_PROTECTION      TCO_PROTECTION
                    403: #define TCL_PRIORITY        TCO_PRIORITY
                    404: 
                    405: 
                    406: /*
                    407:  * Management Options
                    408:  */
                    409: #define TCO_LTPDU           0x0100
                    410: #define TCO_ACKTIME         0x0200
                    411: #define TCO_REASTIME        0x0300
                    412: #define TCO_EXTFORM         0x0400
                    413: #define TCO_FLOWCTRL        0x0500
                    414: #define TCO_CHECKSUM        0x0600
                    415: #define TCO_NETEXP          0x0700
                    416: #define TCO_NETRECPTCF      0x0800
                    417: #define TCO_PREFCLASS       0x0900
                    418: #define TCO_ALTCLASS1       0x0a00
                    419: #define TCO_ALTCLASS2       0x0b00
                    420: #define TCO_ALTCLASS3       0x0c00
                    421: #define TCO_ALTCLASS4       0x0d00
                    422: 
                    423: #define TCL_CHECKSUM        TCO_CHECKSUM
                    424: 
                    425: 
                    426: /* INTERNET SPECIFIC ENVIRONMENT */
                    427: 
                    428: /*
                    429:  * TCP level
                    430:  */
                    431: #define INET_TCP            0x6
                    432: 
                    433: 
                    434: /*
                    435:  * TCP-level Options
                    436:  */
                    437: #define TCP_NODELAY         0x1         /* don't delay packets to coalesce */
                    438: #define TCP_MAXSEG          0x2         /* get maximum segment size */
                    439: #define TCP_KEEPALIVE       0x8         /* check, if connections are alive */
                    440: 
                    441: 
                    442: /*
                    443:  * Structure used with TCP_KEEPALIVE option.
                    444:  */
                    445: struct t_kpalive {
                    446:     long            kp_onoff;               /* option on/off */
                    447:     long            kp_timeout;             /* timeout in minutes */
                    448: };
                    449: 
                    450: #define T_GARBAGE           0x02
                    451: 
                    452: 
                    453: /*
                    454:  * UDP level
                    455:  */
                    456: #define INET_UDP            0x11
                    457: 
                    458: 
                    459: /*
                    460:  * UDP-level Options
                    461:  */
                    462: #define UDP_CHECKSUM        TCO_CHECKSUM /* checksum computation */
                    463: 
                    464: 
                    465: /*
                    466:  * IP level
                    467:  */
                    468: #define INET_IP             0x0
                    469: 
                    470: 
                    471: /*
                    472:  * IP-level Options
                    473:  */
                    474: #define IP_OPTIONS          0x1         /* IP per-packet options */
                    475: #define IP_TOS              0x2         /* IP per-packet type of service */
                    476: #define IP_TTL              0x3         /* IP per-packet time to live */
                    477: #define IP_REUSEADDR        0x4         /* allow local address reuse */
                    478: #define IP_DONTROUTE       0x10         /* just use interface addresses */
                    479: #define IP_BROADCAST       0x20         /* permit sending of broadcast msgs */
                    480: 
                    481: 
                    482: /*
                    483:  * IP_TOS precedence levels
                    484:  */
                    485: #define T_ROUTINE           0
                    486: #define T_PRIORITY          1
                    487: #define T_IMMEDIATE         2
                    488: #define T_FLASH             3
                    489: #define T_OVERRIDEFLASH     4
                    490: #define T_CRITIC_ECP        5
                    491: #define T_INETCONTROL       6
                    492: #define T_NETCONTROL        7
                    493: 
                    494: 
                    495: /*
                    496:  * IP_TOS type of service
                    497:  */
                    498: #define T_NOTOS             0
                    499: #define T_LDELAY            (1 << 4)
                    500: #define T_HITHRPT           (1 << 3)
                    501: #define T_HIREL             (1 << 2)
                    502: 
                    503: #define SET_TOS(prec, tos)  ((0x7 & (prec)) << 5 | (0x1c & (tos)))
                    504: 
                    505: 
                    506: 
                    507: 
                    508: #endif /* _XTI_HEADER_ */

unix.superglobalmegacorp.com

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