2 * Copyright (C) 2006 Maarten Lankhorst
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.
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.
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
19 #ifndef __DPNATHLP_H__
20 #define __DPNATHLP_H__
26 HRESULT
DirectPlayNATHelpCreate(const PGUID pIID
, void ** ppvInterface
);
28 DEFINE_GUID(CLSID_DirectPlayNATHelpUPnP
, 0xb9c2e9c4,0x68c1,0x4d42,0xa7,0xa1,0xe7,0x6a,0x26,0x98,0x2a,0xd6);
29 DEFINE_GUID(CLSID_DirectPlayNATHelpPAST
, 0x963ab779,0x16a1,0x477c,0xa3,0x6d,0xcb,0x5e,0x71,0x19,0x38,0xf7);
30 DEFINE_GUID(IID_IDirectPlayNATHelp
, 0x154940b6,0x2278,0x4a2f,0x91,0x01,0x9b,0xa9,0xf4,0x31,0xf6,0x03);
32 #define DPNHGETCAPS_UPDATESERVERSTATUS 0x01
34 #define DPNHREGISTERPORTS_TCP 0x01
35 #define DPNHREGISTERPORTS_FIXEDPORTS 0x02
36 #define DPNHREGISTERPORTS_SHAREDPORTS 0x04
38 #define DPNHADDRESSTYPE_TCP 0x01
39 #define DPNHADDRESSTYPE_FIXEDPORTS 0x02
40 #define DPNHADDRESSTYPE_SHAREDPORTS 0x04
41 #define DPNHADDRESSTYPE_LOCALFIREWALL 0x08
42 #define DPNHADDRESSTYPE_GATEWAY 0x10
43 #define DPNHADDRESSTYPE_GATEWAYISLOCAL 0x20
45 #define DPNHCAPSFLAG_LOCALFIREWALLPRESENT 0x01
46 #define DPNHCAPSFLAG_GATEWAYPRESENT 0x02
47 #define DPNHCAPSFLAG_GATEWAYISLOCAL 0x04
48 #define DPNHCAPSFLAG_PUBLICADDRESSAVAILABLE 0x08
49 #define DPNHCAPSFLAG_NOTALLSUPPORTACTIVENOTIFY 0x10
51 #define DPNHINITIALIZE_DISABLEGATEWAYSUPPORT 0x01
52 #define DPNHINITIALIZE_DISABLELOCALFIREWALLSUPPORT 0x02
54 #define DPNHQUERYADDRESS_TCP 0x01
55 #define DPNHQUERYADDRESS_CACHEFOUND 0x02
56 #define DPNHQUERYADDRESS_CACHENOTFOUND 0x04
57 #define DPNHQUERYADDRESS_CHECKFORPRIVATEBUTUNMAPPED 0x08
59 #define DPNHGETREGISTEREDADDRESSES_LOCALFIREWALLREMAPONLY 0x01
61 #define _DPNH_FACILITY_CODE 0x015
62 #define _DPNH_HRESULT_BASE 0xF000
64 #define MAKE_DPNHSUCCESS(code) \
65 MAKE_HRESULT(0, _DPNH_FACILITY_CODE, (code + _DPNH_HRESULT_BASE))
66 #define MAKE_DPNHFAILURE(code) \
67 MAKE_HRESULT(1, _DPNH_FACILITY_CODE, (code + _DPNH_HRESULT_BASE))
70 #define DPNHSUCCESS_ADDRESSESCHANGED MAKE_DPNHSUCCESS(0x10)
72 #define DPNHERR_ALREADYINITIALIZED MAKE_DPNHFAILURE(0x10)
73 #define DPNHERR_BUFFERTOOSMALL MAKE_DPNHFAILURE(0x20)
74 #define DPNHERR_GENERIC E_FAIL
75 #define DPNHERR_INVALIDFLAGS MAKE_DPNHFAILURE(0x30)
76 #define DPNHERR_INVALIDOBJECT MAKE_DPNHFAILURE(0x40)
77 #define DPNHERR_INVALIDPARAM E_INVALIDARG
78 #define DPNHERR_INVALIDPOINTER E_POINTER
79 #define DPNHERR_NOMAPPING MAKE_DPNHFAILURE(0x50)
80 #define DPNHERR_NOMAPPINGBUTPRIVATE MAKE_DPNHFAILURE(0x60)
81 #define DPNHERR_NOTINITIALIZED MAKE_DPNHFAILURE(0x70)
82 #define DPNHERR_OUTOFMEMORY E_OUTOFMEMORY
83 #define DPNHERR_PORTALREADYREGISTERED MAKE_DPNHFAILURE(0x80)
84 #define DPNHERR_PORTUNAVAILABLE MAKE_DPNHFAILURE(0x90)
85 #define DPNHERR_REENTRANT MAKE_DPNHFAILURE(0x95)
86 #define DPNHERR_SERVERNOTAVAILABLE MAKE_DPNHFAILURE(0xA0)
87 #define DPNHERR_UPDATESERVERSTATUS MAKE_DPNHFAILURE(0xC0)
89 typedef DWORD_PTR DPNHHANDLE
;
90 typedef DWORD_PTR
*PDPNHHANDLE
;
92 typedef struct _DPNHCAPS
96 DWORD dwNumRegisteredPorts
;
97 DWORD dwMinLeaseTimeRemaining
;
98 DWORD dwRecommendedGetCapsInterval
;
99 } DPNHCAPS
, *PDPNHCAPS
;
102 #define INTERFACE IDirectPlayNATHelp
103 DECLARE_INTERFACE_(IDirectPlayNATHelp
,IUnknown
)
105 /*** IUnknown methods ***/
106 STDMETHOD(QueryInterface
) (THIS_
108 void** ppvObject
) PURE
;
110 STDMETHOD_(ULONG
,AddRef
) (THIS
) PURE
;
112 STDMETHOD_(ULONG
,Release
) (THIS
) PURE
;
114 /*** IDirectPlayNATHelp functions ***/
115 STDMETHOD(Initialize
) (THIS_
116 const DWORD dwFlags
) PURE
;
118 STDMETHOD(Close
) (THIS_
119 const DWORD dwFlags
) PURE
;
121 STDMETHOD(GetCaps
) (THIS_
122 const PDPNHCAPS pCaps
,
123 const DWORD dwFlags
) PURE
;
125 STDMETHOD(RegisterPorts
) (THIS_
126 const PSOCKADDR aLocalAddresses
,
127 const DWORD dwAddressSize
,
128 const DWORD dwAddresses
,
130 const PDPNHHANDLE phRegisteredPorts
,
131 const DWORD dwFlags
) PURE
;
133 STDMETHOD(GetRegisteredAddresses
) (THIS_
134 const PDPNHHANDLE hRegisteredPorts
,
135 const PSOCKADDR paPublicAddresses
,
136 const DWORD
*dwAddressSize
,
137 const DWORD
*dwAddressFlags
,
138 const DWORD
*dwRemaining
,
139 const DWORD dwFlags
) PURE
;
141 STDMETHOD(DeregisterPorts
)(THIS_
142 const DPNHHANDLE hRegPorts
,
143 const DWORD dwFlags
) PURE
;
145 STDMETHOD(QueryAddress
) (THIS_
146 const PSOCKADDR pSource
,
147 const PSOCKADDR pQuery
,
148 const PSOCKADDR pResponse
,
149 const INT iAddresses
,
150 const DWORD dwFlags
) PURE
;
152 STDMETHOD(SetAlertEvent
) (THIS_
154 const DWORD dwFlags
) PURE
;
156 STDMETHOD(SetAlertIOCompletionPort
)(THIS_
157 const HANDLE hIOCompletionPort
,
158 const DWORD dwCompletion
,
159 const DWORD dwMaxThreads
,
160 const DWORD dwFlags
) PURE
;
162 STDMETHOD(ExtendRegisteredPortsLease
)(THIS_
163 const DPNHHANDLE hRegisteredPorts
,
164 const DWORD dwLeaseTime
,
165 const DWORD dwFlags
) PURE
;
171 #define IDirectPlayNATHelp_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
172 #define IDirectPlayNATHelp_AddRef(p) (p)->lpVtbl->AddRef(p)
173 #define IDirectPlayNATHelp_Release(p) (p)->lpVtbl->Release(p)
174 #define IDirectPlayNATHelp_Initialize(p,a) (p)->lpVtbl->Initialize(p,a)
175 #define IDirectPlayNATHelp_Close(p,a) (p)->lpVtbl->Close(p,a)
176 #define IDirectPlayNATHelp_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b)
177 #define IDirectPlayNATHelp_RegisterPorts(p,a,b,c,d,e,f) (p)->lpVtbl->RegisterPorts(p,a,b,c,d,e,f)
178 #define IDirectPlayNATHelp_GetRegisteredAddresses(p,a,b,c,d,e,f) (p)->lpVtbl->GetRegisteredAddresses(p,a,b,c,d,e,f)
179 #define IDirectPlayNATHelp_DeregisterPorts(p,a,b) (p)->lpVtbl->DeregisterPorts(p,a,b)
180 #define IDirectPlayNATHelp_QueryAddress(p,a,b,c,d,e) (p)->lpVtbl->QueryAddress(p,a,b,c,d,e)
181 #define IDirectPlayNATHelp_SetAlertEvent(p,a,b) (p)->lpVtbl->SetAlertEvent(p,a,b)
182 #define IDirectPlayNATHelp_SetAlertIOCompletionPort(p,a,b,c,d) (p)->lpVtbl->SetAlertIOCompletionPort(p,a,b,c,d)
183 #define IDirectPlayNATHelp_ExtendRegisteredPortsLease(p,a,b,c) (p)->lpVtbl->SetAlertIOCompletionPort(p,a,b,c)
190 #endif /* __DPNATHLP_H__ */