os/security/cryptoservices/filebasedcertificateandkeystores/source/generic/client/CFSClient.h
First public contribution.
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.
15 * Base class for implementations of ctframework interfaces
25 #ifndef __CFSCLIENT_H__
26 #define __CFSCLIENT_H__
28 #include "fstokencliserv.h"
32 class RFileStoreClientSession;
35 * Base class for implementations of ctframework interfaces. Derived classes
36 * inherit from this and also implement the appropriate interface.
38 * It provides asynchronous functionality for sending requests to the filetokens
39 * server and processing the responses.
41 * Some methods are const so they can be called by the cert apps client, whose
42 * interface contains several const methods. These methods need to create
43 * internal buffers, and this leads to iRequestDataBuf and iRequestPtr being
46 NONSHARABLE_CLASS(CFSClient) : public CActive
52 CFSClient(TInt aUID, MCTToken& aToken, RFileStoreClientSession& aClient);
53 TInt AllocRequestBuffer(TInt aReqdSize) const;
54 void FreeRequestBuffer() const;
55 void SendSyncRequestAndHandleOverflowL(TFSTokenMessages aMessage,
57 const TIpcArgs& aArgs) const;
61 virtual void DoCancel();
62 virtual TInt RunError(TInt aError);
66 * Maintains state for async requests to filetokens server, and completes
67 * caller when required.
72 void operator()(TFSTokenMessages aRequest, TRequestStatus* aStatus);
73 void Complete(TInt aCompletionResult);
75 inline TFSTokenMessages OutstandingRequest() { return iRequest; }
79 TFSTokenMessages iRequest;
80 TRequestStatus* iClientStatus;
83 TAsyncRequest iCurrentRequest; ///< The outstanding server request
86 mutable HBufC8* iRequestDataBuf; ///< Buffer for messages passed to the server
89 MCTToken& iToken; ///< The token we belong to
90 TInt iInterfaceUID; ///< UID of the cryptoken interface we implement
91 RFileStoreClientSession& iClient; ///< Client session object for sending messages to the server
92 mutable TPtr8 iRequestPtr; ///< Buffer pointer for derived classes to use
95 #endif // __CFSCLIENT_H__