1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/ups/upsclient.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,148 @@
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 +* Client-side API via which the system server uses the user prompt service.
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 +#ifndef UPSCLIENT_H
1.30 +#define UPSCLIENT_H
1.31 +
1.32 +
1.33 +#include <scs/scsclient.h>
1.34 +#include <ups/upstypes.h>
1.35 +
1.36 +namespace UserPromptService
1.37 + {
1.38 +
1.39 +class CUpsClientConfig;
1.40 +class CPolicyChangeWatcher;
1.41 +class RUpsSession : public RScsClientBase
1.42 +/**
1.43 + The system server uses this class to establish a connection with
1.44 + the UPS server.
1.45 +
1.46 + Internally it retrieves and caches authorisation policy information for all the
1.47 + services supported by the current server SID. This information is used to allow
1.48 + the RUpsSubsession to avoid creating a subsession and/or querying the UPS
1.49 + if the request does not require UPS interaction.
1.50 +
1.51 + */
1.52 + {
1.53 +public:
1.54 + IMPORT_C RUpsSession();
1.55 + IMPORT_C TInt Connect();
1.56 + IMPORT_C void Close();
1.57 +
1.58 +public:
1.59 + void NotifyPolicyFileChangedL();
1.60 +
1.61 +private:
1.62 + friend class RUpsSubsession;
1.63 + CPolicyChangeWatcher *iPolicyChangeWatcher;
1.64 + void RetrieveClientConfigL();
1.65 + CUpsClientConfig* iClientConfig;
1.66 + };
1.67 +
1.68 +class RUpsManagement : public RScsClientBase
1.69 +/**
1.70 + This class supports the management API for the UPS.
1.71 + */
1.72 + {
1.73 +public:
1.74 + IMPORT_C RUpsManagement();
1.75 + IMPORT_C TInt Connect();
1.76 + IMPORT_C void Close();
1.77 +
1.78 + // Needs ReadDeviceData
1.79 + IMPORT_C void CreateView(const CDecisionFilter& aFilter, TRequestStatus &aStatus);
1.80 + IMPORT_C CDecisionRecord *NextMatchL();
1.81 + IMPORT_C void CancelAndCloseView();
1.82 +
1.83 + // Needs WriteDeviceData
1.84 + IMPORT_C void RemoveDecisionsL(const CDecisionFilter& aFilter);
1.85 + IMPORT_C void DeleteDatabaseL();
1.86 +
1.87 + // Needs AllFiles
1.88 + IMPORT_C void UpdateDecision(TUint32 aRecordId, TBool aAllow, TRequestStatus &aStatus);
1.89 + IMPORT_C void CancelUpdateDecision();
1.90 +
1.91 + /**
1.92 + The following three APIs are only for use by the UPS swi observer plugin and are discouraged for general use
1.93 + */
1.94 + IMPORT_C void DeleteDecisionsForExeL(const TSecureId& aExeSid);
1.95 + IMPORT_C void NotifyPluginsMayHaveChangedL();
1.96 + IMPORT_C void NotifyPolicyFilesChanged(TRequestStatus &aStatus);
1.97 + IMPORT_C void CancelNotifyPolicyFilesChanged();
1.98 +
1.99 +private:
1.100 + RBuf8 iCreateViewFilterBuf;
1.101 + TPckgBuf<TUint32> iMatchLengthBuf;
1.102 + };
1.103 +
1.104 +class RUpsSubsession : public RScsClientSubsessionBase
1.105 +/**
1.106 +System servers use this class to establish a connection to the UPS for a specific
1.107 +client.\n
1.108 +Before checking a request with the User Prompt Service the Authorise method
1.109 +first checks whether authorisation from the User Prompt Service is required. If
1.110 +authorisation is not required e.g. the client has the correct capabilities for the
1.111 +service then Authorise completes immediately.
1.112 +*/
1.113 + {
1.114 +public:
1.115 + IMPORT_C RUpsSubsession();
1.116 + IMPORT_C TInt Initialise(RUpsSession& aSession, const RThread& aClient);
1.117 +
1.118 + IMPORT_C void Authorise(TBool aServerCheckOk,
1.119 + const TServiceId& aServiceId, const TDesC& aDestination,
1.120 + TUpsDecision& aDecision, TRequestStatus& aStatus);
1.121 + IMPORT_C void Authorise(TBool aServerCheckOk,
1.122 + const TServiceId& aServiceId, const TDesC& aDestination,
1.123 + const TDesC8& aOpaqueData,
1.124 + TUpsDecision& aDecision, TRequestStatus& aStatus);
1.125 + IMPORT_C void CancelPrompt();
1.126 +
1.127 + IMPORT_C void Close();
1.128 +
1.129 +private:
1.130 + TInt CreateSubsession();
1.131 + void AuthoriseInternal(TBool aServerCheckOk,
1.132 + const TServiceId& aServiceId, const TDesC& aDestination, const TDesC8& aOpaqueData,
1.133 + TUpsDecision& aDecision, TRequestStatus& aStatus);
1.134 + TInt PreparePrompt(const TServiceId& aServiceId, const TDesC& aDestination, const TDesC8& aOpaqueData);
1.135 + void ExecutePrompt(TBool aServerCheckOk, TUpsDecision& aDecision, TRequestStatus& aStatus);
1.136 +
1.137 +private:
1.138 + /** Describes the TUpsDecision reference passed into Authorise. */
1.139 + TPtr8 iDecPtr;
1.140 +
1.141 + TBool iSubsessionCreated;
1.142 + TThreadId iClientTid;
1.143 + TSecureId iClientSid;
1.144 + TProcessId iClientPid;
1.145 + RUpsSession* iUpsSession;
1.146 + };
1.147 +
1.148 +} // End of namespace UserPromptService
1.149 +
1.150 +#endif // #ifndef UPSCLIENT_H
1.151 +