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 | /*
|
---|
20 | * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
21 | * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
|
---|
22 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
23 | * a choice of LGPL license versions is made available with the language indicating
|
---|
24 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
25 | * of the LGPL is applied is otherwise unspecified.
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef __DPNATHLP_H__
|
---|
29 | #define __DPNATHLP_H__
|
---|
30 |
|
---|
31 | #include <ole2.h>
|
---|
32 |
|
---|
33 | #ifdef __cplusplus
|
---|
34 | extern "C" {
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | HRESULT DirectPlayNATHelpCreate(LPCGUID pIID, LPVOID *ppvInterface);
|
---|
38 |
|
---|
39 | DEFINE_GUID(CLSID_DirectPlayNATHelpUPnP, 0xb9c2e9c4,0x68c1,0x4d42,0xa7,0xa1,0xe7,0x6a,0x26,0x98,0x2a,0xd6);
|
---|
40 | DEFINE_GUID(CLSID_DirectPlayNATHelpPAST, 0x963ab779,0x16a1,0x477c,0xa3,0x6d,0xcb,0x5e,0x71,0x19,0x38,0xf7);
|
---|
41 | DEFINE_GUID(IID_IDirectPlayNATHelp, 0x154940b6,0x2278,0x4a2f,0x91,0x01,0x9b,0xa9,0xf4,0x31,0xf6,0x03);
|
---|
42 |
|
---|
43 | #define DPNHGETCAPS_UPDATESERVERSTATUS 0x01
|
---|
44 |
|
---|
45 | #define DPNHREGISTERPORTS_TCP 0x01
|
---|
46 | #define DPNHREGISTERPORTS_FIXEDPORTS 0x02
|
---|
47 | #define DPNHREGISTERPORTS_SHAREDPORTS 0x04
|
---|
48 |
|
---|
49 | #define DPNHADDRESSTYPE_TCP 0x01
|
---|
50 | #define DPNHADDRESSTYPE_FIXEDPORTS 0x02
|
---|
51 | #define DPNHADDRESSTYPE_SHAREDPORTS 0x04
|
---|
52 | #define DPNHADDRESSTYPE_LOCALFIREWALL 0x08
|
---|
53 | #define DPNHADDRESSTYPE_GATEWAY 0x10
|
---|
54 | #define DPNHADDRESSTYPE_GATEWAYISLOCAL 0x20
|
---|
55 |
|
---|
56 | #define DPNHCAPSFLAG_LOCALFIREWALLPRESENT 0x01
|
---|
57 | #define DPNHCAPSFLAG_GATEWAYPRESENT 0x02
|
---|
58 | #define DPNHCAPSFLAG_GATEWAYISLOCAL 0x04
|
---|
59 | #define DPNHCAPSFLAG_PUBLICADDRESSAVAILABLE 0x08
|
---|
60 | #define DPNHCAPSFLAG_NOTALLSUPPORTACTIVENOTIFY 0x10
|
---|
61 |
|
---|
62 | #define DPNHINITIALIZE_DISABLEGATEWAYSUPPORT 0x01
|
---|
63 | #define DPNHINITIALIZE_DISABLELOCALFIREWALLSUPPORT 0x02
|
---|
64 |
|
---|
65 | #define DPNHQUERYADDRESS_TCP 0x01
|
---|
66 | #define DPNHQUERYADDRESS_CACHEFOUND 0x02
|
---|
67 | #define DPNHQUERYADDRESS_CACHENOTFOUND 0x04
|
---|
68 | #define DPNHQUERYADDRESS_CHECKFORPRIVATEBUTUNMAPPED 0x08
|
---|
69 |
|
---|
70 | #define DPNHGETREGISTEREDADDRESSES_LOCALFIREWALLREMAPONLY 0x01
|
---|
71 |
|
---|
72 | #define _DPNH_FACILITY_CODE 0x015
|
---|
73 | #define _DPNH_HRESULT_BASE 0xF000
|
---|
74 |
|
---|
75 | #define MAKE_DPNHSUCCESS(code) \
|
---|
76 | MAKE_HRESULT(0, _DPNH_FACILITY_CODE, (code + _DPNH_HRESULT_BASE))
|
---|
77 | #define MAKE_DPNHFAILURE(code) \
|
---|
78 | MAKE_HRESULT(1, _DPNH_FACILITY_CODE, (code + _DPNH_HRESULT_BASE))
|
---|
79 |
|
---|
80 | #define DPNH_OK S_OK
|
---|
81 | #define DPNHSUCCESS_ADDRESSESCHANGED MAKE_DPNHSUCCESS(0x10)
|
---|
82 |
|
---|
83 | #define DPNHERR_ALREADYINITIALIZED MAKE_DPNHFAILURE(0x10)
|
---|
84 | #define DPNHERR_BUFFERTOOSMALL MAKE_DPNHFAILURE(0x20)
|
---|
85 | #define DPNHERR_GENERIC E_FAIL
|
---|
86 | #define DPNHERR_INVALIDFLAGS MAKE_DPNHFAILURE(0x30)
|
---|
87 | #define DPNHERR_INVALIDOBJECT MAKE_DPNHFAILURE(0x40)
|
---|
88 | #define DPNHERR_INVALIDPARAM E_INVALIDARG
|
---|
89 | #define DPNHERR_INVALIDPOINTER E_POINTER
|
---|
90 | #define DPNHERR_NOMAPPING MAKE_DPNHFAILURE(0x50)
|
---|
91 | #define DPNHERR_NOMAPPINGBUTPRIVATE MAKE_DPNHFAILURE(0x60)
|
---|
92 | #define DPNHERR_NOTINITIALIZED MAKE_DPNHFAILURE(0x70)
|
---|
93 | #define DPNHERR_OUTOFMEMORY E_OUTOFMEMORY
|
---|
94 | #define DPNHERR_PORTALREADYREGISTERED MAKE_DPNHFAILURE(0x80)
|
---|
95 | #define DPNHERR_PORTUNAVAILABLE MAKE_DPNHFAILURE(0x90)
|
---|
96 | #define DPNHERR_REENTRANT MAKE_DPNHFAILURE(0x95)
|
---|
97 | #define DPNHERR_SERVERNOTAVAILABLE MAKE_DPNHFAILURE(0xA0)
|
---|
98 | #define DPNHERR_UPDATESERVERSTATUS MAKE_DPNHFAILURE(0xC0)
|
---|
99 |
|
---|
100 | typedef DWORD_PTR DPNHHANDLE;
|
---|
101 | typedef DWORD_PTR *PDPNHHANDLE;
|
---|
102 |
|
---|
103 | typedef struct _DPNHCAPS
|
---|
104 | {
|
---|
105 | DWORD dwSize;
|
---|
106 | DWORD dwFlags;
|
---|
107 | DWORD dwNumRegisteredPorts;
|
---|
108 | DWORD dwMinLeaseTimeRemaining;
|
---|
109 | DWORD dwRecommendedGetCapsInterval;
|
---|
110 | } DPNHCAPS, *PDPNHCAPS;
|
---|
111 |
|
---|
112 |
|
---|
113 | #define INTERFACE IDirectPlayNATHelp
|
---|
114 | DECLARE_INTERFACE_(IDirectPlayNATHelp,IUnknown)
|
---|
115 | {
|
---|
116 | /*** IUnknown methods ***/
|
---|
117 | STDMETHOD(QueryInterface) (THIS_
|
---|
118 | REFIID riid,
|
---|
119 | void** ppvObject) PURE;
|
---|
120 |
|
---|
121 | STDMETHOD_(ULONG,AddRef) (THIS) PURE;
|
---|
122 |
|
---|
123 | STDMETHOD_(ULONG,Release) (THIS) PURE;
|
---|
124 |
|
---|
125 | /*** IDirectPlayNATHelp functions ***/
|
---|
126 | STDMETHOD(Initialize) (THIS_
|
---|
127 | DWORD dwFlags) PURE;
|
---|
128 |
|
---|
129 | STDMETHOD(Close) (THIS_
|
---|
130 | DWORD dwFlags) PURE;
|
---|
131 |
|
---|
132 | STDMETHOD(GetCaps) (THIS_
|
---|
133 | PDPNHCAPS pCaps,
|
---|
134 | DWORD dwFlags) PURE;
|
---|
135 |
|
---|
136 | STDMETHOD(RegisterPorts) (THIS_
|
---|
137 | PSOCKADDR aLocalAddresses,
|
---|
138 | DWORD dwAddressSize,
|
---|
139 | DWORD dwAddresses,
|
---|
140 | DWORD dwTime,
|
---|
141 | PDPNHHANDLE phRegisteredPorts,
|
---|
142 | DWORD dwFlags) PURE;
|
---|
143 |
|
---|
144 | STDMETHOD(GetRegisteredAddresses) (THIS_
|
---|
145 | PDPNHHANDLE hRegisteredPorts,
|
---|
146 | PSOCKADDR paPublicAddresses,
|
---|
147 | const DWORD *dwAddressSize,
|
---|
148 | const DWORD *dwAddressFlags,
|
---|
149 | const DWORD *dwRemaining,
|
---|
150 | DWORD dwFlags) PURE;
|
---|
151 |
|
---|
152 | STDMETHOD(DeregisterPorts)(THIS_
|
---|
153 | DPNHHANDLE hRegPorts,
|
---|
154 | DWORD dwFlags) PURE;
|
---|
155 |
|
---|
156 | STDMETHOD(QueryAddress) (THIS_
|
---|
157 | PSOCKADDR pSource,
|
---|
158 | PSOCKADDR pQuery,
|
---|
159 | PSOCKADDR pResponse,
|
---|
160 | INT iAddresses,
|
---|
161 | DWORD dwFlags) PURE;
|
---|
162 |
|
---|
163 | STDMETHOD(SetAlertEvent) (THIS_
|
---|
164 | HANDLE hEvent,
|
---|
165 | DWORD dwFlags) PURE;
|
---|
166 |
|
---|
167 | STDMETHOD(SetAlertIOCompletionPort)(THIS_
|
---|
168 | HANDLE hIOCompletionPort,
|
---|
169 | DWORD dwCompletion,
|
---|
170 | DWORD dwMaxThreads,
|
---|
171 | DWORD dwFlags) PURE;
|
---|
172 |
|
---|
173 | STDMETHOD(ExtendRegisteredPortsLease)(THIS_
|
---|
174 | DPNHHANDLE hRegisteredPorts,
|
---|
175 | DWORD dwLeaseTime,
|
---|
176 | DWORD dwFlags) PURE;
|
---|
177 | };
|
---|
178 |
|
---|
179 | #undef INTERFACE
|
---|
180 |
|
---|
181 | #ifdef COBJMACROS
|
---|
182 | #define IDirectPlayNATHelp_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
---|
183 | #define IDirectPlayNATHelp_AddRef(p) (p)->lpVtbl->AddRef(p)
|
---|
184 | #define IDirectPlayNATHelp_Release(p) (p)->lpVtbl->Release(p)
|
---|
185 | #define IDirectPlayNATHelp_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
|
---|
186 | #define IDirectPlayNATHelp_Close(p,a) (p)->lpVtbl->Close(p,a)
|
---|
187 | #define IDirectPlayNATHelp_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b)
|
---|
188 | #define IDirectPlayNATHelp_RegisterPorts(p,a,b,c,d,e,f) (p)->lpVtbl->RegisterPorts(p,a,b,c,d,e,f)
|
---|
189 | #define IDirectPlayNATHelp_GetRegisteredAddresses(p,a,b,c,d,e,f) (p)->lpVtbl->GetRegisteredAddresses(p,a,b,c,d,e,f)
|
---|
190 | #define IDirectPlayNATHelp_DeregisterPorts(p,a,b) (p)->lpVtbl->DeregisterPorts(p,a,b)
|
---|
191 | #define IDirectPlayNATHelp_QueryAddress(p,a,b,c,d,e) (p)->lpVtbl->QueryAddress(p,a,b,c,d,e)
|
---|
192 | #define IDirectPlayNATHelp_SetAlertEvent(p,a,b) (p)->lpVtbl->SetAlertEvent(p,a,b)
|
---|
193 | #define IDirectPlayNATHelp_SetAlertIOCompletionPort(p,a,b,c,d) (p)->lpVtbl->SetAlertIOCompletionPort(p,a,b,c,d)
|
---|
194 | #define IDirectPlayNATHelp_ExtendRegisteredPortsLease(p,a,b,c) (p)->lpVtbl->SetAlertIOCompletionPort(p,a,b,c)
|
---|
195 | #endif
|
---|
196 |
|
---|
197 | #ifdef __cplusplus
|
---|
198 | }
|
---|
199 | #endif
|
---|
200 |
|
---|
201 | #endif /* __DPNATHLP_H__ */
|
---|