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