home *** CD-ROM | disk | FTP | other *** search
/ IBM Presents OS/2 Software Hits 1995 / OS-2_SW_HITS_2ND_EDITION_1995.ISO / i17 / tliws1.exe / H / TIUSER.H < prev   
C/C++ Source or Header  |  1994-01-20  |  12KB  |  452 lines

  1. /** Copyright (c) 1989  Mentat Inc.
  2.  **/
  3.  
  4. /****************************************************************************
  5. *                                                                           *
  6. * (C) Unpublished Copyright of Novell, Inc. All Rights Reserved             *
  7. *                                                                           *
  8. *  No part of this file may be duplicayed, revised, translated, localized   *
  9. *  or modified in any manner or compiled, linked or uploaded or downloaded  *
  10. *  to or from any computer system without the prior written consent of      *
  11. *  Novell, Inc.                                                             *
  12. *                                                                           *
  13. *****************************************************************************/
  14.  
  15. #ifndef _TIUSER_
  16. #define _TIUSER_
  17.  
  18. /*
  19.  *   OS Specific Definitions
  20.  */
  21.  
  22. /*  ---------- DOS Specific definitions */
  23.  
  24. #ifdef NWDOS
  25.  
  26. #ifndef FAR
  27. #define FAR
  28. #endif
  29.  
  30. #ifndef API
  31. #define API
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. extern  int        t_errno;
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41.  
  42. #endif /* NWDOS */
  43.  
  44. /*  ---------- OS/2 Specific definitions */
  45.  
  46. #ifdef NWOS2
  47.  
  48. #ifndef FAR
  49. #define FAR _far
  50. #endif
  51.  
  52. #ifndef API
  53. #define API pascal _far _loadds
  54. #endif
  55.  
  56. #ifdef __cplusplus
  57. extern "C" {
  58. #endif
  59. #define t_errno (*terrno_func()) 
  60. extern int _far * API terrno_func(void);
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64.  
  65. #define MAX_TLI_CONNECTIONS 40
  66.  
  67. #endif /* NWOS2 */
  68.  
  69. /*  ---------- Windows Specific definitions */
  70.  
  71. #ifdef NWWIN
  72.  
  73. #ifndef FAR
  74. #define FAR far
  75. #endif
  76.  
  77. #ifndef API
  78. #define PASCAL pascal
  79. #define API PASCAL FAR
  80. #endif
  81.  
  82. #ifdef __cplusplus
  83. extern "C" {
  84. #endif
  85. #define t_errno (*terrno_func()) 
  86. extern int far * API terrno_func(void);
  87. #ifdef __cplusplus
  88. }
  89. #endif
  90.  
  91. #define MAX_TLI_CONNECTIONS 40
  92.  
  93. /*
  94.  *   O_RDWR is defined as different values for various compilers.
  95.  *   The compiler used in the TLI DLLs use the following value.
  96.  *   This value must be used in any program interfacing with TLI.
  97.  */
  98. #define O_RDWR 0x02
  99.  
  100. #endif /* NWWIN */
  101.  
  102. /*
  103.  *   End  of OS Specific Definitions
  104.  */
  105.  
  106. #ifndef O_NONBLOCK
  107. #define O_NDELAY     0x4000
  108. #define O_NONBLOCK   O_NDELAY
  109. #endif
  110.  
  111. #ifndef EAGAIN
  112. #define EAGAIN  -1
  113. #endif
  114.  
  115. /* Error values */
  116.  
  117. #define TBADADDR      1
  118. #define TBADOPT       2
  119. #define TACCES        3
  120. #define TBADF         4
  121. #define TNOADDR       5
  122. #define TOUTSTATE     6
  123. #define TBADSEQ       7
  124. #define TSYSERR       8
  125. #define TLOOK         9
  126. #define TBADDATA     10
  127. #define TBUFOVFLW    11
  128. #define TFLOW        12
  129. #define TNODATA      13
  130. #define TNODIS       14
  131. #define TNOUDERR     15
  132. #define TBADFLAG     16
  133. #define TNOREL       17
  134. #define TNOTSUPPORT  18
  135. #define TSTATECHNG   19
  136. #define TNOSTRUCTYPE 20
  137. #define TBADNAME     21
  138. #define TBADQLEN     22
  139. #define TADDRBUSY    23
  140.  
  141. /* t_look events */
  142.  
  143. #define T_LISTEN      0x0001
  144. #define T_CONNECT     0x0002
  145. #define T_DATA        0x0004
  146. #define T_EXDATA      0x0008
  147. #define T_DISCONNECT  0x0010
  148. #define T_UDERR       0x0040
  149. #define T_ORDREL      0x0080
  150. #define T_GODATA      0x0100
  151. #define T_GOEXDATA    0x0200
  152. #define T_EVENTS      0x0400
  153. #define T_ERROR       0x0500   /* Netware.tli specific t_look event */
  154.  
  155. /* Flag definitions */
  156.  
  157. #define T_MORE         0x01
  158. #define T_EXPEDITED    0x02
  159. #define T_NEGOTIATE    0x04
  160. #define T_CHECK        0x08
  161. #define T_DEFAULT      0x10
  162. #define T_SUCCESS      0x20
  163. #define T_FAILURE      0x40
  164.  
  165. /*   T_event flag values */
  166.  
  167. #define T_DISABLE      0
  168. #define T_ENABLE       1
  169. #define T_SAME         2
  170.  
  171. extern  char FAR  *t_errlist[];
  172. extern  int        t_nerr;
  173.  
  174.  
  175. struct t_info {
  176.     long    addr;
  177.     long    options;
  178.     long    tsdu;
  179.     long    etsdu;
  180.     long    connect;
  181.     long    discon;
  182.     long    servtype;
  183. };
  184.  
  185. /* Service types */
  186.  
  187. #define T_COTS        01    /* Connection-mode service */
  188. #define T_COTS_ORD    02    /* Connection service with orderly release */
  189. #define T_CLTS        03    /* Connectionless-mode service */
  190.  
  191.  
  192. struct netbuf {
  193.     unsigned int    maxlen;
  194.     unsigned int    len;
  195.     char    FAR    *buf;
  196. };
  197.  
  198. struct t_bind {
  199.     struct netbuf    addr;
  200.     unsigned         qlen;
  201. };
  202.  
  203. struct t_optmgmt {
  204.     struct netbuf    opt;
  205.     long             flags;
  206. };
  207.  
  208. struct t_discon {
  209.     struct netbuf    udata;
  210.     int              reason;
  211.     int              sequence;
  212. };
  213.  
  214. struct t_call {
  215.     struct netbuf    addr;
  216.     struct netbuf    opt;
  217.     struct netbuf    udata;
  218.     int              sequence;
  219. };
  220.  
  221. struct t_unitdata {
  222.     struct netbuf    addr;
  223.     struct netbuf    opt;
  224.     struct netbuf    udata;
  225. };
  226.  
  227. struct t_uderr {
  228.     struct netbuf    addr;
  229.     struct netbuf    opt;
  230.     long             error;
  231. };
  232.  
  233. /* t_alloc structure types */
  234.  
  235. #define T_BIND_STR       1
  236. #define T_OPTMGMT_STR    2
  237. #define T_CALL_STR       3
  238. #define T_DIS_STR        4
  239. #define T_UNITDATA_STR   5
  240. #define T_UDERROR_STR    6
  241. #define T_INFO_STR       7
  242.  
  243. /* t_alloc field identifiers */
  244.  
  245. #define T_ADDR   0x01
  246. #define T_OPT    0x02
  247. #define T_UDATA  0x04
  248.  
  249. /* #define T_ALL   0x07     */
  250. #define T_ALL    0x08  /* modified to suit netware.tli */
  251.  
  252. /* redefine t_alloc types to suit AT&T specs */
  253.  
  254. #define T_BIND      T_BIND_STR
  255. #define T_CALL      T_CALL_STR
  256. #define T_OPTMGMT   T_OPTMGMT_STR
  257. #define T_DIS       T_DIS_STR
  258. #define T_UNITDATA  T_UNITDATA_STR
  259. #define T_UDERROR   T_UDERROR_STR
  260. #define T_INFO      T_INFO_STR
  261.  
  262.  
  263. /* State values */
  264.  
  265. #define T_UNINIT    0    /* added to match xti state tables */
  266. #define T_UNBND     1    /* unbound */
  267. #define T_IDLE      2    /* idle */
  268. #define T_OUTCON    3    /* outgoing connection pending */
  269. #define T_INCON     4    /* incoming connection pending */
  270. #define T_DATAXFER  5    /* data transfer */
  271. #define T_OUTREL    6    /* outgoing orderly release */
  272. #define T_INREL     7    /* incoming orderly release */
  273.  
  274. /* general purpose defines */
  275. #define T_YES      1
  276. #define T_NO       0
  277. #define T_UNUSED  -1
  278. #define T_NULL     0
  279. #define T_ABSREQ   0x8000
  280.  
  281.  
  282. /* ------------------------OSI specific Options-------------------------*/
  283.  
  284. /* ISO definitions */
  285.  
  286. #define T_CLASS0    0
  287. #define T_CLASS1    1
  288. #define T_CLASS2    2
  289. #define T_CLASS3    3
  290. #define T_CLASS4    4
  291.  
  292. /* priorities */
  293.  
  294. #define T_PRITOP   0
  295. #define T_PRIHIGH  1
  296. #define T_PRIMID   2
  297. #define T_PRILOW   3
  298. #define T_PRIDFLT  4
  299.  
  300. /* protection levels */
  301.  
  302. #define T_NOPROTECT       1
  303. #define T_PASSIVEPROTECT  2
  304. #define T_ACTIVEPROTECT   4
  305.  
  306. /* default value for the length of TPDU's */
  307.  
  308. #define T_LTPDUDFLT  128
  309.  
  310. /* rate structure */
  311.  
  312. struct rate {
  313.     long    targetvalue;
  314.     long    minacceptvalue;
  315. };
  316.  
  317. /* reqvalue structure */
  318.  
  319. struct reqvalue {
  320.     struct rate    called;
  321.     struct rate    calling;
  322. };
  323.  
  324. /* throughput structure */
  325.  
  326. struct thrpt {
  327.     struct reqvalue    maxthrpt;
  328.     struct reqvalue    avgthrpt;
  329. };
  330.  
  331. /* management structure */
  332.  
  333. struct management {
  334.     short  dflt;       /* T_YES to use default values or T_NO to use values in structure */
  335.     int    ltpdu;      /* maximum length of TPDU */
  336.     short  reastime;   /* reassignment time (in seconds) */
  337.     char   prefclass;  /* preferred class */
  338.     char   altclass;   /* alternative class */
  339.     char   extform;    /* extended format: T_YES or T_NO */
  340.     char   flowctrl;   /* flow control: T_YES or T_NO */
  341.     char   checksum;
  342.     char   netexp;     /* network expedited data */
  343.     char   netrecptcf; /* receipt confirmation */
  344. };
  345.  
  346. /* ISO connection-oriented options */
  347.  
  348. struct isoco_options {
  349.     struct thrpt      throughput;
  350.     struct reqvalue   transdel;       /* transit delay */
  351.     struct rate       reserrorrate;   /* residual error rate */
  352.     struct rate       transffailprob; /* transfer failure problem */
  353.     struct rate       estfailprob;    /* connection establishment failure problem */
  354.     struct rate       relfailprob;    /* connection release failure problem */
  355.     struct rate       estdelay;       /* connection establishment delay */
  356.     struct rate       reldelay;       /* connection release delay */
  357.     struct netbuf     connresil;      /* connection resilience */
  358.     unsigned short    protection;
  359.     short             priority;
  360.     struct management mngmt;          /* management parameters */
  361.     char              expd;           /* expedited data: T_YES or T_NO */
  362. };
  363.  
  364. /* ISO connectionless options */
  365.  
  366. struct isocl_options {
  367.     struct rate     transdel;     /* transit delay */
  368.     struct rate     reserrorrate; /* residual error rate */
  369.     unsigned short  protection;
  370.     short           priority;
  371. };
  372.  
  373. /*---------------------TCP specific Options--------------------------*/
  374.  
  375. /* TCP Precedence Levels */
  376.  
  377. #define T_ROUTINE       0
  378. #define T_PRIORITY      1
  379. #define T_IMMEDIATE     2
  380. #define T_FLASH         3
  381. #define T_OVERRIDEFLASH 4
  382. #define T_CRITIC_ECP    5
  383. #define T_INETCONTROL   6
  384. #define T_NETCONTROL    7
  385.  
  386. /* TCP security options structure */
  387.  
  388. struct secoptions {
  389.     short    security;
  390.     short    compartment;
  391.     short    handling;    /* handling restrictions */
  392.     long     tcc;         /* transmission control code */
  393. };
  394.  
  395. /* TCP options */
  396.  
  397. struct tcp_options {
  398.     short             precedence;
  399.     long              timeout;       /* abort timeout */
  400.     long              max_seg_size;
  401.     struct secoptions secopt;        /* security options */
  402. };
  403.  
  404. /*----------------------SPX\IPX specific Options-----------------------*/
  405.  
  406. #include     <tispxipx.h>
  407.  
  408. /*---------------------end of Options---------------------------------*/
  409.  
  410. #ifndef    NO_PROTOTYPES
  411.  
  412. #ifdef __cplusplus
  413. extern "C" {
  414. #endif
  415.  
  416. extern int  API t_accept ( int fd, int resfd, struct t_call FAR * call );
  417. extern char FAR * API t_alloc ( int fd, int struct_type, int fields );
  418. extern int  API t_bind ( int fd, struct t_bind FAR * req, struct t_bind FAR * ret );
  419. extern int  API t_blocking( int fd );
  420. extern int  API t_close ( int fd );
  421. extern int  API t_connect ( int fd, struct t_call FAR * sndcall, struct t_call FAR * rcvcall );
  422. extern void API t_error ( char FAR * errmsg );
  423. extern int  API t_free ( char FAR * ptr, int struct_type );
  424. extern int  API t_getinfo ( int fd, struct t_info FAR * info );
  425. extern int  API t_getstate ( int fd );
  426. extern int  API t_listen ( int fd, struct t_call FAR * call );
  427. extern int  API t_look ( int fd );
  428. extern int  API t_nonblocking( int fd );
  429. extern int  API t_open ( char FAR * path, int oflag, struct t_info FAR * info );
  430. extern int  API t_optmgmt ( int fd, struct t_optmgmt FAR * req, struct t_optmgmt FAR * ret );
  431. extern int  API t_rcv ( int fd, char FAR * buf, unsigned nbytes, int FAR * flags );
  432. extern int  API t_rcvconnect ( int fd, struct t_call FAR * call );
  433. extern int  API t_rcvdis ( int fd, struct t_discon FAR * discon );
  434. extern int  API t_rcvrel ( int fd );
  435. extern int  API t_rcvudata ( int fd, struct t_unitdata FAR * unitdata, int FAR * flags );
  436. extern int  API t_rcvuderr ( int fd, struct t_uderr FAR * uderr );
  437. extern int  API t_snd ( int fd, char FAR * buf, unsigned nbytes, int flags );
  438. extern int  API t_snddis ( int fd, struct t_call FAR * call );
  439. extern int  API t_sndrel ( int fd );
  440. extern int  API t_sndudata ( int fd, struct t_unitdata FAR * unitdata );
  441. extern int  API t_sync( int fd );
  442. extern int  API t_unbind( int fd );
  443.  
  444. #ifdef __cplusplus
  445. }
  446. #endif
  447.  
  448. #endif   /* ifdef prototypes */
  449.  
  450.  
  451. #endif    /* ifdef _TIUSER */
  452.