1 // Copyright © 2015, skdltmxn
2 // Licensed under the MIT License <LICENSE.md>
3 //! Definitions to be used with the WinSock service provider
4 pub const WSPDESCRIPTION_LEN: usize = 255;
5 STRUCT!{nodebug struct WSPDATA {
6     wVersion: ::WORD,
7     wHighVersion: ::WORD,
8     szDescription: [::WCHAR; WSPDESCRIPTION_LEN + 1],
9 }}
10 pub type LPWSPDATA = *mut WSPDATA;
11 STRUCT!{struct WSATHREADID {
12     ThreadHandle: ::HANDLE,
13     Reserved: ::DWORD_PTR,
14 }}
15 pub type LPWSATHREADID = *mut WSATHREADID;
16 pub type LPNSPV2STARTUP = Option<unsafe extern "system" fn(
17     lpProviderId: ::LPGUID, ppvClientSessionArg: *mut ::LPVOID,
18 ) -> ::INT>;
19 pub type LPNSPV2CLEANUP = Option<unsafe extern "system" fn(
20     lpProviderId: ::LPGUID, pvClientSessionArg: ::LPVOID,
21 ) -> ::INT>;
22 pub type LPNSPV2LOOKUPSERVICEBEGIN = Option<unsafe extern "system" fn(
23     lpProviderId: ::LPGUID, lpqsRestrictions: ::LPWSAQUERYSET2W, dwControlFlags: ::DWORD,
24     lpvClientSessionArg: ::LPVOID, lphLookup: ::LPHANDLE,
25 ) -> ::INT>;
26 pub type LPNSPV2LOOKUPSERVICENEXTEX = Option<unsafe extern "system" fn(
27     hAsyncCall: ::HANDLE, hLookup: ::HANDLE, dwControlFlags: ::DWORD, lpdwBufferLength: ::LPDWORD,
28     lpqsResults: ::LPWSAQUERYSET2W
29 )>;
30 pub type LPNSPV2LOOKUPSERVICEEND = Option<unsafe extern "system" fn(hLookup: ::HANDLE) -> ::INT>;
31 pub type LPNSPV2SETSERVICEEX = Option<unsafe extern "system" fn(
32     hAsyncCall: ::HANDLE, lpProviderId: ::LPGUID, lpqsRegInfo: ::LPWSAQUERYSET2W,
33     essOperation: ::WSAESETSERVICEOP, dwControlFlags: ::DWORD, lpvClientSessionArg: ::LPVOID,
34 )>;
35 pub type LPNSPV2CLIENTSESSIONRUNDOWN = Option<unsafe extern "system" fn(
36     lpProviderId: ::LPGUID, pvClientSessionArg: ::LPVOID,
37 )>;
38 STRUCT!{nodebug struct NSPV2_ROUTINE {
39     cbSize: ::DWORD,
40     dwMajorVersion: ::DWORD,
41     dwMinorVersion: ::DWORD,
42     NSPv2Startup: LPNSPV2STARTUP,
43     NSPv2Cleanup: LPNSPV2CLEANUP,
44     NSPv2LookupServiceBegin: LPNSPV2LOOKUPSERVICEBEGIN,
45     NSPv2LookupServiceNextEx: LPNSPV2LOOKUPSERVICENEXTEX,
46     NSPv2LookupServiceEnd: LPNSPV2LOOKUPSERVICEEND,
47     NSPv2SetServiceEx: LPNSPV2SETSERVICEEX,
48     NSPv2ClientSessionRundown: LPNSPV2CLIENTSESSIONRUNDOWN,
49 }}
50 pub type PNSPV2_ROUTINE = *mut NSPV2_ROUTINE;
51 pub type LPNSPV2_ROUTINE = *mut NSPV2_ROUTINE;
52 pub type PCNSPV2_ROUTINE = *const NSPV2_ROUTINE;
53 pub type LPCNSPV2_ROUTINE = *const NSPV2_ROUTINE;
54 ENUM!{enum WSC_PROVIDER_INFO_TYPE {
55     ProviderInfoLspCategories,
56     ProviderInfoAudit,
57 }}
58