epoc32/include/ups/upsclient.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.
williamr@4
     1
/*
williamr@4
     2
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@4
     3
* All rights reserved.
williamr@4
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of the License "Eclipse Public License v1.0"
williamr@4
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@4
     8
*
williamr@4
     9
* Initial Contributors:
williamr@4
    10
* Nokia Corporation - initial contribution.
williamr@4
    11
*
williamr@4
    12
* Contributors:
williamr@4
    13
*
williamr@4
    14
* Description: 
williamr@4
    15
* Client-side API via which the system server uses the user prompt service.
williamr@4
    16
*
williamr@4
    17
*/
williamr@4
    18
williamr@4
    19
williamr@4
    20
/**
williamr@4
    21
 @file
williamr@4
    22
 @publishedAll
williamr@4
    23
 @released
williamr@4
    24
*/
williamr@4
    25
williamr@4
    26
#ifndef UPSCLIENT_H
williamr@4
    27
#define UPSCLIENT_H
williamr@4
    28
williamr@4
    29
williamr@4
    30
#include <scs/scsclient.h>
williamr@4
    31
#include <ups/upstypes.h>
williamr@4
    32
williamr@4
    33
namespace UserPromptService
williamr@4
    34
	{
williamr@4
    35
williamr@4
    36
class CUpsClientConfig;
williamr@4
    37
class CPolicyChangeWatcher;
williamr@4
    38
class RUpsSession : public RScsClientBase
williamr@4
    39
/**
williamr@4
    40
	The system server uses this class to establish a connection with
williamr@4
    41
	the UPS server.
williamr@4
    42
williamr@4
    43
	Internally it retrieves and caches authorisation policy information for all the
williamr@4
    44
	services supported by the current server SID. This information is used to allow
williamr@4
    45
	the RUpsSubsession to avoid creating a subsession and/or querying the UPS 
williamr@4
    46
	if the request does not require UPS interaction. 
williamr@4
    47
williamr@4
    48
 */
williamr@4
    49
	{
williamr@4
    50
public:
williamr@4
    51
	IMPORT_C RUpsSession();
williamr@4
    52
	IMPORT_C TInt Connect();
williamr@4
    53
	IMPORT_C void Close();
williamr@4
    54
williamr@4
    55
public:
williamr@4
    56
	void NotifyPolicyFileChangedL();
williamr@4
    57
williamr@4
    58
private:
williamr@4
    59
	friend class RUpsSubsession;
williamr@4
    60
	CPolicyChangeWatcher *iPolicyChangeWatcher;
williamr@4
    61
	void RetrieveClientConfigL();
williamr@4
    62
	CUpsClientConfig* iClientConfig;
williamr@4
    63
	};
williamr@4
    64
williamr@4
    65
class RUpsManagement : public RScsClientBase
williamr@4
    66
/**
williamr@4
    67
	This class supports the management API for the UPS.
williamr@4
    68
 */
williamr@4
    69
	{
williamr@4
    70
public:
williamr@4
    71
	IMPORT_C RUpsManagement();
williamr@4
    72
	IMPORT_C TInt Connect();
williamr@4
    73
	IMPORT_C void Close();
williamr@4
    74
williamr@4
    75
	// Needs ReadDeviceData	
williamr@4
    76
	IMPORT_C void CreateView(const CDecisionFilter& aFilter, TRequestStatus &aStatus);
williamr@4
    77
	IMPORT_C CDecisionRecord *NextMatchL();
williamr@4
    78
	IMPORT_C void CancelAndCloseView();
williamr@4
    79
williamr@4
    80
	// Needs WriteDeviceData	
williamr@4
    81
	IMPORT_C void RemoveDecisionsL(const CDecisionFilter& aFilter);
williamr@4
    82
	IMPORT_C void DeleteDatabaseL();
williamr@4
    83
williamr@4
    84
	// Needs AllFiles
williamr@4
    85
	IMPORT_C void UpdateDecision(TUint32 aRecordId, TBool aAllow, TRequestStatus &aStatus);
williamr@4
    86
	IMPORT_C void CancelUpdateDecision();
williamr@4
    87
williamr@4
    88
	/**
williamr@4
    89
		The following three APIs are only for use by the UPS swi observer plugin and are discouraged for general use
williamr@4
    90
	*/
williamr@4
    91
	IMPORT_C void DeleteDecisionsForExeL(const TSecureId& aExeSid);
williamr@4
    92
	IMPORT_C void NotifyPluginsMayHaveChangedL();
williamr@4
    93
	IMPORT_C void NotifyPolicyFilesChanged(TRequestStatus &aStatus);
williamr@4
    94
	IMPORT_C void CancelNotifyPolicyFilesChanged();
williamr@4
    95
williamr@4
    96
private:
williamr@4
    97
	RBuf8 iCreateViewFilterBuf;
williamr@4
    98
	TPckgBuf<TUint32> iMatchLengthBuf;
williamr@4
    99
	};
williamr@4
   100
williamr@4
   101
class RUpsSubsession : public RScsClientSubsessionBase
williamr@4
   102
/**
williamr@4
   103
System servers use this class to establish a connection to the UPS for a specific 
williamr@4
   104
client.\n
williamr@4
   105
Before checking a request with the User Prompt Service the Authorise method 
williamr@4
   106
first checks whether authorisation from the User Prompt Service is required. If
williamr@4
   107
authorisation is not required e.g. the client has the correct capabilities for the
williamr@4
   108
service then Authorise completes immediately.
williamr@4
   109
*/
williamr@4
   110
	{
williamr@4
   111
public:
williamr@4
   112
	IMPORT_C RUpsSubsession();
williamr@4
   113
	IMPORT_C TInt Initialise(RUpsSession& aSession, const RThread& aClient);
williamr@4
   114
williamr@4
   115
	IMPORT_C void Authorise(TBool aServerCheckOk, 
williamr@4
   116
							const TServiceId& aServiceId, const TDesC& aDestination,
williamr@4
   117
							TUpsDecision& aDecision, TRequestStatus& aStatus);
williamr@4
   118
	IMPORT_C void Authorise(TBool aServerCheckOk, 
williamr@4
   119
							const TServiceId& aServiceId, const TDesC& aDestination,
williamr@4
   120
							const TDesC8& aOpaqueData, 
williamr@4
   121
							TUpsDecision& aDecision, TRequestStatus& aStatus);						 
williamr@4
   122
	IMPORT_C void CancelPrompt();
williamr@4
   123
williamr@4
   124
	IMPORT_C void Close();
williamr@4
   125
williamr@4
   126
private:
williamr@4
   127
	TInt CreateSubsession();
williamr@4
   128
	void AuthoriseInternal(TBool aServerCheckOk,
williamr@4
   129
		const TServiceId& aServiceId, const TDesC& aDestination, const TDesC8& aOpaqueData,
williamr@4
   130
		TUpsDecision& aDecision, TRequestStatus& aStatus);
williamr@4
   131
	TInt PreparePrompt(const TServiceId& aServiceId, const TDesC& aDestination, const TDesC8& aOpaqueData);
williamr@4
   132
	void ExecutePrompt(TBool aServerCheckOk, TUpsDecision& aDecision, TRequestStatus& aStatus);
williamr@4
   133
	
williamr@4
   134
private:
williamr@4
   135
	/** Describes the TUpsDecision reference passed into Authorise. */
williamr@4
   136
	TPtr8 iDecPtr;
williamr@4
   137
williamr@4
   138
	TBool iSubsessionCreated;
williamr@4
   139
	TThreadId iClientTid;
williamr@4
   140
	TSecureId iClientSid;
williamr@4
   141
	TProcessId iClientPid;
williamr@4
   142
	RUpsSession* iUpsSession;
williamr@4
   143
	};
williamr@4
   144
williamr@4
   145
} // End of namespace UserPromptService
williamr@4
   146
williamr@4
   147
#endif	// #ifndef UPSCLIENT_H
williamr@4
   148