Update contrib.
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * crypto plugins loader
26 #ifndef __CRYPTOPlUGINSLOADER_H__
27 #define __CRYPTOPlUGINSLOADER_H__
29 #include <e32hashtab.h>
30 #include <cryptospi/pluginentrydef.h>
35 The class holds the characteristics of an interface and DLL index,
36 which is used for externalization.
38 class TCharacteristicsDll
42 Constructor that constructs a TCharacteristicsDll object
44 @param aCharacteristics a pointer to the Characteristics.
45 @param aIndex the index of the plugindll that contains the interface implemetation
47 TCharacteristicsDll(const TCharacteristics* aCharacteristics, TInt aIndex);
50 Externalize this object to the supplied stream.
52 @param aStream Stream to write TCharacteristicsDll to.
54 void ExternalizeL(RWriteStream& aStream);
58 The pointer the characteristic of an interface
60 const TCharacteristics* iCharacteristics;
63 The index of the plugin dll
69 The class contains a list of characteristics-DllIndex pair.
70 which is used for externalization.
72 NONSHARABLE_CLASS(CCharacteristicDllIndexList) : public CBase
76 Creates a new CCharacteristicDllIndexList.
77 @return A pointer to the CCharacteristicDllIndexList instance
79 static CCharacteristicDllIndexList* NewL();
82 Creates a new CCharacteristicDllIndexList.
83 Leave the CCharacteristicDllIndexList pointer on the cleanup stack.
84 @return A pointer to the CCharacteristicDllIndexList instance
86 static CCharacteristicDllIndexList* NewLC();
91 ~CCharacteristicDllIndexList();
94 Externalize this object to the supplied stream.
96 @param aStream Stream to write CCharacteristicDllIndexList to.
98 void ExternalizeL(RWriteStream& aStream);
104 CCharacteristicDllIndexList();
108 The list of of characteristics-DllIndex pair.
110 RArray<TCharacteristicsDll> iCharacteristicList;
115 This subclass of MStreamBuf is used with
116 RWriteStream to count how many bytes are
117 required to externalize an object.
119 class TSizeStream : public MStreamBuf
122 inline TSizeStream();
123 inline TInt Size() const;
125 // override MStreamBuf
126 virtual void DoWriteL(const TAny* /* aPtr */, TInt aLength);
130 Accumulated stream length in bytes.
135 inline TSizeStream::TSizeStream()
140 inline TInt TSizeStream::Size() const
146 This class loads all the plugins, build all the characteristics,
147 and publish the properties for crypto spi.
149 NONSHARABLE_CLASS(CCryptoPluginsLoader) : public CBase
153 Create a CCryptoPluginsLoader instance
155 static CCryptoPluginsLoader* NewL();
158 Create a CCryptoPluginsLoader instance.
159 Leave the pointer on the cleanup stack
161 static CCryptoPluginsLoader* NewLC();
166 ~CCryptoPluginsLoader();
169 Create the properties of the plugin configurations.
171 void CreatePluginConfigPropertyL();
174 Create the properties for the interfaces
176 void CreateInterfacePropertyL(TInt32 aInterface);
182 CCryptoPluginsLoader();
186 Build the plugins' characteristics lists
188 void BuildPluginCharacteristicsL();
191 Build the plugin' characteristics list
192 @param aInterfaceUid the interface UID
193 @param aEnumerateFunc the entry pointer of enumeration function
194 @param aDllIndex the index of the loaded plugin
196 void BuildInterfaceCharacteristicsL(TUid aInterfaceUid,
197 EnumerateCharacteristicsFunc aEnumerateFunc,
200 Loads the crypto plugins
201 @param aOption the option to load all the plugins or one more plugins
206 Create the interfaces' properties and write to the stream
207 @param aStream the stream to be written to
208 @param aInterface the interface Uid
210 void DoCreateInterfacePropertyL(RWriteStream& aStream, TInt32 aInterface);
214 The plugin DLL list, which holds all the plugin DLLs
216 RArray<RLibrary> iPluginDllList;
219 The file name corresponding to the plugin DLLs.
221 RArray<TFileName> iPluginNames;
224 The characteristic list, the length of the array is the number of the interfaces
226 RHashMap<TInt32, CCharacteristicDllIndexList*> iInterfaceCharacteristicsMap;
229 #endif //__CRYPTOPlUGINSLOADER_H__