sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
* Base class for implementations of ctframework interfaces
|
sl@0
|
16 |
*
|
sl@0
|
17 |
*/
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
/**
|
sl@0
|
21 |
@file
|
sl@0
|
22 |
@internalTechnology
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
|
sl@0
|
25 |
#ifndef __CFSCLIENT_H__
|
sl@0
|
26 |
#define __CFSCLIENT_H__
|
sl@0
|
27 |
|
sl@0
|
28 |
#include "fstokencliserv.h"
|
sl@0
|
29 |
#include <e32base.h>
|
sl@0
|
30 |
|
sl@0
|
31 |
class MCTToken;
|
sl@0
|
32 |
class RFileStoreClientSession;
|
sl@0
|
33 |
|
sl@0
|
34 |
/**
|
sl@0
|
35 |
* Base class for implementations of ctframework interfaces. Derived classes
|
sl@0
|
36 |
* inherit from this and also implement the appropriate interface.
|
sl@0
|
37 |
*
|
sl@0
|
38 |
* It provides asynchronous functionality for sending requests to the filetokens
|
sl@0
|
39 |
* server and processing the responses.
|
sl@0
|
40 |
*
|
sl@0
|
41 |
* Some methods are const so they can be called by the cert apps client, whose
|
sl@0
|
42 |
* interface contains several const methods. These methods need to create
|
sl@0
|
43 |
* internal buffers, and this leads to iRequestDataBuf and iRequestPtr being
|
sl@0
|
44 |
* mutable.
|
sl@0
|
45 |
*/
|
sl@0
|
46 |
NONSHARABLE_CLASS(CFSClient) : public CActive
|
sl@0
|
47 |
{
|
sl@0
|
48 |
public:
|
sl@0
|
49 |
virtual ~CFSClient();
|
sl@0
|
50 |
|
sl@0
|
51 |
protected:
|
sl@0
|
52 |
CFSClient(TInt aUID, MCTToken& aToken, RFileStoreClientSession& aClient);
|
sl@0
|
53 |
TInt AllocRequestBuffer(TInt aReqdSize) const;
|
sl@0
|
54 |
void FreeRequestBuffer() const;
|
sl@0
|
55 |
void SendSyncRequestAndHandleOverflowL(TFSTokenMessages aMessage,
|
sl@0
|
56 |
TInt aInitialBufSize,
|
sl@0
|
57 |
const TIpcArgs& aArgs) const;
|
sl@0
|
58 |
|
sl@0
|
59 |
protected:
|
sl@0
|
60 |
// From CActive
|
sl@0
|
61 |
virtual void DoCancel();
|
sl@0
|
62 |
virtual TInt RunError(TInt aError);
|
sl@0
|
63 |
|
sl@0
|
64 |
protected:
|
sl@0
|
65 |
/**
|
sl@0
|
66 |
* Maintains state for async requests to filetokens server, and completes
|
sl@0
|
67 |
* caller when required.
|
sl@0
|
68 |
*/
|
sl@0
|
69 |
class TAsyncRequest
|
sl@0
|
70 |
{
|
sl@0
|
71 |
public:
|
sl@0
|
72 |
void operator()(TFSTokenMessages aRequest, TRequestStatus* aStatus);
|
sl@0
|
73 |
void Complete(TInt aCompletionResult);
|
sl@0
|
74 |
void Cancel();
|
sl@0
|
75 |
inline TFSTokenMessages OutstandingRequest() { return iRequest; }
|
sl@0
|
76 |
public:
|
sl@0
|
77 |
~TAsyncRequest();
|
sl@0
|
78 |
private:
|
sl@0
|
79 |
TFSTokenMessages iRequest;
|
sl@0
|
80 |
TRequestStatus* iClientStatus;
|
sl@0
|
81 |
};
|
sl@0
|
82 |
|
sl@0
|
83 |
TAsyncRequest iCurrentRequest; ///< The outstanding server request
|
sl@0
|
84 |
|
sl@0
|
85 |
private:
|
sl@0
|
86 |
mutable HBufC8* iRequestDataBuf; ///< Buffer for messages passed to the server
|
sl@0
|
87 |
|
sl@0
|
88 |
protected:
|
sl@0
|
89 |
MCTToken& iToken; ///< The token we belong to
|
sl@0
|
90 |
TInt iInterfaceUID; ///< UID of the cryptoken interface we implement
|
sl@0
|
91 |
RFileStoreClientSession& iClient; ///< Client session object for sending messages to the server
|
sl@0
|
92 |
mutable TPtr8 iRequestPtr; ///< Buffer pointer for derived classes to use
|
sl@0
|
93 |
};
|
sl@0
|
94 |
|
sl@0
|
95 |
#endif // __CFSCLIENT_H__
|