home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 September / CHIP_CD_1997_09_PL.iso / software / testsoft / labwind / demo.6 / main / include / tcpsupp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-02  |  2.8 KB  |  79 lines

  1. /*============================================================================*/
  2. /*                        L a b W i n d o w s / C V I                         */
  3. /*----------------------------------------------------------------------------*/
  4. /*    Copyright (c) National Instruments 1987-1996.  All Rights Reserved.     */
  5. /*----------------------------------------------------------------------------*/
  6. /*                                                                            */
  7. /* Title:       tcpsupp.h                                                     */
  8. /* Purpose:     Include file for TCP/IP protocol support library.             */
  9. /*                                                                            */
  10. /*============================================================================*/
  11.  
  12. #ifndef TCPSUPP_HEADER
  13. #define TCPSUPP_HEADER
  14.  
  15. #include "cvidef.h"
  16. #include "cvirte.h"
  17.  
  18. #ifdef __cplusplus
  19.     extern "C" {
  20. #endif
  21.  
  22. /* constants */
  23.  
  24. #define     TCP_CONNECT       1
  25. #define     TCP_DISCONNECT    2
  26. #define     TCP_DATAREADY     3
  27.  
  28.  
  29. /* enumerated errors */
  30.  
  31. enum tcpError {
  32.     kTCP_NoError,
  33.     kTCP_UnableToRegisterService,
  34.     kTCP_UnableToEstablishConnection,
  35.     kTCP_ExistingServer,
  36.     kTCP_FailedToConnect,
  37.     kTCP_ServerNotRegistered,
  38.     kTCP_TooManyConnections,
  39.     kTCP_ReadFailed,
  40.     kTCP_WriteFailed,
  41.     kTCP_InvalidParameter,
  42.     kTCP_OutOfMemory,
  43.     kTCP_TimeOutErr,
  44.     kTCP_NoConnectionEstablished,
  45.     kTCP_GeneralIOErr,
  46.     kTCP_ConnectionClosed,
  47.     kTCP_UnableToLoadWinsockDLL,
  48.     kTCP_IncorrectWinsockDLLVersion,
  49.     kTCP_NetworkSubsystemNotReady,
  50.     kTCP_ConnectionsStillOpen
  51. };
  52.  
  53.  
  54.  
  55. /* type definitions */
  56.  
  57. typedef int (CVICALLBACK * tcpFuncPtr)(unsigned handle, int xType, int errCode, void *callbackData);
  58.  
  59. /* exported functions */
  60.  
  61. int CVIFUNC ClientTCPRead(unsigned convHandle, void *dataBuffer, unsigned dataSize, unsigned timeOut);
  62. int CVIFUNC ClientTCPWrite(unsigned convHandle, const void *userData, unsigned dataSize, unsigned timeOut);
  63. int CVIFUNC ConnectToTCPServer(unsigned *convHandle, unsigned portNumber, const char servHostName[],
  64.                      tcpFuncPtr pUserCallback, void *callbackData, unsigned timeOut);
  65. int CVIFUNC DisconnectFromTCPServer(unsigned convHandle);
  66. int CVIFUNC RegisterTCPServer(unsigned portNumber, tcpFuncPtr pUserCallback, void *callbackData);
  67. int CVIFUNC ServerTCPRead(unsigned convHandle, void *dataBuffer, unsigned dataSize, unsigned timeOut);
  68. int CVIFUNC ServerTCPWrite(unsigned convHandle, const void *userData, unsigned dataSize, unsigned timeOut);
  69. int CVIFUNC DisconnectTCPClient(unsigned convHandle);
  70. int CVIFUNC UnregisterTCPServer(unsigned portNumber);
  71. int CVIFUNC CloseWinsock(int unloadDLL);
  72. char * CVIFUNC GetTCPErrorString(int errorNum);
  73.  
  74. #ifdef __cplusplus
  75.     extern "C" {
  76. #endif
  77.  
  78. #endif /* TCPSUPP_HEADER */
  79.