os/security/cryptoservices/filebasedcertificateandkeystores/source/generic/client/CFStokenclient.cpp
Update contrib.
2 * Copyright (c) 2004-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.
19 #include "CFStokenclient.h"
20 #include "clientutils.h"
21 #include "clientfactories.h"
23 // Information strings returned by MCTToken::Information()
24 _LIT(KVersion, "1.00");
26 _LIT(KManufacturer, "Nokia Corporation and/or its subsidiary(-ies).");
28 MCTToken* CFSTokenClient::NewL(ETokenEnum aTokenTypeVal, MCTTokenType* aTokenType, RFileStoreClientSession& aClient)
30 __ASSERT_DEBUG(aTokenType, FSTokenPanic(EBadArgument));
32 // Destroyed by MCTToken::Release() (refcounted)
33 CFSTokenClient* me = new (ELeave) CFSTokenClient(aTokenTypeVal, aTokenType, aClient);
34 return (static_cast<MCTToken*>(me));
37 CFSTokenClient::CFSTokenClient(ETokenEnum aTokenTypeVal, MCTTokenType* aTokenType, RFileStoreClientSession& aClient)
38 : iTokenEnum(aTokenTypeVal),
39 iTokenType(aTokenType),
43 ASSERT(iTokenEnum < ETotalTokensSupported);
46 MCTTokenType& CFSTokenClient::TokenType()
48 __ASSERT_DEBUG(iTokenType, FSTokenPanic(ENotInitialised));
52 const TDesC& CFSTokenClient::Label()
54 RSupportedTokensArray supportedTokens;
55 const TDesC* token = supportedTokens[iTokenEnum];
59 TCTTokenHandle CFSTokenClient::Handle()
61 __ASSERT_DEBUG(iTokenType, FSTokenPanic(ENotInitialised));
62 return (TCTTokenHandle(iTokenType->Type(), iTokenEnum));
65 TInt& CFSTokenClient::ReferenceCount()
70 void CFSTokenClient::DoGetInterface(TUid aRequiredInterface, MCTTokenInterface*& aReturnedInterface, TRequestStatus& aStatus)
72 // No longer calls server to get the interface - just creates a client object of the appropriate type
74 aReturnedInterface = NULL;
75 TRAPD(result, aReturnedInterface = CClientInterfaceFactory::ClientInterfaceL(aRequiredInterface.iUid, *this, iClient));
76 if (result != KErrNone)
81 // Complete the TRequestStatus here since not asynchronous
82 TRequestStatus* status = &aStatus;
83 User::RequestComplete(status, result);
86 TBool CFSTokenClient::DoCancelGetInterface()
87 {// Not an asynchronous call for current file store, so nothing to do
91 const TDesC& CFSTokenClient::Information(TTokenInformation aRequiredInformation)
93 switch (aRequiredInformation)
102 return KManufacturer;
105 FSTokenPanic(EBadArgument);