Commit c7690c70 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

netprofm: Add a stub implementation of INetworkCostManager.

parent 06fd202a
......@@ -33,9 +33,76 @@ WINE_DEFAULT_DEBUG_CHANNEL(netprofm);
struct list_manager
{
INetworkListManager INetworkListManager_iface;
INetworkCostManager INetworkCostManager_iface;
LONG refs;
};
static inline struct list_manager *impl_from_INetworkCostManager(
INetworkCostManager *iface )
{
return CONTAINING_RECORD( iface, struct list_manager, INetworkCostManager_iface );
}
static HRESULT WINAPI cost_manager_QueryInterface(
INetworkCostManager *iface,
REFIID riid,
void **obj )
{
struct list_manager *mgr = impl_from_INetworkCostManager( iface );
return INetworkListManager_QueryInterface( &mgr->INetworkListManager_iface, riid, obj );
}
static ULONG WINAPI cost_manager_AddRef(
INetworkCostManager *iface )
{
struct list_manager *mgr = impl_from_INetworkCostManager( iface );
return INetworkListManager_AddRef( &mgr->INetworkListManager_iface );
}
static ULONG WINAPI cost_manager_Release(
INetworkCostManager *iface )
{
struct list_manager *mgr = impl_from_INetworkCostManager( iface );
return INetworkListManager_Release( &mgr->INetworkListManager_iface );
}
static HRESULT WINAPI cost_manager_GetCost(
INetworkCostManager *iface, DWORD *pCost, NLM_SOCKADDR *pDestIPAddr)
{
FIXME( "%p, %p, %p\n", iface, pCost, pDestIPAddr );
if (!pCost) return E_POINTER;
*pCost = NLM_CONNECTION_COST_UNRESTRICTED;
return S_OK;
}
static HRESULT WINAPI cost_manager_GetDataPlanStatus(
INetworkCostManager *iface, NLM_DATAPLAN_STATUS *pDataPlanStatus,
NLM_SOCKADDR *pDestIPAddr)
{
FIXME( "%p, %p, %p\n", iface, pDataPlanStatus, pDestIPAddr );
return E_NOTIMPL;
}
static HRESULT WINAPI cost_manager_SetDestinationAddresses(
INetworkCostManager *iface, UINT32 length, NLM_SOCKADDR *pDestIPAddrList,
VARIANT_BOOL bAppend)
{
FIXME( "%p, %u, %p, %x\n", iface, length, pDestIPAddrList, bAppend );
return E_NOTIMPL;
}
static const INetworkCostManagerVtbl cost_manager_vtbl =
{
cost_manager_QueryInterface,
cost_manager_AddRef,
cost_manager_Release,
cost_manager_GetCost,
cost_manager_GetDataPlanStatus,
cost_manager_SetDestinationAddresses
};
static inline struct list_manager *impl_from_INetworkListManager(
INetworkListManager *iface )
{
......@@ -76,6 +143,10 @@ static HRESULT WINAPI list_manager_QueryInterface(
{
*obj = iface;
}
else if (IsEqualGUID( riid, &IID_INetworkCostManager ))
{
*obj = &mgr->INetworkCostManager_iface;
}
else
{
FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
......@@ -222,6 +293,7 @@ HRESULT list_manager_create( void **obj )
if (!(mgr = HeapAlloc( GetProcessHeap(), 0, sizeof(*mgr) ))) return E_OUTOFMEMORY;
mgr->INetworkListManager_iface.lpVtbl = &list_manager_vtbl;
mgr->INetworkCostManager_iface.lpVtbl = &cost_manager_vtbl;
mgr->refs = 1;
*obj = &mgr->INetworkListManager_iface;
......
......@@ -27,6 +27,7 @@
static void test_INetworkListManager( void )
{
INetworkListManager *mgr;
INetworkCostManager *cost_mgr;
NLM_CONNECTIVITY connectivity;
VARIANT_BOOL connected;
HRESULT hr;
......@@ -55,6 +56,23 @@ static void test_INetworkListManager( void )
ok( hr == S_OK, "got %08x\n", hr );
ok( connected == VARIANT_TRUE || connected == VARIANT_FALSE, "expected boolean value\n" );
INetworkListManager_QueryInterface( mgr, &IID_INetworkCostManager, (void **)&cost_mgr );
ok( hr == S_OK, "got %08x\n", hr );
if (hr == S_OK)
{
DWORD cost;
hr = INetworkCostManager_GetCost( cost_mgr, NULL, NULL );
ok( hr == E_POINTER, "got %08x\n", hr );
cost = 0xdeadbeef;
hr = INetworkCostManager_GetCost( cost_mgr, &cost, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( cost != 0xdeadbeef, "cost not set\n" );
INetworkCostManager_Release( cost_mgr );
}
INetworkListManager_Release( mgr );
}
......
......@@ -27,6 +27,7 @@ interface IEnumNetworks;
interface IEnumNetworkConnections;
interface INetwork;
interface INetworkConnection;
interface INetworkCostManager;
interface INetworkListManager;
typedef [v1_enum] enum NLM_CONNECTIVITY
......@@ -49,6 +50,62 @@ typedef [v1_enum] enum NLM_ENUM_NETWORK
NLM_ENUM_NETWORK_ALL = 0x03
} NLM_ENUM_NETWORK;
typedef [v1_enum] enum NLM_CONNECTION_COST
{
NLM_CONNECTION_COST_UNKNOWN = 0x0,
NLM_CONNECTION_COST_UNRESTRICTED = 0x1,
NLM_CONNECTION_COST_FIXED = 0x2,
NLM_CONNECTION_COST_VARIABLE = 0x4,
NLM_CONNECTION_COST_OVERDATALIMIT = 0x10000,
NLM_CONNECTION_COST_CONGESTED = 0x20000,
NLM_CONNECTION_COST_ROAMING = 0x40000,
NLM_CONNECTION_COST_APPROACHINGDATALIMIT = 0x80000
} NLM_CONNECTION_COST;
typedef struct NLM_SOCKADDR
{
BYTE data[128];
} NLM_SOCKADDR;
typedef struct NLM_USAGE_DATA
{
DWORD UsageInMegabytes;
FILETIME LastSyncTime;
} NLM_USAGE_DATA;
typedef struct NLM_DATAPLAN_STATUS
{
GUID InterfaceGuid;
NLM_USAGE_DATA UsageData;
DWORD DataLimitInMegabytes;
DWORD InboundBandwidthInKbps;
DWORD OutboundBandwidthInKbps;
FILETIME NextBillingCycle;
DWORD MaxTransferSizeInMegabytes;
DWORD Reserved;
} NLM_DATAPLAN_STATUS;
[
object,
pointer_default(unique),
uuid(dcb00008-570f-4a9b-8d69-199fdba5723b)
]
interface INetworkCostManager : IUnknown
{
HRESULT GetCost(
[out] DWORD *pCost,
[in, unique] NLM_SOCKADDR *pDestIPAddr);
HRESULT GetDataPlanStatus(
[out] NLM_DATAPLAN_STATUS *pDataPlanStatus,
[in, unique] NLM_SOCKADDR *pDestIPAddr);
HRESULT SetDestinationAddresses(
[in] UINT32 length,
[in, unique, size_is(length)] NLM_SOCKADDR *pDestIPAddrList,
[in] VARIANT_BOOL bAppend);
}
[
dual,
object,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment