|
1 /* |
|
2 * Copyright (c) 2006-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 * cryptospistate client API implemetation |
|
16 * crypto spi API implementation |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 /** |
|
22 @file |
|
23 */ |
|
24 |
|
25 #include <cryptospi/cryptospistateapi.h> |
|
26 #include <cryptospi/pluginselectorbase.h> |
|
27 #include <cryptospi/cryptospidef.h> |
|
28 #include "cryptospiutil.h" |
|
29 #include <cryptospi/pluginentrydef.h> |
|
30 |
|
31 using namespace CryptoSpi; |
|
32 |
|
33 // |
|
34 // Implementation of CryptoSpiStateApi |
|
35 // |
|
36 |
|
37 EXPORT_C void CCryptoSpiStateApi::SetSelector(MPluginSelector* aSelector) |
|
38 { |
|
39 Dll::SetTls(aSelector); |
|
40 } |
|
41 |
|
42 EXPORT_C void CCryptoSpiStateApi::UnsetSelector() |
|
43 { |
|
44 Dll::SetTls(0); |
|
45 } |
|
46 |
|
47 EXPORT_C void CCryptoSpiStateApi::EnumerateCharacteristicsL(RPointerArray<CCharacteristicsAndPluginName>& aCharacteristicsDll, TInt32 aInterface, TBool aExtended) |
|
48 { |
|
49 if (aInterface==0) |
|
50 { |
|
51 TInt interfaceCount=sizeof(KInterfacesUids)/sizeof(KInterfacesUids[0]); |
|
52 for (TInt i=0;i<interfaceCount;i++) |
|
53 { |
|
54 CryptoSpiUtil::RetrieveCharacteristicsL(KInterfacesUids[i].iUid, aCharacteristicsDll); |
|
55 } |
|
56 } |
|
57 else |
|
58 { |
|
59 CryptoSpiUtil::RetrieveCharacteristicsL(aInterface, aCharacteristicsDll); |
|
60 } |
|
61 |
|
62 if (aExtended) |
|
63 { |
|
64 TInt count=aCharacteristicsDll.Count(); |
|
65 for (TInt i=0;i<count;i++) |
|
66 { |
|
67 RLibrary lib; |
|
68 CryptoSpiUtil::LoadPluginDllLC(lib, aCharacteristicsDll[i]->iDllName); |
|
69 GetExtendedCharacteristicsFuncL getExtendedCharFuncL=(GetExtendedCharacteristicsFuncL)lib.Lookup(EGetExtendedCharacteristicOrdinal); |
|
70 if (getExtendedCharFuncL) |
|
71 { |
|
72 TUid implementationUid={aCharacteristicsDll[i]->iCharacteristic->iImplementationUid}; |
|
73 getExtendedCharFuncL(implementationUid, aCharacteristicsDll[i]->iExtendedCharacteristic); |
|
74 } |
|
75 CleanupStack::PopAndDestroy(&lib); |
|
76 } |
|
77 } |
|
78 } |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |