sl@0: /* sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * Client-side API via which the system server uses the user prompt service. sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: sl@0: #ifndef UPSCLIENT_H sl@0: #define UPSCLIENT_H sl@0: sl@0: sl@0: #include sl@0: #include sl@0: sl@0: namespace UserPromptService sl@0: { sl@0: sl@0: class CUpsClientConfig; sl@0: class CPolicyChangeWatcher; sl@0: class RUpsSession : public RScsClientBase sl@0: /** sl@0: The system server uses this class to establish a connection with sl@0: the UPS server. sl@0: sl@0: Internally it retrieves and caches authorisation policy information for all the sl@0: services supported by the current server SID. This information is used to allow sl@0: the RUpsSubsession to avoid creating a subsession and/or querying the UPS sl@0: if the request does not require UPS interaction. sl@0: sl@0: */ sl@0: { sl@0: public: sl@0: IMPORT_C RUpsSession(); sl@0: IMPORT_C TInt Connect(); sl@0: IMPORT_C void Close(); sl@0: sl@0: public: sl@0: void NotifyPolicyFileChangedL(); sl@0: sl@0: private: sl@0: friend class RUpsSubsession; sl@0: CPolicyChangeWatcher *iPolicyChangeWatcher; sl@0: void RetrieveClientConfigL(); sl@0: CUpsClientConfig* iClientConfig; sl@0: }; sl@0: sl@0: class RUpsManagement : public RScsClientBase sl@0: /** sl@0: This class supports the management API for the UPS. sl@0: */ sl@0: { sl@0: public: sl@0: IMPORT_C RUpsManagement(); sl@0: IMPORT_C TInt Connect(); sl@0: IMPORT_C void Close(); sl@0: sl@0: // Needs ReadDeviceData sl@0: IMPORT_C void CreateView(const CDecisionFilter& aFilter, TRequestStatus &aStatus); sl@0: IMPORT_C CDecisionRecord *NextMatchL(); sl@0: IMPORT_C void CancelAndCloseView(); sl@0: sl@0: // Needs WriteDeviceData sl@0: IMPORT_C void RemoveDecisionsL(const CDecisionFilter& aFilter); sl@0: IMPORT_C void DeleteDatabaseL(); sl@0: sl@0: // Needs AllFiles sl@0: IMPORT_C void UpdateDecision(TUint32 aRecordId, TBool aAllow, TRequestStatus &aStatus); sl@0: IMPORT_C void CancelUpdateDecision(); sl@0: sl@0: /** sl@0: The following three APIs are only for use by the UPS swi observer plugin and are discouraged for general use sl@0: */ sl@0: IMPORT_C void DeleteDecisionsForExeL(const TSecureId& aExeSid); sl@0: IMPORT_C void NotifyPluginsMayHaveChangedL(); sl@0: IMPORT_C void NotifyPolicyFilesChanged(TRequestStatus &aStatus); sl@0: IMPORT_C void CancelNotifyPolicyFilesChanged(); sl@0: sl@0: private: sl@0: RBuf8 iCreateViewFilterBuf; sl@0: TPckgBuf iMatchLengthBuf; sl@0: }; sl@0: sl@0: class RUpsSubsession : public RScsClientSubsessionBase sl@0: /** sl@0: System servers use this class to establish a connection to the UPS for a specific sl@0: client.\n sl@0: Before checking a request with the User Prompt Service the Authorise method sl@0: first checks whether authorisation from the User Prompt Service is required. If sl@0: authorisation is not required e.g. the client has the correct capabilities for the sl@0: service then Authorise completes immediately. sl@0: */ sl@0: { sl@0: public: sl@0: IMPORT_C RUpsSubsession(); sl@0: IMPORT_C TInt Initialise(RUpsSession& aSession, const RThread& aClient); sl@0: sl@0: IMPORT_C void Authorise(TBool aServerCheckOk, sl@0: const TServiceId& aServiceId, const TDesC& aDestination, sl@0: TUpsDecision& aDecision, TRequestStatus& aStatus); sl@0: IMPORT_C void Authorise(TBool aServerCheckOk, sl@0: const TServiceId& aServiceId, const TDesC& aDestination, sl@0: const TDesC8& aOpaqueData, sl@0: TUpsDecision& aDecision, TRequestStatus& aStatus); sl@0: IMPORT_C void CancelPrompt(); sl@0: sl@0: IMPORT_C void Close(); sl@0: sl@0: private: sl@0: TInt CreateSubsession(); sl@0: void AuthoriseInternal(TBool aServerCheckOk, sl@0: const TServiceId& aServiceId, const TDesC& aDestination, const TDesC8& aOpaqueData, sl@0: TUpsDecision& aDecision, TRequestStatus& aStatus); sl@0: TInt PreparePrompt(const TServiceId& aServiceId, const TDesC& aDestination, const TDesC8& aOpaqueData); sl@0: void ExecutePrompt(TBool aServerCheckOk, TUpsDecision& aDecision, TRequestStatus& aStatus); sl@0: sl@0: private: sl@0: /** Describes the TUpsDecision reference passed into Authorise. */ sl@0: TPtr8 iDecPtr; sl@0: sl@0: TBool iSubsessionCreated; sl@0: TThreadId iClientTid; sl@0: TSecureId iClientSid; sl@0: TProcessId iClientPid; sl@0: RUpsSession* iUpsSession; sl@0: }; sl@0: sl@0: } // End of namespace UserPromptService sl@0: sl@0: #endif // #ifndef UPSCLIENT_H sl@0: