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