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