rtsecuritymanager/rtsecuritymanagerserver/inc/rtsecmgrpolicy.h
changeset 57 61b27eec6533
parent 45 7aa6007702af
equal deleted inserted replaced
45:7aa6007702af 57:61b27eec6533
     1 /*
       
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:       Defines security policy data structure 
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef C_RTSECMGRPOLICY_H
       
    24 #define C_RTSECMGRPOLICY_H
       
    25 
       
    26 #include <e32capability.h>
       
    27 #include <rtsecmgrutility.h>
       
    28 #include <rtsecmgrscript.h>
       
    29 #include "rtsecmgrdef.h"
       
    30 #include "rtsecmgrprotectiondomain.h"
       
    31 
       
    32 class CProtectionDomain;
       
    33 
       
    34 typedef RPointerArray<CProtectionDomain> RProtectionDomains;
       
    35 typedef RPointerArray<CPermission> RAliasGroup;
       
    36 
       
    37 /*
       
    38  * Represents a security and trust policy mapping. This class maps
       
    39  * the policyID and its associated security and trust policies.
       
    40  *
       
    41  * A CPolicy instance has list of protection domains specified
       
    42  * in the security access policy and list of trust information. The 
       
    43  * security access policy and trust policy are associated with a policy
       
    44  * identifier
       
    45  * 
       
    46  * @see CProtectionDomain
       
    47  * @see CPermission
       
    48  * 
       
    49  * @exe rtsecmgrserver.exe 
       
    50  */
       
    51 NONSHARABLE_CLASS(CPolicy) : public CBase
       
    52 	{
       
    53 public:
       
    54 
       
    55 	/**
       
    56 	 * Two-phased constructor
       
    57 	 * 
       
    58 	 * Constructs a CPolicy instance from an input serialization
       
    59 	 * source
       
    60 	 * 
       
    61 	 * @param aPolicyID TPolicyID policy identifier
       
    62 	 * @param aSource 	RStoreReadStream& input source
       
    63 	 * 
       
    64 	 * @return CPolicy * pointer to an instance of CPolicy
       
    65 	 */
       
    66 	static CPolicy* NewL(TPolicyID aPolicyID, RStoreReadStream& aSource);
       
    67 	
       
    68 	/**
       
    69 	 * Two-phased constructor
       
    70 	 * 
       
    71 	 * Constructs a CPolicy instance from an input serialization
       
    72 	 * source and leaves the created instance on the cleanupstack
       
    73 	 * 
       
    74 	 * @param aPolicyID TPolicyID policy identifier
       
    75 	 * @param aSource 	RStoreReadStream& input source
       
    76 	 * 
       
    77 	 * @return CPolicy * pointer to an instance of CPolicy
       
    78 	 */
       
    79 	static CPolicy* NewLC(TPolicyID aPolicyID, RStoreReadStream& aSource);
       
    80 
       
    81 	/**
       
    82 	 * Two-phased constructor
       
    83 	 * 
       
    84 	 * Constructs a CPolicy instance and initializes the policy identifier
       
    85 	 * and the security access policy domain data
       
    86 	 * 
       
    87 	 * @param aPolicyID TPolicyID policy identifier
       
    88 	 * @param aProtectionDomains RProtectionDomains& input security protection domains
       
    89 	 * @param aAliasGroup RAliasGroup& input capability grouping
       
    90 	 * 
       
    91 	 * @return CPolicy * pointer to an instance of CPolicy
       
    92 	 */
       
    93 	static CPolicy* NewL(TPolicyID aPolicyID, const RProtectionDomains& aProtectionDomains, RAliasGroup& aAliasGroup);
       
    94 
       
    95 	/**
       
    96 	 * Two-phased constructor
       
    97 	 * 
       
    98 	 * Constructs a CPolicy instance and initializes the policy identifier
       
    99 	 * and the security access policy domain data. This method leaves the
       
   100 	 * created instance on the cleanupstack.
       
   101 	 * 
       
   102 	 * @param aPolicyID TPolicyID policy identifier
       
   103 	 * @param aProtectionDomains RProtectionDomains& input security protection domains
       
   104 	 * @param aAliasGroup RAliasGroup& input capability grouping
       
   105 	 * 
       
   106 	 * @return CPolicy * pointer to an instance of CPolicy
       
   107 	 */
       
   108 	static CPolicy* NewLC(TPolicyID aPolicyID, const RProtectionDomains& aProtectionDomains, RAliasGroup& aAliasGroup);
       
   109 
       
   110 	/**
       
   111 	 * Internalizes CPolicy data members from the input readable source
       
   112 	 * 
       
   113 	 * @param aSource RStoreReadStream& Input readable source
       
   114 	 * 
       
   115 	 */
       
   116 	void InternalizeL(RStoreReadStream& aSource);
       
   117 
       
   118 	/**
       
   119 	 * Gets a protection domain instance when a valid domain 
       
   120 	 * name is passed.
       
   121 	 * 
       
   122 	 * @param aDomainName const TDesC& name of the protection domain
       
   123 	 * 
       
   124 	 * @return CProtectionDomain* valid protection domain instance; NULL if
       
   125 	 * domain name is invalid or does not exist
       
   126 	 * 
       
   127 	 */
       
   128 	CProtectionDomain* ProtectionDomain(const TDesC& aDomainName) const;		
       
   129 
       
   130 	/**
       
   131 	 * Gets policy identifier of the security and trust policy
       
   132 	 * data
       
   133 	 * 
       
   134 	 * @return TPolicyID policy identifier
       
   135 	 * 
       
   136 	 */
       
   137 	inline TPolicyID PolicyID() const;
       
   138 	
       
   139 	/**
       
   140 	 * Gets the list of protection domains associated with
       
   141 	 * the policy identifier
       
   142 	 *
       
   143 	 * @return const RProtectionDomains& protection domain list
       
   144 	 * 
       
   145 	 */
       
   146 	inline const RProtectionDomains& ProtectionDomain() const;
       
   147 
       
   148 	/**
       
   149 	 * virtual destructor
       
   150 	 *  
       
   151 	 */
       
   152 	inline ~CPolicy();
       
   153 	
       
   154 	/**
       
   155 	 * Gets a alias group instance when a valid alias group
       
   156 	 * name is passed.
       
   157 	 * 
       
   158 	 * @param aAliasName const TDesC& name of the alias group
       
   159 	 * 
       
   160 	 * @return CPermission* valid alias group instance; NULL if
       
   161 	 * alias group name is invalid or does not exist
       
   162 	 * 
       
   163 	 */
       
   164 	CPermission* AliasGroup(const TDesC& aAliasName) const;		
       
   165 
       
   166 	/**
       
   167 	 * Gets the list of alias groups associated with
       
   168 	 * the policy identifier
       
   169 	 *
       
   170 	 * @return const RAliasGroup& alias group list
       
   171 	 * 
       
   172 	 */
       
   173 	inline const RAliasGroup& AliasGroup() const;
       
   174 
       
   175 private:
       
   176 	/*
       
   177 	 * private default constructor
       
   178 	 */
       
   179 	CPolicy();
       
   180 	
       
   181 	/*
       
   182 	 * Overloaded constructor to initialise policy identifier
       
   183 	 * 
       
   184 	 */
       
   185 	CPolicy(TPolicyID aPolicyID);
       
   186 	
       
   187 	/*
       
   188 	 * Two-phase constructor
       
   189 	 * 
       
   190 	 * Initializes policy identifier, security protection domains and alias groupings
       
   191 	 * 
       
   192 	 */
       
   193 	void ConstructL(const RProtectionDomains& aAccessPolicy, RAliasGroup& aAliasGroup);
       
   194 
       
   195 private:	
       
   196 	/*
       
   197 	 * Policy identifier
       
   198 	 */
       
   199 	TPolicyID iPolicyID;
       
   200 	
       
   201 	/*
       
   202 	 * Array of protection domains
       
   203 	 * 
       
   204 	 * Own.
       
   205 	 */
       
   206 	RProtectionDomains iAccessPolicy;
       
   207 	
       
   208 	/*
       
   209 	 * Array of alias groupings
       
   210 	 * 
       
   211 	 * Own.
       
   212 	 */
       
   213 	RAliasGroup iAliasGroup;
       
   214 	};
       
   215 
       
   216 #include "rtsecmgrpolicy.inl"
       
   217 	
       
   218 #endif //C_RTSECMGRPOLICY_H
       
   219