os/security/cryptoservices/filebasedcertificateandkeystores/source/certapps/server/CFSCertAppsServer.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptoservices/filebasedcertificateandkeystores/source/certapps/server/CFSCertAppsServer.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,99 @@
     1.4 +/*
     1.5 +* Copyright (c) 2002-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 +* CFSCertAppsServer class implementation
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +/**
    1.24 + @file 
    1.25 + @internalTechnology
    1.26 +*/
    1.27 + 
    1.28 +#ifndef __CFSCERTAPPSSERVER_H__
    1.29 +#define __CFSCERTAPPSSERVER_H__
    1.30 +
    1.31 +#include <e32base.h>
    1.32 +#include <f32file.h>
    1.33 +#include <s32file.h>
    1.34 +#include <mctcertapps.h>
    1.35 +
    1.36 +class CFSCertAppsToken;
    1.37 +class CCertAppsSession;
    1.38 +class CCertAppsConduit;
    1.39 +
    1.40 +class CFSCertAppsServer : public CBase
    1.41 +	{
    1.42 +public:
    1.43 +	static CFSCertAppsServer* NewL();
    1.44 +	virtual ~CFSCertAppsServer();
    1.45 +	CCertAppsSession* CreateSessionL();
    1.46 +
    1.47 +public: 
    1.48 +	void AddL(const TCertificateAppInfo& aClient);
    1.49 +	void RemoveL(const TUid& aUid);
    1.50 +	TInt ApplicationCountL() const;
    1.51 +	void ApplicationsL(RArray<TCertificateAppInfo>& aAppArray) const;
    1.52 +	void ApplicationL(const TUid& aUid, TCertificateAppInfo& aInfo) const;
    1.53 +
    1.54 +private:
    1.55 +	CFSCertAppsServer();
    1.56 +	void ConstructL();
    1.57 +
    1.58 +	/// Finds an application and returns NULL if not found - if aIndex is not
    1.59 +	/// null then index is copied there
    1.60 +	const TCertificateAppInfo* FindApplication(const TUid& aUid, TInt* aIndex = NULL) const;
    1.61 +
    1.62 +	/// Configures the object from the file store. Will create a new store
    1.63 +	/// if one does not exist
    1.64 +	void OpenStoreL();
    1.65 +	/// Opens a Composite store present under ROM drive.
    1.66 +	void OpenCompositeStoreL(const TDesC& aFilename);
    1.67 +	/// Attempt to load the cert apps from the given file
    1.68 +	void ReadStoreContentsL(const TDesC& aFilename);
    1.69 +	/// Create a new empty store
    1.70 +	void CreateStoreL(const TDesC& aFilename);
    1.71 +	/// aggregate the store files
    1.72 +	void AggregateStoreFileL(const TDesC& aFile);
    1.73 +	/// aggregate certificate client entries.
    1.74 +	void MergeCertificateEntryListL(const RArray<TCertificateAppInfo>& aSourceList);	
    1.75 +	/// finds if an uid exists in the entry list 
    1.76 +	TBool FindUid(const TUid& aUid);
    1.77 +	// TCleanup items used when creating a store or replacing a stream
    1.78 +	static void DeleteStoreFile(TAny* aThis);
    1.79 +	static void RevertStore(TAny* aStore);
    1.80 +
    1.81 +	/// Replaces the store - called by both Add and Remove.
    1.82 +	/// Leaves if failed. ExcludedIndex is the index into the 
    1.83 +	/// array to be excluded. -1 if none are excluded
    1.84 +	void ReplaceAndCommitL(TInt aExcludedIndex = -1);
    1.85 +
    1.86 +	/// Externalizes the array into a stream - commits it if successful
    1.87 +	void WriteClientArrayL(RWriteStream& stream, TInt aExcludedIndex = -1) const;
    1.88 +
    1.89 +private:
    1.90 +	/// The conduit object used for marshalling/unmarshalling client communications
    1.91 +	CCertAppsConduit* iConduit;
    1.92 +	RFs iFs;
    1.93 +	/// The store where the client are stored
    1.94 +	CPermanentFileStore* iStore;
    1.95 +	TStreamId iId;	
    1.96 +	/// A cache of the contents of the store
    1.97 +	RArray<TCertificateAppInfo> iClients;
    1.98 +	/// Used to distinguish variant specific feature from the default. 
    1.99 +	TUint8 iPatchableConst;
   1.100 +	};
   1.101 +
   1.102 +#endif	//	__CFSCERTAPPSSERVER_H__