home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 202.img / SCO386N2.TD0 / usr / include / sys / tiuser.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-05-18  |  6.8 KB  |  243 lines

  1. /*
  2.  *    @(#) tiuser.h 1.1 88/05/18 
  3.  *
  4.  *    Copyright (C) The Santa Cruz Operation, 1984, 1985, 1986, 1987, 1988.
  5.  *    Copyright (C) Microsoft Corporation, 1984, 1985, 1986, 1987, 1988.
  6.  *    This Module contains Proprietary Information of
  7.  *    The Santa Cruz Operation, Microsoft Corporation
  8.  *    and AT&T, and should be treated as Confidential.
  9.  */
  10.  
  11. /*
  12.  * THIS FILE CONTAINS CODE WHICH IS DESIGNED TO BE
  13.  * PORTABLE BETWEEN DIFFERENT MACHINE ARCHITECTURES
  14.  * AND CONFIGURATIONS. IT SHOULD NOT REQUIRE ANY
  15.  * MODIFICATIONS WHEN ADAPTING XENIX TO NEW HARDWARE.
  16.  */
  17.  
  18. /*
  19.  * The following are the error codes needed by both the kernel
  20.  * level transport providers and the user level library.
  21.  */
  22.  
  23. #define    TBADADDR        1    /* incorrect addr format         */
  24. #define    TBADOPT            2    /* incorrect option format       */
  25. #define    TACCES            3    /* incorrect permissions         */
  26. #define TBADF            4    /* illegal transport fd             */
  27. #define TNOADDR            5    /* couldn't allocate addr        */
  28. #define TOUTSTATE            6    /* out of state                  */
  29. #define TBADSEQ                7       /* bad call sequnce number       */
  30. #define TSYSERR            8    /* system error              */
  31. #define TLOOK                9    /* event requires attention  */
  32. #define TBADDATA           10    /* illegal amount of data    */
  33. #define TBUFOVFLW           11       /* buffer not large enough   */
  34. #define TFLOW               12     /* flow control             */
  35. #define    TNODATA               13    /* no data             */
  36. #define TNODIS               14    /* discon_ind not found on q */
  37. #define TNOUDERR           15    /* unitdata error not found  */
  38. #define TBADFLAG           16       /* bad flags                 */
  39. #define TNOREL               17       /* no ord rel found on q     */
  40. #define TNOTSUPPORT           18       /* primitive not supported   */
  41. #define TSTATECHNG           19    /* state is in process of changing */
  42.  
  43. /* 
  44.  * The following are the events returned by t_look
  45.  */
  46. #define T_LISTEN    0x0001     /* connection indication received */
  47. #define T_CONNECT    0x0002    /* connect confirmation received  */
  48. #define T_DATA        0x0004    /* normal data received           */
  49. #define    T_EXDATA    0x0008    /* expedited data received        */
  50. #define T_DISCONNECT    0x0010    /* disconnect received            */
  51. #define T_ERROR        0x0020    /* fatal error occurred          */
  52. #define T_UDERR         0x0040    /* data gram error indication     */
  53. #define T_ORDREL    0x0080    /* orderly release indication     */
  54. #define T_EVENTS    0x00ff    /* event mask                      */
  55.  
  56. /*
  57.  * The following are the flag definitions needed by the
  58.  * user level library routines.
  59.  */
  60.  
  61. #define T_MORE        0x001        /* more data        */
  62. #define T_EXPEDITED    0x002        /* expedited data   */
  63. #define T_NEGOTIATE    0x004        /* set opts         */
  64. #define T_CHECK        0x008        /* check opts       */
  65. #define T_DEFAULT    0x010        /* get default opts */
  66. #define T_SUCCESS    0x020        /* successful       */
  67. #define T_FAILURE    0x040        /* failure          */
  68.  
  69. /*
  70.  * protocol specific service limits
  71.  */
  72.  
  73. struct t_info {
  74.     long addr;    /* size of protocol address                */
  75.     long options;    /* size of protocol options                */
  76.     long tsdu;    /* size of max transport service data unit */
  77.     long etsdu;    /* size of max expedited tsdu              */
  78.     long connect;    /* max data for connection primitives      */
  79.     long discon;    /* max data for disconnect primitives      */
  80.     long servtype;    /* provider service type           */
  81. };
  82.  
  83. /* 
  84.  * Service type defines
  85.  */
  86. #define T_COTS       01    /* connection oriented transport service  */
  87. #define T_COTS_ORD 02    /* connection oriented w/ orderly release */
  88. #define T_CLTS       03    /* connectionless transport service       */
  89.  
  90. /*
  91.  * netbuf structure
  92.  */
  93.  
  94. struct netbuf {
  95.     unsigned int maxlen;
  96.     unsigned int len;
  97.     char *buf;
  98. };
  99.  
  100. /*
  101.  * t_bind - format of the addres and options arguments of bind 
  102.  */
  103.  
  104. struct t_bind {
  105.     struct netbuf    addr;
  106.     unsigned    qlen;
  107. };
  108.  
  109. /* 
  110.  * options management
  111.  */
  112. struct t_optmgmt {
  113.     struct netbuf    opt;
  114.     long        flags;
  115. };
  116.  
  117. /*
  118.  * disconnect structure
  119.  */
  120. struct t_discon {
  121.     struct netbuf udata;        /* user data          */
  122.     int reason;            /* reason code        */
  123.     int sequence;            /* sequence number    */
  124. };
  125.  
  126. /*
  127.  * call structure
  128.  */
  129. struct t_call {
  130.     struct netbuf addr;        /*  address           */
  131.     struct netbuf opt;        /* options          */
  132.     struct netbuf udata;        /* user data          */
  133.     int sequence;            /* sequence number    */
  134. };
  135.  
  136. /*
  137.  * data gram structure
  138.  */
  139. struct t_unitdata {
  140.     struct netbuf addr;        /*  address           */
  141.     struct netbuf opt;        /* options          */
  142.     struct netbuf udata;        /* user data          */
  143. };
  144.  
  145. /*
  146.  * unitdata error
  147.  */
  148. struct t_uderr {
  149.     struct netbuf addr;        /* address        */
  150.     struct netbuf opt;        /* options         */
  151.     long          error;        /* error code        */
  152. };
  153.  
  154. /*
  155.  * The following are structure types used when dynamically
  156.  * allocating the above structures via t_structalloc().
  157.  */
  158. #define T_BIND        1        /* struct t_bind    */
  159. #define T_OPTMGMT    2        /* struct t_optmgmt    */
  160. #define T_CALL        3        /* struct t_call    */
  161. #define T_DIS        4        /* struct t_discon    */
  162. #define T_UNITDATA    5        /* struct t_unitdata    */
  163. #define T_UDERROR    6        /* struct t_uderr    */
  164. #define T_INFO        7        /* struct t_info    */
  165.  
  166. /*
  167.  * The following bits specify which fields of the above
  168.  * structures should be allocated by t_structalloc().
  169.  */
  170. #define T_ADDR    0x01            /* address   */
  171. #define T_OPT    0x02            /* options   */
  172. #define T_UDATA    0x04            /* user data */
  173. #define T_ALL    0x07            /* all the above */
  174.  
  175.  
  176. /* 
  177.  * the following are the states for the user
  178.  */
  179.  
  180. #define T_UNINIT    0        /* uninitialized          */
  181. #define T_UNBND        1        /* unbound                   */
  182. #define T_IDLE        2        /* idle                */
  183. #define    T_OUTCON    3        /* outgoing connection pending     */
  184. #define T_INCON        4        /* incoming connection pending  */
  185. #define T_DATAXFER    5        /* data transfer        */
  186. #define T_OUTREL        6               /* outgoing release pending     */
  187. #define T_INREL        7        /* incoming release pending     */
  188. #define T_FAKE        8        /* fake state used when state   */
  189.                     /* cannot be determined        */
  190. #define T_HACK        12        /* needed to maintain compatibility !!!
  191.                      * (used by switch statement in 
  192.                      * t_getstate.c)
  193.                      * DO NOT REMOVE UNTIL _spec FILE
  194.                      * REORDERED!!!!
  195.                      */
  196.  
  197. #define T_NOSTATES     9
  198.  
  199.  
  200. #define ROUNDUP(X)    ((X + 0x03)&~0x03)
  201.  
  202. /*
  203.  * The following are TLI user level events which cause
  204.  * state changes.
  205.  */
  206.  
  207. #define T_OPEN         0
  208. #define T_BIND        1
  209. #define T_OPTMGMT    2
  210. #define T_UNBIND    3
  211. #define T_CLOSE        4
  212. #define T_SNDUDATA    5
  213. #define T_RCVUDATA    6
  214. #define T_RCVUDERR    7
  215. #define T_CONNECT1    8
  216. #define T_CONNECT2    9
  217. #define T_RCVCONNECT    10
  218. #define T_LISTN        11
  219. #define T_ACCEPT1    12
  220. #define T_ACCEPT2    13
  221. #define    T_ACCEPT3    14
  222. #define T_SND        15
  223. #define T_RCV        16
  224. #define T_SNDDIS1    17
  225. #define T_SNDDIS2    18
  226. #define T_RCVDIS1    19
  227. #define T_RCVDIS2    20
  228. #define T_RCVDIS3    21
  229. #define T_SNDREL    22
  230. #define T_RCVREL    23
  231. #define T_PASSCON    24
  232.  
  233. #define T_NOEVENTS    25
  234.  
  235. #define nvs     127     /* not a valid state change */
  236.  
  237. extern char tiusr_statetbl[T_NOEVENTS][T_NOSTATES];
  238.  
  239. /* macro to change state */
  240. /* TLI_NEXTSTATE(event, current state) */
  241. #define TLI_NEXTSTATE(X,Y)    tiusr_statetbl[X][Y]
  242.  
  243.