epoc32/include/ups/upstypes.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2007-2009 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: 
    15 * Types required to use the UPS server.
    16 *
    17 */
    18 
    19 
    20 /**
    21  @file
    22  @publishedAll
    23  @released
    24 */
    25 
    26 
    27 #ifndef UPSTYPES_H
    28 #define UPSTYPES_H
    29 #include <e32base.h>
    30 
    31 #ifdef __WINS__
    32 // Work around broken TRAP handling.......... See DEF108105
    33 #undef TRAP_INSTRUMENTATION_END
    34 #define TRAP_INSTRUMENTATION_END (void)User::Allocator()
    35 #endif
    36 
    37 class RWriteStream;
    38 class RReadStream;
    39 
    40 enum TUpsDecision
    41 /**
    42 	Decisions which can be returned by the UPS server to the
    43 	system server.
    44  */
    45 	{
    46 	/**
    47 		The action can be performed.  This response does not distinguish
    48 		between a one-shot or an always approval.
    49 	 */
    50 	EUpsDecYes,
    51 	/**
    52 		The action cannot be performed.
    53 	 */
    54 	EUpsDecNo,
    55 	/**
    56 		The action can be performed for a session, as defined by the
    57 		system server.
    58 	 */
    59 	EUpsDecSessionYes,
    60 	/**
    61 		The action can not be performed for a session, as defined by the
    62 		system server.
    63 	 */
    64 	EUpsDecSessionNo
    65 
    66 	};
    67 
    68 /**
    69 	Convenience typedef wraps up an instance of TUpsDecision which
    70 	can be supplied to a server.  Note the APIs themselves take TDes8&
    71 	arguments, not specifically references to an instance of this type.
    72  */
    73 typedef TPckgBuf<TUpsDecision> TUpsDecisionPckgBuf;
    74 
    75 /**
    76 Uniquely identifies a service. UIDs should be reserved via Symbian Signed.
    77  */
    78 typedef TUid TServiceId;
    79 
    80 namespace UserPromptService
    81 {
    82 
    83 //Number of columns exist in a filter key
    84 static const TUint8  KFilterKeysNumber			= 0x0B;
    85 
    86 /** Comparision types used in the querying of the decision database. */
    87 //4 bytes on the right side are used to indicate whether a columns is set.
    88 enum TComparisonOp
    89 	{
    90 	EEqual  			= 0x00010000,
    91 	ENotEqual  			= 0x00020000,
    92 	ELessThan  			= 0x00040000,
    93 	EGreaterThan  		= 0x00080000,
    94 	ELessThanOrEqual    = 0x00100000,
    95 	EGreaterThanOrEqual = 0x00200000
    96 	};
    97 
    98 NONSHARABLE_CLASS(CDecisionFilter):public CBase
    99 /**
   100    Stores the filter key values that used to query the database. 
   101    A filter object can be created in one phase by supplying all required parameters, 
   102    or an empty filter is first created and then required filter keys are set separately.
   103  */
   104 	{	
   105 	friend class CDecisionDb;
   106 	friend class CDecisionDbW;
   107 	
   108 public:
   109 	IMPORT_C static CDecisionFilter *NewL ();	
   110 	IMPORT_C static CDecisionFilter *NewLC();
   111 	IMPORT_C static CDecisionFilter *NewL (const TSecureId& aClientSid,const TUid& aEvaluatorId,const TUid& aServiceId,const TSecureId& aServerSid,
   112 										   const TDesC8& aFingerprint,const TDesC8& aClientEntity,const TUint16& aVersion);										  
   113 	IMPORT_C static CDecisionFilter *NewLC(const TSecureId& aClientSid,const TUid& aEvaluatorId,const TUid& aServiceId,const TSecureId& aServerSid,
   114 										   const TDesC8& aFingerprint,const TDesC8& aClientEntity,const TUint16& aVersion);		
   115 	~CDecisionFilter();
   116 	
   117 	IMPORT_C void SetClientSid(const TSecureId& aSid, const TComparisonOp aOp);	
   118 	IMPORT_C void SetEvaluatorId(const TUid& aUid, const TComparisonOp aOp);
   119 	IMPORT_C void SetServiceId(const TUid& aUid, const TComparisonOp aOp);
   120 	IMPORT_C void SetServerSid(const TSecureId& aSid, const TComparisonOp aOp);
   121 	IMPORT_C void SetFingerprintL(const TDesC8& aFingerprint, const TComparisonOp aOp);
   122 	IMPORT_C void SetClientEntityL(const TDesC8& aClientEntity, const TComparisonOp aOp);
   123 	IMPORT_C void SetMajorPolicyVersion(const TUint16& aVersion, const TComparisonOp aOp);
   124 	IMPORT_C void SetRecordId(const TUint32& aId, const TComparisonOp aOp);
   125 	IMPORT_C void SetDescriptionL(const TDesC& aDescription, const TComparisonOp aOp);
   126 	IMPORT_C void SetResult(const TUint8& aResult, const TComparisonOp aOp);
   127 	IMPORT_C void SetEvaluatorInfo(const TUint32& aEvaluatorInfo, const TComparisonOp aOp);
   128 
   129 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
   130 	IMPORT_C void InternalizeL(RReadStream& aStream);
   131 private:
   132 	CDecisionFilter();
   133 	CDecisionFilter(const TSecureId& aClientSid, const TUid& aEvaluatorId, const TUid& aServiceId, const TSecureId& aServerSid, const TUint16& aVersion);	
   134 	
   135 	void ConstructL(const TDesC8& aFingerprint, const TDesC8& aClientEntity);
   136 	void ValidateL();
   137 	
   138 private:
   139 	/**
   140 	   Secure Id for client application
   141 	 */
   142 	TSecureId iClientSid;	
   143 	/**
   144 	   UID for the policy evaluator DLL
   145 	 */
   146 	TUid iEvaluatorId;	
   147 	/**
   148 	   UID for service
   149 	 */
   150 	TUid iServiceId;	
   151 	/**
   152 	   Secure Id for system server
   153 	 */	
   154 	TSecureId iServerSid;	
   155 	/**
   156 	   Fingerprint.
   157 	   NULL pointer if not specified.
   158 	 */
   159 	HBufC8* iFingerprint; 	
   160 	/**
   161 	   Name of the entity within client
   162 	   NULL pointer if not specified.
   163 	 */
   164 	HBufC8* iClientEntity;	
   165 	/**
   166 	   An array of flags which shows which attributes are set and what operator(=,!=,<,>, etc.) is assigned.
   167 	   NULL pointer if not specified.
   168 	 */
   169 	TUint32 iSetFlag[KFilterKeysNumber];
   170 	/**
   171 		Major version of policy file.
   172 	 */
   173 	TUint16 iMajorPolicyVersion;
   174 	/**
   175 		Unique decision record Id.
   176 	 */
   177 	TUint32 iRecordId;
   178 	/**
   179 	   A copy of description and/or opaque
   180 	 */
   181 	HBufC* iDescription;
   182 	/**
   183 	   Whether the request should be approved
   184 	 */
   185 	TUint8 iResult;	
   186 	/**
   187 	   Policy evaluator specific data
   188 	 */
   189 	TUint32 iEvaluatorInfo;	
   190 	};
   191 
   192 
   193 NONSHARABLE_CLASS(CDecisionRecord):public CBase
   194 /**
   195 	Stores all the field values in a decision database row. All member variables of the class 
   196     are constant and public. Therefore, the members are assigned during construction and then 
   197     they can be accessible directly, however, it is not possible to modify them.
   198  */
   199 	{
   200 public:
   201 	IMPORT_C static CDecisionRecord *NewL(const TSecureId& aClientSid,const TUid& aEvaluatorId,const TUid& aServiceId,const TSecureId& aServerSid,const TDesC8& aFingerprint,
   202 								 		  const TDesC8& aClientEntity,const TDesC& aDescription, const TUint8 aResult,const TUint16& aMajorPolicyVersion,
   203 								 		  const TUint32 aEvaluatorInfo, const TUint32& aRecordId=0);
   204 							  							  
   205 	IMPORT_C static CDecisionRecord *NewLC(const TSecureId& aClientSid,const TUid& aEvaluatorId,const TUid& aServiceId,const TSecureId& aServerSid,const TDesC8& aFingerprint,
   206  								 		   const TDesC8& aClientEntity,const TDesC& aDescription, const TUint8 aResult,const TUint16& aMajorPolicyVersion,
   207  								 		   const TUint32 aEvaluatorInfo, const TUint32& aRecordId=0);
   208 
   209 	IMPORT_C static CDecisionRecord *NewLC();
   210 	~CDecisionRecord();
   211 
   212 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
   213 	IMPORT_C void InternalizeL(RReadStream& aStream);
   214 
   215 private:
   216 	CDecisionRecord();
   217 	CDecisionRecord(const TSecureId& aClientSid,const TUid& aEvaluatorId,const TUid& aServiceId,const TSecureId& aServerSid,const TUint8 aResult,
   218 				    const TUint16& aMajorPolicyVersion, const TUint32 aEvaluatorInfo, const TUint32& aRecordId);
   219 	
   220 	void ConstructL(const TDesC8& aFingerprint,const TDesC8& aClientEntity,const TDesC& aDescription);
   221 	void ValidateL();
   222 
   223 public:
   224 	/**
   225 	   Secure Id of client application
   226 	 */
   227 	TSecureId iClientSid;
   228 	/**
   229 	   UID for the policy evaluator DLL
   230 	 */
   231 	TUid iEvaluatorId;	
   232 	/**
   233 	   UID for service
   234 	 */
   235 	TUid iServiceId;	
   236 	/**
   237 	   Secure Id for system server
   238 	 */	
   239 	TSecureId iServerSid;	
   240 	/**
   241 	   Fingerprint
   242 	 */
   243 	RBuf8 iFingerprint; 	
   244 	/**
   245 	   Name of the entity within client
   246 	 */
   247 	RBuf8 iClientEntity;	
   248 	/**
   249 	   A copy of description and/or opaque
   250 	 */
   251 	RBuf iDescription;	
   252 	/**
   253 	   Whether the request should be approved
   254 	 */
   255 	TUint8 iResult;	
   256 	/**
   257 		Major policy version which this decision record possesses to.
   258 	 */	
   259 	TUint16 iMajorPolicyVersion;
   260 	/**
   261 		Unique decision record Id.
   262 	 */
   263 	TUint32 iRecordId;
   264 	/**
   265 	   Policy evaluator specific data
   266 	 */
   267 	TUint32 iEvaluatorInfo;
   268 	};
   269 
   270 } // End of UserPromptService namespace
   271 
   272 
   273 #endif	// #ifndef UPSTYPES_H
   274