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 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@internalTechnology
|
sl@0
|
22 |
*/
|
sl@0
|
23 |
|
sl@0
|
24 |
#ifndef __FSSERVER_H__
|
sl@0
|
25 |
#define __FSSERVER_H__
|
sl@0
|
26 |
|
sl@0
|
27 |
#define FILECERTSTORE_SERVER
|
sl@0
|
28 |
|
sl@0
|
29 |
#include <e32base.h>
|
sl@0
|
30 |
#include "fstokencliserv.h"
|
sl@0
|
31 |
#include "tokentypesenum.h"
|
sl@0
|
32 |
|
sl@0
|
33 |
class CFSKeyStoreServer;
|
sl@0
|
34 |
class CFSCertStoreServer;
|
sl@0
|
35 |
class CFSCertAppsServer;
|
sl@0
|
36 |
|
sl@0
|
37 |
/**
|
sl@0
|
38 |
* Implements shutdown of the server. When the last client disconnects, this
|
sl@0
|
39 |
* class is activated, and when the timer expires, causes the server to
|
sl@0
|
40 |
* close.
|
sl@0
|
41 |
*/
|
sl@0
|
42 |
class CShutdown : public CTimer
|
sl@0
|
43 |
{
|
sl@0
|
44 |
enum {KServerShutdownDelay=0x200000}; // approx 2s
|
sl@0
|
45 |
public:
|
sl@0
|
46 |
inline CShutdown();
|
sl@0
|
47 |
inline void ConstructL();
|
sl@0
|
48 |
inline void Start();
|
sl@0
|
49 |
private:
|
sl@0
|
50 |
void RunL();
|
sl@0
|
51 |
};
|
sl@0
|
52 |
|
sl@0
|
53 |
|
sl@0
|
54 |
/** Filetokens server class, manages sessions. */
|
sl@0
|
55 |
class CTokenServer : public CServer2
|
sl@0
|
56 |
{
|
sl@0
|
57 |
public:
|
sl@0
|
58 |
static CServer2* NewLC();
|
sl@0
|
59 |
public:
|
sl@0
|
60 |
~CTokenServer();
|
sl@0
|
61 |
public:
|
sl@0
|
62 |
void AddSession();
|
sl@0
|
63 |
void DropSession();
|
sl@0
|
64 |
CFSKeyStoreServer& KeyStoreServerL() const;
|
sl@0
|
65 |
CFSCertStoreServer& CertStoreServerL() const;
|
sl@0
|
66 |
CFSCertAppsServer& CertAppsServerL() const;
|
sl@0
|
67 |
private:
|
sl@0
|
68 |
// For CServer2
|
sl@0
|
69 |
virtual CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
|
sl@0
|
70 |
private:
|
sl@0
|
71 |
CTokenServer();
|
sl@0
|
72 |
void ConstructL();
|
sl@0
|
73 |
private:
|
sl@0
|
74 |
TInt iSessionCount;
|
sl@0
|
75 |
CShutdown iShutdown;
|
sl@0
|
76 |
|
sl@0
|
77 |
// Ah, I knew there was a good use for that mutable keyword...
|
sl@0
|
78 |
mutable CFSKeyStoreServer* iKeyStoreServer;
|
sl@0
|
79 |
mutable CFSCertStoreServer* iCertStoreServer;
|
sl@0
|
80 |
mutable CFSCertAppsServer* iCertAppsServer;
|
sl@0
|
81 |
};
|
sl@0
|
82 |
|
sl@0
|
83 |
/**
|
sl@0
|
84 |
* Base class for session objects.
|
sl@0
|
85 |
*/
|
sl@0
|
86 |
class CTokenServerSession : public CSession2
|
sl@0
|
87 |
{
|
sl@0
|
88 |
public:
|
sl@0
|
89 |
CTokenServerSession();
|
sl@0
|
90 |
virtual ~CTokenServerSession();
|
sl@0
|
91 |
public:
|
sl@0
|
92 |
inline CTokenServer& Server();
|
sl@0
|
93 |
protected:
|
sl@0
|
94 |
virtual void DoServiceL(const RMessage2& aMessage) = 0;
|
sl@0
|
95 |
private:
|
sl@0
|
96 |
virtual void CreateL();
|
sl@0
|
97 |
virtual void ServiceError(const RMessage2& aMessage, TInt aError);
|
sl@0
|
98 |
virtual void ServiceL(const RMessage2& aMessage);
|
sl@0
|
99 |
private:
|
sl@0
|
100 |
};
|
sl@0
|
101 |
|
sl@0
|
102 |
#endif // __FSSERVER_H__
|