os/security/cryptoservices/filebasedcertificateandkeystores/source/certapps/server/CFSCertAppsServer.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* CFSCertAppsServer class implementation
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
/**
sl@0
    21
 @file 
sl@0
    22
 @internalTechnology
sl@0
    23
*/
sl@0
    24
 
sl@0
    25
#ifndef __CFSCERTAPPSSERVER_H__
sl@0
    26
#define __CFSCERTAPPSSERVER_H__
sl@0
    27
sl@0
    28
#include <e32base.h>
sl@0
    29
#include <f32file.h>
sl@0
    30
#include <s32file.h>
sl@0
    31
#include <mctcertapps.h>
sl@0
    32
sl@0
    33
class CFSCertAppsToken;
sl@0
    34
class CCertAppsSession;
sl@0
    35
class CCertAppsConduit;
sl@0
    36
sl@0
    37
class CFSCertAppsServer : public CBase
sl@0
    38
	{
sl@0
    39
public:
sl@0
    40
	static CFSCertAppsServer* NewL();
sl@0
    41
	virtual ~CFSCertAppsServer();
sl@0
    42
	CCertAppsSession* CreateSessionL();
sl@0
    43
sl@0
    44
public: 
sl@0
    45
	void AddL(const TCertificateAppInfo& aClient);
sl@0
    46
	void RemoveL(const TUid& aUid);
sl@0
    47
	TInt ApplicationCountL() const;
sl@0
    48
	void ApplicationsL(RArray<TCertificateAppInfo>& aAppArray) const;
sl@0
    49
	void ApplicationL(const TUid& aUid, TCertificateAppInfo& aInfo) const;
sl@0
    50
sl@0
    51
private:
sl@0
    52
	CFSCertAppsServer();
sl@0
    53
	void ConstructL();
sl@0
    54
sl@0
    55
	/// Finds an application and returns NULL if not found - if aIndex is not
sl@0
    56
	/// null then index is copied there
sl@0
    57
	const TCertificateAppInfo* FindApplication(const TUid& aUid, TInt* aIndex = NULL) const;
sl@0
    58
sl@0
    59
	/// Configures the object from the file store. Will create a new store
sl@0
    60
	/// if one does not exist
sl@0
    61
	void OpenStoreL();
sl@0
    62
	/// Opens a Composite store present under ROM drive.
sl@0
    63
	void OpenCompositeStoreL(const TDesC& aFilename);
sl@0
    64
	/// Attempt to load the cert apps from the given file
sl@0
    65
	void ReadStoreContentsL(const TDesC& aFilename);
sl@0
    66
	/// Create a new empty store
sl@0
    67
	void CreateStoreL(const TDesC& aFilename);
sl@0
    68
	/// aggregate the store files
sl@0
    69
	void AggregateStoreFileL(const TDesC& aFile);
sl@0
    70
	/// aggregate certificate client entries.
sl@0
    71
	void MergeCertificateEntryListL(const RArray<TCertificateAppInfo>& aSourceList);	
sl@0
    72
	/// finds if an uid exists in the entry list 
sl@0
    73
	TBool FindUid(const TUid& aUid);
sl@0
    74
	// TCleanup items used when creating a store or replacing a stream
sl@0
    75
	static void DeleteStoreFile(TAny* aThis);
sl@0
    76
	static void RevertStore(TAny* aStore);
sl@0
    77
sl@0
    78
	/// Replaces the store - called by both Add and Remove.
sl@0
    79
	/// Leaves if failed. ExcludedIndex is the index into the 
sl@0
    80
	/// array to be excluded. -1 if none are excluded
sl@0
    81
	void ReplaceAndCommitL(TInt aExcludedIndex = -1);
sl@0
    82
sl@0
    83
	/// Externalizes the array into a stream - commits it if successful
sl@0
    84
	void WriteClientArrayL(RWriteStream& stream, TInt aExcludedIndex = -1) const;
sl@0
    85
sl@0
    86
private:
sl@0
    87
	/// The conduit object used for marshalling/unmarshalling client communications
sl@0
    88
	CCertAppsConduit* iConduit;
sl@0
    89
	RFs iFs;
sl@0
    90
	/// The store where the client are stored
sl@0
    91
	CPermanentFileStore* iStore;
sl@0
    92
	TStreamId iId;	
sl@0
    93
	/// A cache of the contents of the store
sl@0
    94
	RArray<TCertificateAppInfo> iClients;
sl@0
    95
	/// Used to distinguish variant specific feature from the default. 
sl@0
    96
	TUint8 iPatchableConst;
sl@0
    97
	};
sl@0
    98
sl@0
    99
#endif	//	__CFSCERTAPPSSERVER_H__