os/security/cryptoservices/filebasedcertificateandkeystores/source/certapps/client/CFSCertAppsClient.cpp
Update contrib.
2 * Copyright (c) 2002-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 "CFSCertAppsClient.h"
20 #include "fsmarshaller.h"
21 #include "clientutils.h"
22 #include "clientsession.h"
23 #include <certificateapps.h>
25 const TInt KDefaultBufferSize = 256;
27 MCTTokenInterface* CFSCertAppsClient::NewInterfaceL(MCTToken& aToken,
28 RFileStoreClientSession& aClient)
30 // Destroyed by MCTTokenInterface::DoRelease() (no refcounting)
31 return new (ELeave) CFSCertAppsClient(KInterfaceCertApps, aToken, aClient);
34 CFSCertAppsClient::CFSCertAppsClient(TInt aUID,
36 RFileStoreClientSession& aClient) :
37 CFSClient(aUID, aToken, aClient)
41 CFSCertAppsClient::~CFSCertAppsClient()
45 void CFSCertAppsClient::DoRelease()
47 MCTTokenInterface::DoRelease();
50 MCTToken& CFSCertAppsClient::Token()
55 void CFSCertAppsClient::RunL()
57 // RunL should never get called
58 __ASSERT_DEBUG(EFalse, FSTokenPanic(EInvalidRequest));
61 void CFSCertAppsClient::AddL(const TCertificateAppInfo& aClient)
63 // Package up the certificate app info into a buffer. It is
64 // then sent as the second parameter (index 1)
65 TPckgC<TCertificateAppInfo> pckg(aClient);
66 User::LeaveIfError(iClient.SendRequest(EAddApp, TIpcArgs(0, &pckg)));
69 void CFSCertAppsClient::RemoveL(const TUid& aUid)
72 TPckgC<TUid> pckg(aUid);
73 User::LeaveIfError(iClient.SendRequest(ERemoveApp, TIpcArgs(0, &pckg)));
76 TInt CFSCertAppsClient::ApplicationCountL() const
78 // Parameter is a package of TInt which is returned from the server
80 TPckg<TInt> pckg(appCount);
81 User::LeaveIfError(iClient.SendRequest(EGetAppCount, TIpcArgs(0, &pckg)));
85 void CFSCertAppsClient::ApplicationsL(RArray<TCertificateAppInfo>& aAppArray) const
87 // This message contains the following parameters:
88 // Param2: [OUT] TDes8 - The buffer to write into; if buffer size too
89 // small then will return KErrOverflow with param 2 being
92 TRAPD(err, DoApplicationsL(aAppArray));
94 User::LeaveIfError(err);
97 void CFSCertAppsClient::DoApplicationsL(RArray<TCertificateAppInfo>& aAppArray) const
99 TIpcArgs args(0, 0, &iRequestPtr);
100 SendSyncRequestAndHandleOverflowL(EGetApps, KDefaultBufferSize, args);
101 TokenDataMarshaller::ReadL(iRequestPtr, aAppArray);
104 void CFSCertAppsClient::ApplicationL(const TUid& aUid, TCertificateAppInfo& aInfo) const
106 // The parameters for the ApplicationL function are as follows:
107 // Param1: [IN] TUid - The Uid of the app to retrieve
108 // Param2: [OUT] TCertificateAppInfo - The app info returned
110 // Package everything up and ship them
111 TPckgC<TUid> pckgUid(aUid);
112 TPckg<TCertificateAppInfo> pckgInfo(aInfo);
114 TIpcArgs args(0, &pckgUid, &pckgInfo);
115 User::LeaveIfError(iClient.SendRequest(EGetApplication, args));