home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 5 Developer's Kit / vb5 dev kit.iso / dev / tcp4w20 / tcp4w.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-10  |  6.2 KB  |  138 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  2. /*                                                                 */
  3. /*                                                                 */
  4. /*                                                                 */
  5. /*   TCP4W.DLL  (Version 2.01)                                     */
  6. /*                                                                 */
  7. /*                                                                 */
  8. /*                                                   By Ph. Jounin */
  9. /*                                        Internet ark@ifh.sncf.fr */
  10. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  11.  
  12.  
  13. #ifndef _TCP4W_API_
  14.  
  15. #include <winsock.h>
  16.  
  17. #ifdef __cplusplus  
  18. extern "C" {            /* Assume C declarations for C++ */   
  19. #endif  /* __cplusplus */   
  20.  
  21. #ifndef API4W
  22. #  define API4W PASCAL FAR 
  23. #endif
  24.  
  25. /* ------------------------------- */
  26. /* Return codes of TCP4W functions */
  27. /* ------------------------------- */
  28.  
  29. #define  TCP4U_SUCCESS           1  /* >=1 function OK            */
  30. #define  TCP4U_ERROR            -1  /* error                      */
  31. #define  TCP4U_TIMEOUT          -2  /* timeout has occured        */
  32. #define  TCP4U_BUFFERFREED      -3  /* the buffer has been freed  */
  33. #define  TCP4U_HOSTUNKNOWN      -4  /* connect to unknown host    */
  34. #define  TCP4U_NOMORESOCKET     -5  /* all socket has been used   */
  35. #define  TCP4U_NOMORERESOURCE   -5  /* or no more free resource   */
  36. #define  TCP4U_CONNECTFAILED    -6  /* connect function has failed*/
  37. #define  TCP4U_UNMATCHEDLENGTH  -7  /* TcpPPRecv : Error in length*/
  38. #define  TCP4U_BINDERROR        -8  /* bind failed (Task already started?) */
  39. #define  TCP4U_OVERFLOW         -9  /* Overflow during TcpPPRecv  */
  40. #define  TCP4U_EMPTYBUFFER     -10  /* TcpPPRecv receives 0 byte  */
  41. #define  TCP4U_CANCELLED       -11  /* Call cancelled by signal   */
  42. #define  TCP4U_INSMEMORY       -12  /* Not enough memory          */
  43. #define  TCP4U_SOCKETCLOSED      0  /* Host has closed connection */
  44.  
  45.  
  46. /* ------------------------------ */
  47. /* Return codes of TN4W functions */
  48. /* ------------------------------ */
  49. #define  TN_SUCCESS        TCP4U_SUCCESS
  50. #define  TN_ERROR          TCP4U_ERROR         
  51. #define  TN_TIMEOUT        TCP4U_TIMEOUT       
  52. #define  TN_BUFFERFREED    TCP4U_BUFFERFREED   
  53. #define  TN_SOCKETCLOSED   TCP4U_SOCKETCLOSED
  54. #define  TN_OVERFLOW       2
  55.  
  56.  
  57.  
  58. /* ------------------------------------------------- */
  59. /* Registration functions                            */   
  60. /* ------------------------------------------------- */
  61. int   API4W Tcp4uInit (void);
  62. int   API4W Tcp4uCleanup (void);
  63. int   API4W Tcp4uVer (LPSTR szInfo, UINT uBufSize);
  64. LPSTR API4W Tcp4uErrorString (int Rc);
  65.  
  66.  
  67. /* ------------------------------------------------- */
  68. /* TCP functions                                     */   
  69. /* ------------------------------------------------- */
  70. int API4W TcpAbort (void);
  71. int API4W TcpAccept (SOCKET far *pCSock, SOCKET ListenSock, UINT nTO);
  72. int API4W TcpConnect (SOCKET far *pS, LPSTR szServer, LPSTR szService, 
  73.                       unsigned short far *lpPort);
  74. int API4W TcpClose (SOCKET far *pS);
  75. int API4W TcpFlush (SOCKET s);
  76. int API4W TcpGetListenSocket (SOCKET far *pS, LPSTR szService, 
  77.                           unsigned short far *lpPort, int nPendingConnection);
  78. int API4W TcpRecv (SOCKET s, LPSTR szBuf, unsigned uBufSize, unsigned uTimeOut, HFILE hf);
  79. int API4W TcpSend (SOCKET s, LPSTR szBuf, unsigned uBufSize, BOOL bHighPriority, HFILE hf);
  80.  
  81. int API4W TcpGetLocalID (LPSTR szStrName, int uNameSize, DWORD far *lpAddress);
  82. int API4W TcpGetRemoteID (SOCKET s, LPSTR szStrName, int uNameSize, DWORD far *lpAddress);
  83. BOOL API4W TcpIsDataAvail (SOCKET s);
  84. BOOL API4W TcpIsOOBDataAvail (SOCKET s);
  85.  
  86. /* PP protocole (2 first bytes contain length of data) */
  87. int API4W TcpPPRecv (SOCKET s, LPSTR szBuf, unsigned uBufSize, unsigned uTimeOut, BOOL bExact, HFILE hLogFile);
  88. int API4W TcpPPSend (SOCKET s, LPSTR szBuf, unsigned uBufSize, HFILE hLogFile);
  89.  
  90. int API4W TcpRecvUntilStr (SOCKET s, LPSTR szBuf,unsigned far *lpBufSize,
  91.                           LPSTR szStop, unsigned uStopSize, BOOL bCaseSensitive,
  92.                           unsigned uTimeOut, HFILE hLogFile);
  93.    
  94. /* ------------------------------------------------- */
  95. /* Telnet functions                                  */   
  96. /* ------------------------------------------------- */
  97. int API4W TnReadLine (SOCKET s, LPSTR szBuf, UINT BufSize, UINT uTimeOut, HFILE hf);
  98. int API4W TnSend (SOCKET s, LPSTR szString, BOOL bHighPriority, HFILE hf);
  99. int API4W TnGetAnswerCode(SOCKET ctrl_skt,LPSTR szInBuf,UINT uBufSize,UINT uTimeOut, HFILE hf);
  100.  
  101.  
  102.  
  103. /* ------------------------------------------------- */
  104. /* Old declarations, compatibility with version 1.5  */
  105. /* ------------------------------------------------- */
  106.  
  107. #define  IP_SUCCESS           1  /* >=1 function OK            */
  108. #define  IP_ERROR            -1  /* error                      */
  109. #define  IP_TIMEOUT          -2  /* timeout has occured        */
  110. #define  IP_BUFFERFREED      -3  /* the buffer has been freed  */
  111. #define  IP_HOSTUNKNOWN      -4  /* connect to unknown host    */
  112. #define  IP_NOMORESOCKET     -5  /* all socket has been used   */
  113. #define  IP_NOMORERESOURCE   -5  /* or no more free resource   */
  114. #define  IP_CONNECTFAILED    -6  /* connect function has failed*/
  115. #define  IP_UNMATCHEDLENGTH  -7  /* TcpPPRecv : Error in length*/
  116. #define  IP_BINDERROR        -8  /* bind failed (Task already started?) */
  117. #define  IP_OVERFLOW         -9  /* Overflow during TcpPPRecv  */
  118. #define  IP_EMPTYBUFFER     -10  /* TcpPPRecv receives 0 byte  */
  119. #define  IP_CANCELLED       -11  /* Call cancelled by TcpAbort */
  120. #define  IP_INSMEMORY       -12  /* Not enough memory          */
  121. #define  IP_SOCKETCLOSED      0  /* Host has close connection  */
  122.  
  123.  
  124. int   API4W Tcp4wInit (void);
  125. int   API4W Tcp4wCleanup (void);
  126. int   API4W Tcp4wVer (LPSTR szInfo, UINT uBufSize);
  127. LPSTR API4W Tcp4wErrorString (int Rc);
  128.  
  129.  
  130.  
  131. #ifdef __cplusplus     
  132. }  /* End of extern "C" */   
  133. #endif /* ifdef __cplusplus */
  134.  
  135. #define _TCPW_API_ loaded
  136. #endif /* ifndef TCP4W_API */
  137.  
  138.