home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / UNIX3862.ZIP / U386-06.ZIP / U386-6.TD0 / usr / include / sys / tiuser.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-06-26  |  6.5 KB  |  236 lines

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