home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 9.ddi / usr / include / sys / tiuser.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  6.9 KB  |  254 lines

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