1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/ups/upstypes.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,274 @@
1.4 +/*
1.5 +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* Types required to use the UPS server.
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +/**
1.24 + @file
1.25 + @publishedAll
1.26 + @released
1.27 +*/
1.28 +
1.29 +
1.30 +#ifndef UPSTYPES_H
1.31 +#define UPSTYPES_H
1.32 +#include <e32base.h>
1.33 +
1.34 +#ifdef __WINS__
1.35 +// Work around broken TRAP handling.......... See DEF108105
1.36 +#undef TRAP_INSTRUMENTATION_END
1.37 +#define TRAP_INSTRUMENTATION_END (void)User::Allocator()
1.38 +#endif
1.39 +
1.40 +class RWriteStream;
1.41 +class RReadStream;
1.42 +
1.43 +enum TUpsDecision
1.44 +/**
1.45 + Decisions which can be returned by the UPS server to the
1.46 + system server.
1.47 + */
1.48 + {
1.49 + /**
1.50 + The action can be performed. This response does not distinguish
1.51 + between a one-shot or an always approval.
1.52 + */
1.53 + EUpsDecYes,
1.54 + /**
1.55 + The action cannot be performed.
1.56 + */
1.57 + EUpsDecNo,
1.58 + /**
1.59 + The action can be performed for a session, as defined by the
1.60 + system server.
1.61 + */
1.62 + EUpsDecSessionYes,
1.63 + /**
1.64 + The action can not be performed for a session, as defined by the
1.65 + system server.
1.66 + */
1.67 + EUpsDecSessionNo
1.68 +
1.69 + };
1.70 +
1.71 +/**
1.72 + Convenience typedef wraps up an instance of TUpsDecision which
1.73 + can be supplied to a server. Note the APIs themselves take TDes8&
1.74 + arguments, not specifically references to an instance of this type.
1.75 + */
1.76 +typedef TPckgBuf<TUpsDecision> TUpsDecisionPckgBuf;
1.77 +
1.78 +/**
1.79 +Uniquely identifies a service. UIDs should be reserved via Symbian Signed.
1.80 + */
1.81 +typedef TUid TServiceId;
1.82 +
1.83 +namespace UserPromptService
1.84 +{
1.85 +
1.86 +//Number of columns exist in a filter key
1.87 +static const TUint8 KFilterKeysNumber = 0x0B;
1.88 +
1.89 +/** Comparision types used in the querying of the decision database. */
1.90 +//4 bytes on the right side are used to indicate whether a columns is set.
1.91 +enum TComparisonOp
1.92 + {
1.93 + EEqual = 0x00010000,
1.94 + ENotEqual = 0x00020000,
1.95 + ELessThan = 0x00040000,
1.96 + EGreaterThan = 0x00080000,
1.97 + ELessThanOrEqual = 0x00100000,
1.98 + EGreaterThanOrEqual = 0x00200000
1.99 + };
1.100 +
1.101 +NONSHARABLE_CLASS(CDecisionFilter):public CBase
1.102 +/**
1.103 + Stores the filter key values that used to query the database.
1.104 + A filter object can be created in one phase by supplying all required parameters,
1.105 + or an empty filter is first created and then required filter keys are set separately.
1.106 + */
1.107 + {
1.108 + friend class CDecisionDb;
1.109 + friend class CDecisionDbW;
1.110 +
1.111 +public:
1.112 + IMPORT_C static CDecisionFilter *NewL ();
1.113 + IMPORT_C static CDecisionFilter *NewLC();
1.114 + IMPORT_C static CDecisionFilter *NewL (const TSecureId& aClientSid,const TUid& aEvaluatorId,const TUid& aServiceId,const TSecureId& aServerSid,
1.115 + const TDesC8& aFingerprint,const TDesC8& aClientEntity,const TUint16& aVersion);
1.116 + IMPORT_C static CDecisionFilter *NewLC(const TSecureId& aClientSid,const TUid& aEvaluatorId,const TUid& aServiceId,const TSecureId& aServerSid,
1.117 + const TDesC8& aFingerprint,const TDesC8& aClientEntity,const TUint16& aVersion);
1.118 + ~CDecisionFilter();
1.119 +
1.120 + IMPORT_C void SetClientSid(const TSecureId& aSid, const TComparisonOp aOp);
1.121 + IMPORT_C void SetEvaluatorId(const TUid& aUid, const TComparisonOp aOp);
1.122 + IMPORT_C void SetServiceId(const TUid& aUid, const TComparisonOp aOp);
1.123 + IMPORT_C void SetServerSid(const TSecureId& aSid, const TComparisonOp aOp);
1.124 + IMPORT_C void SetFingerprintL(const TDesC8& aFingerprint, const TComparisonOp aOp);
1.125 + IMPORT_C void SetClientEntityL(const TDesC8& aClientEntity, const TComparisonOp aOp);
1.126 + IMPORT_C void SetMajorPolicyVersion(const TUint16& aVersion, const TComparisonOp aOp);
1.127 + IMPORT_C void SetRecordId(const TUint32& aId, const TComparisonOp aOp);
1.128 + IMPORT_C void SetDescriptionL(const TDesC& aDescription, const TComparisonOp aOp);
1.129 + IMPORT_C void SetResult(const TUint8& aResult, const TComparisonOp aOp);
1.130 + IMPORT_C void SetEvaluatorInfo(const TUint32& aEvaluatorInfo, const TComparisonOp aOp);
1.131 +
1.132 + IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
1.133 + IMPORT_C void InternalizeL(RReadStream& aStream);
1.134 +private:
1.135 + CDecisionFilter();
1.136 + CDecisionFilter(const TSecureId& aClientSid, const TUid& aEvaluatorId, const TUid& aServiceId, const TSecureId& aServerSid, const TUint16& aVersion);
1.137 +
1.138 + void ConstructL(const TDesC8& aFingerprint, const TDesC8& aClientEntity);
1.139 + void ValidateL();
1.140 +
1.141 +private:
1.142 + /**
1.143 + Secure Id for client application
1.144 + */
1.145 + TSecureId iClientSid;
1.146 + /**
1.147 + UID for the policy evaluator DLL
1.148 + */
1.149 + TUid iEvaluatorId;
1.150 + /**
1.151 + UID for service
1.152 + */
1.153 + TUid iServiceId;
1.154 + /**
1.155 + Secure Id for system server
1.156 + */
1.157 + TSecureId iServerSid;
1.158 + /**
1.159 + Fingerprint.
1.160 + NULL pointer if not specified.
1.161 + */
1.162 + HBufC8* iFingerprint;
1.163 + /**
1.164 + Name of the entity within client
1.165 + NULL pointer if not specified.
1.166 + */
1.167 + HBufC8* iClientEntity;
1.168 + /**
1.169 + An array of flags which shows which attributes are set and what operator(=,!=,<,>, etc.) is assigned.
1.170 + NULL pointer if not specified.
1.171 + */
1.172 + TUint32 iSetFlag[KFilterKeysNumber];
1.173 + /**
1.174 + Major version of policy file.
1.175 + */
1.176 + TUint16 iMajorPolicyVersion;
1.177 + /**
1.178 + Unique decision record Id.
1.179 + */
1.180 + TUint32 iRecordId;
1.181 + /**
1.182 + A copy of description and/or opaque
1.183 + */
1.184 + HBufC* iDescription;
1.185 + /**
1.186 + Whether the request should be approved
1.187 + */
1.188 + TUint8 iResult;
1.189 + /**
1.190 + Policy evaluator specific data
1.191 + */
1.192 + TUint32 iEvaluatorInfo;
1.193 + };
1.194 +
1.195 +
1.196 +NONSHARABLE_CLASS(CDecisionRecord):public CBase
1.197 +/**
1.198 + Stores all the field values in a decision database row. All member variables of the class
1.199 + are constant and public. Therefore, the members are assigned during construction and then
1.200 + they can be accessible directly, however, it is not possible to modify them.
1.201 + */
1.202 + {
1.203 +public:
1.204 + IMPORT_C static CDecisionRecord *NewL(const TSecureId& aClientSid,const TUid& aEvaluatorId,const TUid& aServiceId,const TSecureId& aServerSid,const TDesC8& aFingerprint,
1.205 + const TDesC8& aClientEntity,const TDesC& aDescription, const TUint8 aResult,const TUint16& aMajorPolicyVersion,
1.206 + const TUint32 aEvaluatorInfo, const TUint32& aRecordId=0);
1.207 +
1.208 + IMPORT_C static CDecisionRecord *NewLC(const TSecureId& aClientSid,const TUid& aEvaluatorId,const TUid& aServiceId,const TSecureId& aServerSid,const TDesC8& aFingerprint,
1.209 + const TDesC8& aClientEntity,const TDesC& aDescription, const TUint8 aResult,const TUint16& aMajorPolicyVersion,
1.210 + const TUint32 aEvaluatorInfo, const TUint32& aRecordId=0);
1.211 +
1.212 + IMPORT_C static CDecisionRecord *NewLC();
1.213 + ~CDecisionRecord();
1.214 +
1.215 + IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
1.216 + IMPORT_C void InternalizeL(RReadStream& aStream);
1.217 +
1.218 +private:
1.219 + CDecisionRecord();
1.220 + CDecisionRecord(const TSecureId& aClientSid,const TUid& aEvaluatorId,const TUid& aServiceId,const TSecureId& aServerSid,const TUint8 aResult,
1.221 + const TUint16& aMajorPolicyVersion, const TUint32 aEvaluatorInfo, const TUint32& aRecordId);
1.222 +
1.223 + void ConstructL(const TDesC8& aFingerprint,const TDesC8& aClientEntity,const TDesC& aDescription);
1.224 + void ValidateL();
1.225 +
1.226 +public:
1.227 + /**
1.228 + Secure Id of client application
1.229 + */
1.230 + TSecureId iClientSid;
1.231 + /**
1.232 + UID for the policy evaluator DLL
1.233 + */
1.234 + TUid iEvaluatorId;
1.235 + /**
1.236 + UID for service
1.237 + */
1.238 + TUid iServiceId;
1.239 + /**
1.240 + Secure Id for system server
1.241 + */
1.242 + TSecureId iServerSid;
1.243 + /**
1.244 + Fingerprint
1.245 + */
1.246 + RBuf8 iFingerprint;
1.247 + /**
1.248 + Name of the entity within client
1.249 + */
1.250 + RBuf8 iClientEntity;
1.251 + /**
1.252 + A copy of description and/or opaque
1.253 + */
1.254 + RBuf iDescription;
1.255 + /**
1.256 + Whether the request should be approved
1.257 + */
1.258 + TUint8 iResult;
1.259 + /**
1.260 + Major policy version which this decision record possesses to.
1.261 + */
1.262 + TUint16 iMajorPolicyVersion;
1.263 + /**
1.264 + Unique decision record Id.
1.265 + */
1.266 + TUint32 iRecordId;
1.267 + /**
1.268 + Policy evaluator specific data
1.269 + */
1.270 + TUint32 iEvaluatorInfo;
1.271 + };
1.272 +
1.273 +} // End of UserPromptService namespace
1.274 +
1.275 +
1.276 +#endif // #ifndef UPSTYPES_H
1.277 +