2 * Copyright 2014 Hans Leidekker for CodeWeavers
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
26 #include "netlistmgr.h"
28 #include "wine/debug.h"
29 #include "netprofm_private.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(netprofm
);
35 INetworkListManager INetworkListManager_iface
;
36 INetworkCostManager INetworkCostManager_iface
;
40 static inline struct list_manager
*impl_from_INetworkCostManager(
41 INetworkCostManager
*iface
)
43 return CONTAINING_RECORD( iface
, struct list_manager
, INetworkCostManager_iface
);
46 static HRESULT WINAPI
cost_manager_QueryInterface(
47 INetworkCostManager
*iface
,
51 struct list_manager
*mgr
= impl_from_INetworkCostManager( iface
);
52 return INetworkListManager_QueryInterface( &mgr
->INetworkListManager_iface
, riid
, obj
);
55 static ULONG WINAPI
cost_manager_AddRef(
56 INetworkCostManager
*iface
)
58 struct list_manager
*mgr
= impl_from_INetworkCostManager( iface
);
59 return INetworkListManager_AddRef( &mgr
->INetworkListManager_iface
);
62 static ULONG WINAPI
cost_manager_Release(
63 INetworkCostManager
*iface
)
65 struct list_manager
*mgr
= impl_from_INetworkCostManager( iface
);
66 return INetworkListManager_Release( &mgr
->INetworkListManager_iface
);
69 static HRESULT WINAPI
cost_manager_GetCost(
70 INetworkCostManager
*iface
, DWORD
*pCost
, NLM_SOCKADDR
*pDestIPAddr
)
72 FIXME( "%p, %p, %p\n", iface
, pCost
, pDestIPAddr
);
74 if (!pCost
) return E_POINTER
;
76 *pCost
= NLM_CONNECTION_COST_UNRESTRICTED
;
80 static HRESULT WINAPI
cost_manager_GetDataPlanStatus(
81 INetworkCostManager
*iface
, NLM_DATAPLAN_STATUS
*pDataPlanStatus
,
82 NLM_SOCKADDR
*pDestIPAddr
)
84 FIXME( "%p, %p, %p\n", iface
, pDataPlanStatus
, pDestIPAddr
);
88 static HRESULT WINAPI
cost_manager_SetDestinationAddresses(
89 INetworkCostManager
*iface
, UINT32 length
, NLM_SOCKADDR
*pDestIPAddrList
,
92 FIXME( "%p, %u, %p, %x\n", iface
, length
, pDestIPAddrList
, bAppend
);
96 static const INetworkCostManagerVtbl cost_manager_vtbl
=
98 cost_manager_QueryInterface
,
100 cost_manager_Release
,
101 cost_manager_GetCost
,
102 cost_manager_GetDataPlanStatus
,
103 cost_manager_SetDestinationAddresses
106 static inline struct list_manager
*impl_from_INetworkListManager(
107 INetworkListManager
*iface
)
109 return CONTAINING_RECORD( iface
, struct list_manager
, INetworkListManager_iface
);
112 static ULONG WINAPI
list_manager_AddRef(
113 INetworkListManager
*iface
)
115 struct list_manager
*mgr
= impl_from_INetworkListManager( iface
);
116 return InterlockedIncrement( &mgr
->refs
);
119 static ULONG WINAPI
list_manager_Release(
120 INetworkListManager
*iface
)
122 struct list_manager
*mgr
= impl_from_INetworkListManager( iface
);
123 LONG refs
= InterlockedDecrement( &mgr
->refs
);
126 TRACE( "destroying %p\n", mgr
);
127 HeapFree( GetProcessHeap(), 0, mgr
);
132 static HRESULT WINAPI
list_manager_QueryInterface(
133 INetworkListManager
*iface
,
137 struct list_manager
*mgr
= impl_from_INetworkListManager( iface
);
139 TRACE( "%p, %s, %p\n", mgr
, debugstr_guid(riid
), obj
);
141 if (IsEqualGUID( riid
, &IID_INetworkListManager
) ||
142 IsEqualGUID( riid
, &IID_IUnknown
))
146 else if (IsEqualGUID( riid
, &IID_INetworkCostManager
))
148 *obj
= &mgr
->INetworkCostManager_iface
;
152 FIXME( "interface %s not implemented\n", debugstr_guid(riid
) );
153 return E_NOINTERFACE
;
155 INetworkListManager_AddRef( iface
);
159 static HRESULT WINAPI
list_manager_GetTypeInfoCount(
160 INetworkListManager
*iface
,
167 static HRESULT WINAPI
list_manager_GetTypeInfo(
168 INetworkListManager
*iface
,
177 static HRESULT WINAPI
list_manager_GetIDsOfNames(
178 INetworkListManager
*iface
,
189 static HRESULT WINAPI
list_manager_Invoke(
190 INetworkListManager
*iface
,
197 EXCEPINFO
*excep_info
,
204 static HRESULT WINAPI
list_manager_GetNetworks(
205 INetworkListManager
*iface
,
206 NLM_ENUM_NETWORK Flags
,
207 IEnumNetworks
**ppEnumNetwork
)
209 FIXME( "%p, %x, %p\n", iface
, Flags
, ppEnumNetwork
);
213 static HRESULT WINAPI
list_manager_GetNetwork(
214 INetworkListManager
*iface
,
216 INetwork
**ppNetwork
)
218 FIXME( "%p, %s, %p\n", iface
, debugstr_guid(&gdNetworkId
), ppNetwork
);
222 static HRESULT WINAPI
list_manager_GetNetworkConnections(
223 INetworkListManager
*iface
,
224 IEnumNetworkConnections
**ppEnum
)
226 FIXME( "%p, %p\n", iface
, ppEnum
);
230 static HRESULT WINAPI
list_manager_GetNetworkConnection(
231 INetworkListManager
*iface
,
232 GUID gdNetworkConnectionId
,
233 INetworkConnection
**ppNetworkConnection
)
235 FIXME( "%p, %s, %p\n", iface
, debugstr_guid(&gdNetworkConnectionId
),
236 ppNetworkConnection
);
240 static HRESULT WINAPI
list_manager_IsConnectedToInternet(
241 INetworkListManager
*iface
,
242 VARIANT_BOOL
*pbIsConnected
)
244 FIXME( "%p, %p\n", iface
, pbIsConnected
);
246 *pbIsConnected
= VARIANT_TRUE
;
250 static HRESULT WINAPI
list_manager_IsConnected(
251 INetworkListManager
*iface
,
252 VARIANT_BOOL
*pbIsConnected
)
254 FIXME( "%p, %p\n", iface
, pbIsConnected
);
256 *pbIsConnected
= VARIANT_TRUE
;
260 static HRESULT WINAPI
list_manager_GetConnectivity(
261 INetworkListManager
*iface
,
262 NLM_CONNECTIVITY
*pConnectivity
)
264 FIXME( "%p, %p\n", iface
, pConnectivity
);
266 *pConnectivity
= NLM_CONNECTIVITY_IPV4_INTERNET
;
270 static const INetworkListManagerVtbl list_manager_vtbl
=
272 list_manager_QueryInterface
,
274 list_manager_Release
,
275 list_manager_GetTypeInfoCount
,
276 list_manager_GetTypeInfo
,
277 list_manager_GetIDsOfNames
,
279 list_manager_GetNetworks
,
280 list_manager_GetNetwork
,
281 list_manager_GetNetworkConnections
,
282 list_manager_GetNetworkConnection
,
283 list_manager_IsConnectedToInternet
,
284 list_manager_IsConnected
,
285 list_manager_GetConnectivity
288 HRESULT
list_manager_create( void **obj
)
290 struct list_manager
*mgr
;
292 TRACE( "%p\n", obj
);
294 if (!(mgr
= HeapAlloc( GetProcessHeap(), 0, sizeof(*mgr
) ))) return E_OUTOFMEMORY
;
295 mgr
->INetworkListManager_iface
.lpVtbl
= &list_manager_vtbl
;
296 mgr
->INetworkCostManager_iface
.lpVtbl
= &cost_manager_vtbl
;
299 *obj
= &mgr
->INetworkListManager_iface
;
300 TRACE( "returning iface %p\n", *obj
);