home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 April / PCWorld_2008-04_cd.bin / temacd / devc++ / devcpp-4.9.9.2_setup.exe / ws2spi.h < prev    next >
C/C++ Source or Header  |  2005-01-29  |  9KB  |  201 lines

  1. /*
  2.  * ws2spi.h
  3.  *
  4.  * Winsock 2 Service Provider interface.
  5.  *
  6.  *
  7.  * THIS SOFTWARE IS NOT COPYRIGHTED
  8.  *
  9.  * This source code is offered for use in the public domain. You may
  10.  * use, modify or distribute it freely.
  11.  *
  12.  * This code is distributed in the hope that it will be useful but
  13.  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
  14.  * DISCLAIMED. This includes but is not limited to warranties of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16.  *
  17.  */
  18. #ifndef _WS2SPI_H
  19. #define _WS2SPI_H
  20.  
  21. #include <winsock2.h>
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif /* __cplusplus */
  26.  
  27. #define WSPAPI WSAAPI
  28. #define WSPDESCRIPTION_LEN 255
  29.  
  30. #ifndef RC_INVOKED
  31.  
  32. typedef struct WSPData {
  33.     WORD wVersion;
  34.     WORD wHighVersion;
  35.     WCHAR szDescription[WSPDESCRIPTION_LEN+1];
  36. } WSPDATA, FAR *LPWSPDATA;
  37. typedef struct _WSATHREADID {
  38.     HANDLE ThreadHandle;
  39.     DWORD Reserved;
  40. } WSATHREADID, FAR *LPWSATHREADID;
  41.  
  42. typedef BOOL (CALLBACK FAR *LPBLOCKINGCALLBACK)(DWORD);
  43. typedef VOID (CALLBACK FAR *LPWSAUSERAPC)(DWORD);
  44.  
  45. /* Prototypes for service provider procedure table */
  46. typedef SOCKET (WSPAPI *LPWSPACCEPT)(SOCKET,LPSOCKADDR,LPINT,LPCONDITIONPROC,DWORD,LPINT);
  47. typedef INT (WSPAPI *LPWSPADDRESSTOSTRING)(LPSOCKADDR,DWORD,LPWSAPROTOCOL_INFOW,LPWSTR,LPDWORD,LPINT);
  48. typedef INT (WSPAPI *LPWSPASYNCSELECT)(SOCKET,HWND,UINT,LONG,LPINT);
  49. typedef INT (WSPAPI *LPWSPBIND)(SOCKET,const struct sockaddr*,INT,LPINT);
  50. typedef INT (WSPAPI *LPWSPCANCELBLOCKINGCALL)(LPINT);
  51. typedef INT (WSPAPI *LPWSPCLEANUP)(LPINT);
  52. typedef INT (WSPAPI *LPWSPCLOSESOCKET)(SOCKET,LPINT);
  53. typedef INT (WSPAPI *LPWSPCONNECT)(SOCKET,const struct sockaddr*,INT,LPWSABUF,LPWSABUF,LPQOS,LPQOS,LPINT);
  54. typedef INT (WSPAPI *LPWSPDUPLICATESOCKET)(SOCKET,DWORD,LPWSAPROTOCOL_INFOW,LPINT);
  55. typedef INT (WSPAPI *LPWSPENUMNETWORKEVENTS)(SOCKET,WSAEVENT,LPWSANETWORKEVENTS,LPINT);
  56. typedef INT (WSPAPI *LPWSPEVENTSELECT)(SOCKET,WSAEVENT,LONG,LPINT);
  57. typedef BOOL (WSPAPI *LPWSPGETOVERLAPPEDRESULT)(SOCKET,LPWSAOVERLAPPED,LPDWORD,BOOL,LPDWORD,LPINT);
  58. typedef INT (WSPAPI *LPWSPGETPEERNAME)(SOCKET,LPSOCKADDR,LPINT,LPINT);
  59. typedef BOOL (WSPAPI *LPWSPGETQOSBYNAME)(SOCKET,LPWSABUF,LPQOS,LPINT);
  60. typedef INT (WSPAPI *LPWSPGETSOCKNAME)(SOCKET,LPSOCKADDR,LPINT,LPINT);
  61. typedef INT (WSPAPI *LPWSPGETSOCKOPT)(SOCKET,INT,INT,CHAR FAR*,LPINT,LPINT);
  62. typedef INT (WSPAPI *LPWSPIOCTL)(SOCKET,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,
  63.          LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE,LPWSATHREADID,LPINT);
  64. typedef SOCKET (WSPAPI *LPWSPJOINLEAF)(SOCKET,const struct sockaddr*,INT,LPWSABUF,LPWSABUF,LPQOS,LPQOS,DWORD,LPINT);
  65. typedef INT (WSPAPI *LPWSPLISTEN)(SOCKET,INT,LPINT);
  66. typedef INT (WSPAPI *LPWSPRECV)(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,
  67. LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE,LPWSATHREADID,LPINT);
  68. typedef INT (WSPAPI *LPWSPRECVDISCONNECT)(SOCKET,LPWSABUF,LPINT);
  69. typedef INT (WSPAPI *LPWSPRECVFROM)(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,LPSOCKADDR,
  70. LPINT,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE,LPWSATHREADID,LPINT);
  71. typedef INT (WSPAPI *LPWSPSELECT)(INT,LPFD_SET,LPFD_SET,LPFD_SET,CONST TIMEVAL*,LPINT);
  72. typedef INT (WSPAPI *LPWSPSEND)(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,
  73. LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE,LPWSATHREADID,LPINT);
  74. typedef INT (WSPAPI *LPWSPSENDDISCONNECT)(SOCKET,LPWSABUF,LPINT);
  75. typedef INT (WSPAPI *LPWSPSENDTO)(SOCKET,LPWSABUF,DWORD,LPDWORD,DWORD,const struct sockaddr*,
  76.          INT,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE,LPWSATHREADID,LPINT);
  77. typedef INT (WSPAPI *LPWSPSETSOCKOPT)(SOCKET,INT,INT,CONST CHAR FAR*,INT,LPINT);
  78. typedef INT (WSPAPI *LPWSPSHUTDOWN)(SOCKET,INT,LPINT);
  79. typedef SOCKET (WSPAPI *LPWSPSOCKET)(INT,INT,INT,LPWSAPROTOCOL_INFOW,GROUP,DWORD,LPINT);
  80. typedef INT (WSPAPI *LPWSPSTRINGTOADDRESS)(LPWSTR,INT,LPWSAPROTOCOL_INFOW,LPSOCKADDR,LPINT,LPINT);
  81.  
  82. /* Service provider procedure table */
  83. typedef struct _WSPPROC_TABLE {
  84.   LPWSPACCEPT lpWSPAccept;
  85.   LPWSPADDRESSTOSTRING lpWSPAddressToString;
  86.   LPWSPASYNCSELECT lpWSPAsyncSelect;
  87.   LPWSPBIND lpWSPBind;
  88.   LPWSPCANCELBLOCKINGCALL lpWSPCancelBlockingCall;
  89.   LPWSPCLEANUP lpWSPCleanup;
  90.   LPWSPCLOSESOCKET lpWSPCloseSocket;
  91.   LPWSPCONNECT lpWSPConnect;
  92.   LPWSPDUPLICATESOCKET lpWSPDuplicateSocket;
  93.   LPWSPENUMNETWORKEVENTS lpWSPEnumNetworkEvents;
  94.   LPWSPEVENTSELECT lpWSPEventSelect;
  95.   LPWSPGETOVERLAPPEDRESULT lpWSPGetOverlappedResult;
  96.   LPWSPGETPEERNAME lpWSPGetPeerName;
  97.   LPWSPGETSOCKNAME lpWSPGetSockName;
  98.   LPWSPGETSOCKOPT lpWSPGetSockOpt;
  99.   LPWSPGETQOSBYNAME lpWSPGetQOSByName;
  100.   LPWSPIOCTL lpWSPIoctl;
  101.   LPWSPJOINLEAF lpWSPJoinLeaf;
  102.   LPWSPLISTEN lpWSPListen;
  103.   LPWSPRECV lpWSPRecv;
  104.   LPWSPRECVDISCONNECT lpWSPRecvDisconnect;
  105.   LPWSPRECVFROM lpWSPRecvFrom;
  106.   LPWSPSELECT lpWSPSelect;
  107.   LPWSPSEND lpWSPSend;
  108.   LPWSPSENDDISCONNECT lpWSPSendDisconnect;
  109.   LPWSPSENDTO lpWSPSendTo;
  110.   LPWSPSETSOCKOPT lpWSPSetSockOpt;
  111.   LPWSPSHUTDOWN lpWSPShutdown;
  112.   LPWSPSOCKET lpWSPSocket;
  113.   LPWSPSTRINGTOADDRESS lpWSPStringToAddress;
  114. } WSPPROC_TABLE, FAR* LPWSPPROC_TABLE;
  115.  
  116. /* Prototypes for service provider upcall procedure table */
  117. typedef BOOL (WSPAPI *LPWPUCLOSEEVENT)(WSAEVENT,LPINT);
  118. typedef INT (WSPAPI *LPWPUCLOSESOCKETHANDLE)(SOCKET,LPINT);
  119. typedef INT (WSPAPI *LPWPUCLOSETHREAD)(LPWSATHREADID,LPINT);
  120. typedef WSAEVENT (WSPAPI *LPWPUCREATEEVENT)(LPINT);
  121. typedef SOCKET (WSPAPI *LPWPUCREATESOCKETHANDLE)(DWORD,DWORD,LPINT);
  122. typedef SOCKET (WSPAPI *LPWPUFDISSET)(SOCKET,LPFD_SET);
  123. typedef INT (WSPAPI *LPWPUGETPROVIDERPATH)(LPGUID,LPWSTR,LPINT,LPINT);
  124. typedef SOCKET (WSPAPI *LPWPUMODIFYIFSHANDLE)(DWORD,SOCKET,LPINT);
  125. typedef INT (WSPAPI *LPWPUOPENCURRENTTHREAD)(LPWSATHREADID,LPINT);
  126. typedef BOOL (WSPAPI *LPWPUPOSTMESSAGE)(HWND,UINT,WPARAM,LPARAM);
  127. typedef INT (WSPAPI *LPWPUQUERYBLOCKINGCALLBACK)(DWORD,LPBLOCKINGCALLBACK FAR*,LPDWORD,LPINT);
  128. typedef INT (WSPAPI *LPWPUQUERYSOCKETHANDLECONTEXT)(SOCKET,LPDWORD,LPINT);
  129. typedef INT (WSPAPI *LPWPUQUEUEAPC)(LPWSATHREADID,LPWSAUSERAPC,DWORD,LPINT);
  130. typedef BOOL (WSPAPI *LPWPURESETEVENT)(WSAEVENT,LPINT);
  131. typedef BOOL (WSPAPI *LPWPUSETEVENT)(WSAEVENT,LPINT);
  132. /* Available only directly from the DLL */
  133. typedef INT (WSPAPI *LPWPUCOMPLETEOVERLAPPEDREQUEST)(SOCKET,LPWSAOVERLAPPED,DWORD,DWORD,LPINT);
  134.  
  135. /* Service Provider upcall table */
  136. typedef struct _WSPUPCALLTABLE {
  137.     LPWPUCLOSEEVENT lpWPUCloseEvent;
  138.     LPWPUCLOSESOCKETHANDLE lpWPUCloseSocketHandle;
  139.     LPWPUCREATEEVENT lpWPUCreateEvent;
  140.     LPWPUCREATESOCKETHANDLE lpWPUCreateSocketHandle;
  141.     LPWPUFDISSET lpWPUFDIsSet;
  142.     LPWPUGETPROVIDERPATH lpWPUGetProviderPath;
  143.     LPWPUMODIFYIFSHANDLE lpWPUModifyIFSHandle;
  144.     LPWPUPOSTMESSAGE lpWPUPostMessage;
  145.     LPWPUQUERYBLOCKINGCALLBACK lpWPUQueryBlockingCallback;
  146.     LPWPUQUERYSOCKETHANDLECONTEXT lpWPUQuerySocketHandleContext;
  147.     LPWPUQUEUEAPC lpWPUQueueApc;
  148.     LPWPURESETEVENT lpWPUResetEvent;
  149.     LPWPUSETEVENT lpWPUSetEvent;
  150.     LPWPUOPENCURRENTTHREAD lpWPUOpenCurrentThread;
  151.     LPWPUCLOSETHREAD lpWPUCloseThread;
  152. } WSPUPCALLTABLE, FAR* LPWSPUPCALLTABLE;
  153.  
  154. typedef INT (WSPAPI *LPWSPSTARTUP)(WORD,LPWSPDATA,LPWSAPROTOCOL_INFOW,WSPUPCALLTABLE,LPWSPPROC_TABLE);
  155.  
  156. /* Prototypes for service provider namespace procedure table */
  157. typedef INT (WSPAPI *LPNSPCLEANUP)(LPGUID);
  158. typedef INT (WSPAPI *LPNSPGETSERVICECLASSINFO)(LPGUID,LPDWORD,LPWSASERVICECLASSINFOW);
  159. typedef INT (WSPAPI *LPNSPINSTALLSERVICECLASS)(LPGUID,LPWSASERVICECLASSINFOW);
  160. typedef INT (WSPAPI *LPNSPLOOKUPSERVICEBEGIN)(LPGUID,LPWSAQUERYSETW,LPWSASERVICECLASSINFOW,DWORD,LPHANDLE);
  161. typedef INT (WSPAPI *LPNSPLOOKUPSERVICEEND)(HANDLE);
  162. typedef INT (WSPAPI *LPNSPLOOKUPSERVICENEXT)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSET);
  163. typedef INT (WSPAPI *LPNSPREMOVESERVICECLASS)(LPGUID,LPGUID);
  164. typedef INT (WSPAPI *LPNSPSETSERVICE)(LPGUID,LPWSASERVICECLASSINFOW,LPWSAQUERYSETW,WSAESETSERVICEOP,DWORD);
  165.  
  166. typedef struct _NSP_ROUTINE {
  167.   DWORD cbSize;
  168.   DWORD dwMajorVersion;
  169.   DWORD dwMinorVersion;
  170.   LPNSPCLEANUP NSPCleanup;
  171.   LPNSPLOOKUPSERVICEBEGIN NSPLookupServiceBegin;
  172.   LPNSPLOOKUPSERVICENEXT NSPLookupServiceNext;
  173.   LPNSPLOOKUPSERVICEEND NSPLookupServiceEnd;
  174.   LPNSPSETSERVICE NSPSetService;
  175.   LPNSPINSTALLSERVICECLASS NSPInstallServiceClass;
  176.   LPNSPREMOVESERVICECLASS NSPRemoveServiceClass;
  177.   LPNSPGETSERVICECLASSINFO NSPGetServiceClassInfo;
  178. } NSP_ROUTINE, *PNSP_ROUTINE, *LPNSP_ROUTINE; 
  179.  
  180. INT WSPAPI NSPStartup(LPGUID,LPNSP_ROUTINE);
  181.  
  182. /* WinSock 2 DLL function prototypes */
  183. INT WSPAPI WPUCompleteOverlappedRequest(SOCKET,LPWSAOVERLAPPED,DWORD,DWORD,LPINT);
  184. INT WSPAPI WSPStartup(WORD,LPWSPDATA,LPWSAPROTOCOL_INFOW,WSPUPCALLTABLE,LPWSPPROC_TABLE);
  185. INT WSPAPI WSCDeinstallProvider(LPGUID,LPINT);
  186. INT WSPAPI WSCEnumProtocols(LPINT,LPWSAPROTOCOL_INFOW,LPDWORD,LPINT);
  187. INT WSPAPI WSCGetProviderPath(LPGUID,LPWSTR,LPINT,LPINT);
  188. INT WSPAPI WSCInstallProvider(CONST LPGUID,CONST LPWSTR,CONST LPWSAPROTOCOL_INFOW,DWORD,LPINT);
  189. INT WSPAPI WSCEnableNSProvider(LPGUID,BOOL);
  190. INT WSPAPI WSCInstallNameSpace(LPWSTR,LPWSTR,DWORD,DWORD,LPGUID);
  191. INT WSPAPI WSCUnInstallNameSpace(LPGUID);
  192. INT WSPAPI WSCWriteProviderOrder(LPDWORD,DWORD);
  193.  
  194. #endif /* RC_INVOKED */
  195.  
  196. #ifdef __cplusplus
  197. }
  198. #endif /* __cplusplus */
  199.  
  200. #endif /* _WS2SPI_H */
  201.