include: Fix some winsock definitions.
[wine] / include / dpnathlp.h
1 /*
2  * Copyright (C) 2006 Maarten Lankhorst
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #ifndef __DPNATHLP_H__
20 #define __DPNATHLP_H__
21
22 #include <ole2.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 HRESULT DirectPlayNATHelpCreate(LPCGUID pIID, LPVOID *ppvInterface);
29
30 DEFINE_GUID(CLSID_DirectPlayNATHelpUPnP, 0xb9c2e9c4,0x68c1,0x4d42,0xa7,0xa1,0xe7,0x6a,0x26,0x98,0x2a,0xd6);
31 DEFINE_GUID(CLSID_DirectPlayNATHelpPAST, 0x963ab779,0x16a1,0x477c,0xa3,0x6d,0xcb,0x5e,0x71,0x19,0x38,0xf7);
32 DEFINE_GUID(IID_IDirectPlayNATHelp,      0x154940b6,0x2278,0x4a2f,0x91,0x01,0x9b,0xa9,0xf4,0x31,0xf6,0x03);
33
34 #define DPNHGETCAPS_UPDATESERVERSTATUS  0x01
35
36 #define DPNHREGISTERPORTS_TCP           0x01
37 #define DPNHREGISTERPORTS_FIXEDPORTS    0x02
38 #define DPNHREGISTERPORTS_SHAREDPORTS   0x04
39
40 #define DPNHADDRESSTYPE_TCP             0x01
41 #define DPNHADDRESSTYPE_FIXEDPORTS      0x02
42 #define DPNHADDRESSTYPE_SHAREDPORTS     0x04
43 #define DPNHADDRESSTYPE_LOCALFIREWALL   0x08
44 #define DPNHADDRESSTYPE_GATEWAY         0x10
45 #define DPNHADDRESSTYPE_GATEWAYISLOCAL  0x20
46
47 #define DPNHCAPSFLAG_LOCALFIREWALLPRESENT       0x01
48 #define DPNHCAPSFLAG_GATEWAYPRESENT             0x02
49 #define DPNHCAPSFLAG_GATEWAYISLOCAL             0x04
50 #define DPNHCAPSFLAG_PUBLICADDRESSAVAILABLE     0x08
51 #define DPNHCAPSFLAG_NOTALLSUPPORTACTIVENOTIFY  0x10
52
53 #define DPNHINITIALIZE_DISABLEGATEWAYSUPPORT        0x01
54 #define DPNHINITIALIZE_DISABLELOCALFIREWALLSUPPORT  0x02
55
56 #define DPNHQUERYADDRESS_TCP                        0x01
57 #define DPNHQUERYADDRESS_CACHEFOUND                 0x02
58 #define DPNHQUERYADDRESS_CACHENOTFOUND              0x04
59 #define DPNHQUERYADDRESS_CHECKFORPRIVATEBUTUNMAPPED 0x08
60
61 #define DPNHGETREGISTEREDADDRESSES_LOCALFIREWALLREMAPONLY 0x01
62
63 #define _DPNH_FACILITY_CODE   0x015
64 #define _DPNH_HRESULT_BASE    0xF000
65
66 #define MAKE_DPNHSUCCESS(code) \
67                MAKE_HRESULT(0, _DPNH_FACILITY_CODE, (code + _DPNH_HRESULT_BASE))
68 #define MAKE_DPNHFAILURE(code) \
69                MAKE_HRESULT(1, _DPNH_FACILITY_CODE, (code + _DPNH_HRESULT_BASE))
70
71 #define DPNH_OK                         S_OK
72 #define DPNHSUCCESS_ADDRESSESCHANGED    MAKE_DPNHSUCCESS(0x10)
73
74 #define DPNHERR_ALREADYINITIALIZED      MAKE_DPNHFAILURE(0x10)
75 #define DPNHERR_BUFFERTOOSMALL          MAKE_DPNHFAILURE(0x20)
76 #define DPNHERR_GENERIC                 E_FAIL
77 #define DPNHERR_INVALIDFLAGS            MAKE_DPNHFAILURE(0x30)
78 #define DPNHERR_INVALIDOBJECT           MAKE_DPNHFAILURE(0x40)
79 #define DPNHERR_INVALIDPARAM            E_INVALIDARG
80 #define DPNHERR_INVALIDPOINTER          E_POINTER
81 #define DPNHERR_NOMAPPING               MAKE_DPNHFAILURE(0x50)
82 #define DPNHERR_NOMAPPINGBUTPRIVATE     MAKE_DPNHFAILURE(0x60)
83 #define DPNHERR_NOTINITIALIZED          MAKE_DPNHFAILURE(0x70)
84 #define DPNHERR_OUTOFMEMORY             E_OUTOFMEMORY
85 #define DPNHERR_PORTALREADYREGISTERED   MAKE_DPNHFAILURE(0x80)
86 #define DPNHERR_PORTUNAVAILABLE         MAKE_DPNHFAILURE(0x90)
87 #define DPNHERR_REENTRANT               MAKE_DPNHFAILURE(0x95)
88 #define DPNHERR_SERVERNOTAVAILABLE      MAKE_DPNHFAILURE(0xA0)
89 #define DPNHERR_UPDATESERVERSTATUS      MAKE_DPNHFAILURE(0xC0)
90         
91 typedef DWORD_PTR DPNHHANDLE;
92 typedef DWORD_PTR *PDPNHHANDLE;
93
94 typedef struct _DPNHCAPS
95 {
96    DWORD dwSize;
97    DWORD dwFlags;
98    DWORD dwNumRegisteredPorts;
99    DWORD dwMinLeaseTimeRemaining;
100    DWORD dwRecommendedGetCapsInterval;
101 } DPNHCAPS, *PDPNHCAPS;
102
103
104 #define INTERFACE IDirectPlayNATHelp
105 DECLARE_INTERFACE_(IDirectPlayNATHelp,IUnknown)
106 {
107    /*** IUnknown methods ***/
108    STDMETHOD(QueryInterface) (THIS_
109                               REFIID riid,
110                               void** ppvObject) PURE;
111
112    STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
113
114    STDMETHOD_(ULONG,Release) (THIS) PURE;
115
116    /*** IDirectPlayNATHelp functions ***/
117    STDMETHOD(Initialize)     (THIS_
118                               const DWORD dwFlags) PURE;
119
120    STDMETHOD(Close)          (THIS_
121                               const DWORD dwFlags) PURE;
122
123    STDMETHOD(GetCaps)        (THIS_
124                               const PDPNHCAPS pCaps,
125                               const DWORD dwFlags) PURE;
126
127    STDMETHOD(RegisterPorts)  (THIS_
128                               const PSOCKADDR aLocalAddresses,
129                               const DWORD dwAddressSize,
130                               const DWORD dwAddresses,
131                               const DWORD dwTime,
132                               const PDPNHHANDLE phRegisteredPorts,
133                               const DWORD dwFlags) PURE;
134
135    STDMETHOD(GetRegisteredAddresses) (THIS_
136                               const PDPNHHANDLE hRegisteredPorts,
137                               const PSOCKADDR paPublicAddresses,
138                               const DWORD *dwAddressSize,
139                               const DWORD *dwAddressFlags,
140                               const DWORD *dwRemaining,
141                               const DWORD dwFlags) PURE;
142
143    STDMETHOD(DeregisterPorts)(THIS_
144                               const DPNHHANDLE hRegPorts,
145                               const DWORD dwFlags) PURE;
146
147    STDMETHOD(QueryAddress)   (THIS_
148                               const PSOCKADDR pSource,
149                               const PSOCKADDR pQuery,
150                               const PSOCKADDR pResponse,
151                               const INT iAddresses,
152                               const DWORD dwFlags) PURE;
153
154    STDMETHOD(SetAlertEvent)  (THIS_
155                               const HANDLE hEvent,
156                               const DWORD dwFlags) PURE;
157
158    STDMETHOD(SetAlertIOCompletionPort)(THIS_
159                               const HANDLE hIOCompletionPort,
160                               const DWORD dwCompletion,
161                               const DWORD dwMaxThreads,
162                               const DWORD dwFlags) PURE;
163
164    STDMETHOD(ExtendRegisteredPortsLease)(THIS_
165                               const DPNHHANDLE hRegisteredPorts,
166                               const DWORD dwLeaseTime,
167                               const DWORD dwFlags) PURE;
168 };
169
170 #undef INTERFACE
171
172 #ifdef COBJMACROS
173 #define IDirectPlayNATHelp_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
174 #define IDirectPlayNATHelp_AddRef(p)  (p)->lpVtbl->AddRef(p)
175 #define IDirectPlayNATHelp_Release(p) (p)->lpVtbl->Release(p)
176 #define IDirectPlayNATHelp_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
177 #define IDirectPlayNATHelp_Close(p,a) (p)->lpVtbl->Close(p,a)
178 #define IDirectPlayNATHelp_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b)
179 #define IDirectPlayNATHelp_RegisterPorts(p,a,b,c,d,e,f) (p)->lpVtbl->RegisterPorts(p,a,b,c,d,e,f)
180 #define IDirectPlayNATHelp_GetRegisteredAddresses(p,a,b,c,d,e,f) (p)->lpVtbl->GetRegisteredAddresses(p,a,b,c,d,e,f)
181 #define IDirectPlayNATHelp_DeregisterPorts(p,a,b) (p)->lpVtbl->DeregisterPorts(p,a,b)
182 #define IDirectPlayNATHelp_QueryAddress(p,a,b,c,d,e) (p)->lpVtbl->QueryAddress(p,a,b,c,d,e)
183 #define IDirectPlayNATHelp_SetAlertEvent(p,a,b) (p)->lpVtbl->SetAlertEvent(p,a,b)
184 #define IDirectPlayNATHelp_SetAlertIOCompletionPort(p,a,b,c,d) (p)->lpVtbl->SetAlertIOCompletionPort(p,a,b,c,d)
185 #define IDirectPlayNATHelp_ExtendRegisteredPortsLease(p,a,b,c) (p)->lpVtbl->SetAlertIOCompletionPort(p,a,b,c)
186 #endif
187
188 #ifdef __cplusplus
189 }
190 #endif
191
192 #endif /* __DPNATHLP_H__ */