1 /* |
|
2 * Copyright (c) 2003-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Remote File Engine server |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_RSFWRFESERVER_H |
|
20 #define C_RSFWRFESERVER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <f32file.h> |
|
25 |
|
26 class CRsfwVolumeTable; |
|
27 |
|
28 // CONSTANTS |
|
29 /** Panic Category */ |
|
30 _LIT(KRfeServer, "RemoteFileEngine"); |
|
31 |
|
32 // for security check, same as File Server UID |
|
33 const TUint KFileServerSecureUid = 0x100039e3; |
|
34 |
|
35 /** server inactivity timeout, in seconds */ |
|
36 const TInt KRfeServerShutdownInterval = 5; |
|
37 |
|
38 |
|
39 // DATA TYPES |
|
40 /** Remote File Engine panic codes */ |
|
41 enum TRfePanic |
|
42 { |
|
43 EBadRequest, |
|
44 EBadDescriptor, |
|
45 ESrvCreateServer, |
|
46 ECreateTrapCleanup, |
|
47 ENullRequestHandler, |
|
48 EUndefinedRequest, |
|
49 ECacheInconsistency, |
|
50 EConstructingServerStructs |
|
51 }; |
|
52 |
|
53 // MACROS |
|
54 |
|
55 // FORWARD DECLARATIONS |
|
56 class CRsfwConfig; |
|
57 class CRsfwRfeServer; |
|
58 |
|
59 |
|
60 // CLASS DECLARATION |
|
61 class TRfeEnv |
|
62 { |
|
63 public: |
|
64 RFs iFs; |
|
65 TInt iCacheDrive; |
|
66 TFileName iCacheRoot; |
|
67 CRsfwConfig* iRsfwConfig; |
|
68 }; |
|
69 |
|
70 |
|
71 // CLASS DECLARATION |
|
72 |
|
73 class CRsfwRfeServer: public CPolicyServer |
|
74 { |
|
75 friend class CRsfwRfeSession; |
|
76 |
|
77 public: |
|
78 static CRsfwRfeServer* NewL(); |
|
79 static CRsfwRfeServer* NewLC(); |
|
80 static TInt ThreadFunction(TAny* aNone); |
|
81 |
|
82 void IncrementSessions(); |
|
83 void DecrementSessions(); |
|
84 |
|
85 void AllEnginesIdling(TInt aTimeout); |
|
86 void ServiceRequested(); |
|
87 |
|
88 static TRfeEnv* Env() |
|
89 { |
|
90 return iEnvp; |
|
91 } |
|
92 |
|
93 protected: |
|
94 TInt RunError(TInt aError); |
|
95 |
|
96 // custom action when capability checked failed - basically this allows File Server to always |
|
97 // pass based on its SID (File Server does not have NetworkServices or ReadDeviceData capabilities) |
|
98 TCustomResult CustomFailureActionL(const RMessage2& aMsg, |
|
99 TInt aAction, |
|
100 const TSecurityInfo& aMissing); |
|
101 |
|
102 private: |
|
103 CRsfwRfeServer(TInt aPriority, TServerType aType) ; |
|
104 void ConstructL() ; |
|
105 static void PanicClient(const RMessage2& aMessage, TRfePanic aReason); |
|
106 static void PanicServer(TRfePanic aReason); |
|
107 static void ThreadFunctionL(); |
|
108 CSession2* NewSessionL(const TVersion &aVersion, |
|
109 const RMessage2& aMessage) const; |
|
110 void PrepareCacheRootL(); |
|
111 void ShutDown(); |
|
112 void StartDelayedShutdownTimer(TInt aTimeout); |
|
113 void StopDelayedShutdownTimer(); |
|
114 static TInt DelayedShutdownTimerExpired(TAny* aArg); |
|
115 |
|
116 protected: |
|
117 CRsfwVolumeTable* iVolumes; |
|
118 |
|
119 private: |
|
120 TInt iSessionCount; |
|
121 TRfeEnv iEnv; |
|
122 static TRfeEnv* iEnvp; |
|
123 TBool iShuttingDown; |
|
124 CPeriodic* iDelayedShutdownTimer; |
|
125 }; |
|
126 |
|
127 #endif // RFESERVER_H |
|
128 |
|
129 // End of File |
|