userlibandfileserver/domainmgr/src/domainpolicy.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 11:14:22 +0300
branchRCL_3
changeset 42 a179b74831c9
parent 0 a41df078684a
permissions -rw-r--r--
Revision: 201033 Kit: 201033

// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// domain\src\domainpolicy.cpp
// 
//

#include "domainpolicy.h"

const TInt KDomainTimeout = 1000000; /* 1000ms */

// Domain spec and policy for the domain hierarchy
static const TDmDomainSpec DomainHierarchy[] = 
	{
		{ KDmIdRoot,	KDmIdNone,	_INIT_SECURITY_POLICY_C1(ECapabilityWriteDeviceData),	EPwActive,	KDomainTimeout	},
		{ KDmIdApps,	KDmIdRoot,	_INIT_SECURITY_POLICY_PASS,								EPwActive,	KDomainTimeout	},
		{ KDmIdUiApps,	KDmIdRoot,	_INIT_SECURITY_POLICY_PASS,								EPwActive,	KDomainTimeout	},
		// end of array marker
		{ KDmIdNone,	KDmIdNone,	_INIT_SECURITY_POLICY_PASS,								0,			0	}	
	};

static const TDmHierarchyPolicy HierarchyPolicyPower	= 
	{ETraverseChildrenFirst, ETraverseParentsFirst, ETransitionFailureContinue};



/**
Gets access to the domain hierarchy specification.

The domain hierarchy specification is a simple array of TDmDomainSpec items.

The default implementation provided by Symbian OS just returns a pointer to
the domain hierarchy specification array.

@return A pointer to the domain hierarchy specification array.
*/
EXPORT_C const TDmDomainSpec* DmPolicy::GetDomainSpecs()
	{
	return (TDmDomainSpec*) DomainHierarchy;
	}




/**
Releases access to the specified domain hierarchy specification.

The domain hierarchy specification is a simple array of TDmDomainSpec items.

As the default Symbian OS implementation of GetDomainSpecs() just returns
a pointer to the domain hierarchy specification array, then the default
implementation of Release() is empty. The API is provided to permit
more complex implementations, if required.

@param aDomainSpec A pointer to the domain hierarchy specification array.
*/
EXPORT_C void DmPolicy::Release(const TDmDomainSpec* /*aDomainSpec*/)
	{
	}


/**
Retrieves the domain hierarchy policy. 

@param	aPolicy a client-supplied policy which on exit
		will contain a copy of the policy for the requested domain hierarchy Id.

  
@return	KErrNone
*/
EXPORT_C TInt DmPolicy::GetPolicy(TDmHierarchyPolicy& aPolicy)
	{
	aPolicy = HierarchyPolicyPower;
	return KErrNone;
	}