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