|
1 /* |
|
2 * Copyright (c) 2005 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: CXcapCacheServer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __XCAPCACHESERVER_H__ |
|
22 #define __XCAPCACHESERVER_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32std.h> |
|
26 #include <s32file.h> |
|
27 #include "ServerDefines.h" |
|
28 #include "CommonDefines.h" |
|
29 #include "XcapShutdownTimer.h" |
|
30 |
|
31 //CONSTANTS |
|
32 _LIT( KCacheServerRoot, "C:\\private\\10207421\\" ); |
|
33 _LIT( KCacheServerIndex, "C:\\private\\10207421\\index.ch" ); |
|
34 _LIT( KCacheServerPageFile, "C:\\private\\10207421\\pagefile.ch" ); |
|
35 _LIT( KCacheServerIndexF, "index.ch" ); |
|
36 _LIT( KCacheServerPageFileF, "pagefile.ch" ); |
|
37 |
|
38 _LIT( KCacheServerLogDir, "XDM" ); |
|
39 _LIT( KCacheServerLogFile, "CacheServer.txt" ); |
|
40 const TUint KAppDefaultHeapSize = 0x10000; |
|
41 |
|
42 //FORWARD DECLARATIONs |
|
43 class CXcapCacheIndex; |
|
44 class CXcapCacheIndexAdmin; |
|
45 |
|
46 // CLASS DECLARATION |
|
47 class CXcapCacheServer : public CServer2 |
|
48 { |
|
49 public: // Constructors and destructor |
|
50 |
|
51 /** |
|
52 * Returns KErrNone |
|
53 * @return TInt System wide error code |
|
54 */ |
|
55 IMPORT_C static TInt StartThreadL(); |
|
56 |
|
57 /** |
|
58 * A global logging function for 8 bit data. |
|
59 * @param aCommand command to be handled |
|
60 */ |
|
61 IMPORT_C static void WriteToLog( TRefByValue<const TDesC8> aFmt,... ); |
|
62 |
|
63 /** |
|
64 * Returns the MIME type of the messages |
|
65 * @return TPtrC8 The MIME type of the messages |
|
66 */ |
|
67 static CServer2* NewLC( void ); |
|
68 |
|
69 /** |
|
70 * Returns the MIME type of the messages |
|
71 * @return TPtrC8 The MIME type of the messages |
|
72 */ |
|
73 virtual CSession2* NewSessionL( const TVersion& aVersion, |
|
74 const RMessage2& /*aMessage*/ ) const; |
|
75 |
|
76 /** |
|
77 * Returns the MIME type of the messages |
|
78 * @return TPtrC8 The MIME type of the messages |
|
79 */ |
|
80 RFs* Session(); |
|
81 |
|
82 /** |
|
83 * Returns the MIME type of the messages |
|
84 * @return TPtrC8 The MIME type of the messages |
|
85 */ |
|
86 TInt CacheSize( TInt& aEntryCount ); |
|
87 |
|
88 /** |
|
89 * Returns the MIME type of the messages |
|
90 * @return TPtrC8 The MIME type of the messages |
|
91 */ |
|
92 TInt MaxCacheSize() const; |
|
93 |
|
94 /** |
|
95 * Returns the MIME type of the messages |
|
96 * @return TPtrC8 The MIME type of the messages |
|
97 */ |
|
98 ~CXcapCacheServer(); |
|
99 |
|
100 public: //static |
|
101 |
|
102 /** |
|
103 * A global logging function for 8 bit data. |
|
104 * @param aCommand command to be handled |
|
105 */ |
|
106 static RFs& FileSession(); |
|
107 |
|
108 /** |
|
109 * A global logging function for 8 bit data. |
|
110 * @param aCommand command to be handled |
|
111 */ |
|
112 static CXcapCacheIndex* Index(); |
|
113 |
|
114 /** |
|
115 * A global logging function for 8 bit data. |
|
116 * @param aCommand command to be handled |
|
117 */ |
|
118 static CXcapCacheIndexAdmin* IndexAdmin(); |
|
119 |
|
120 /** |
|
121 * A global logging function for 8 bit data. |
|
122 * @param aCommand command to be handled |
|
123 */ |
|
124 static TInt ConvertDesc( const TDesC8& aNumberDesc ); |
|
125 |
|
126 /** |
|
127 * A function to handle descriptor data. |
|
128 * @return Date in heap descriptor |
|
129 */ |
|
130 static HBufC* DateL(); |
|
131 |
|
132 /** |
|
133 * A function to handle descriptor data. |
|
134 * @return Time in heap descriptor |
|
135 */ |
|
136 static HBufC* TimeL(); |
|
137 |
|
138 /** |
|
139 * A function to handle descriptor data. |
|
140 * @return Random string heap descriptor |
|
141 */ |
|
142 static HBufC* RandomStringL(); |
|
143 |
|
144 /** |
|
145 * A function to handle descriptor data. |
|
146 * @return Date and time heap descriptor |
|
147 */ |
|
148 static HBufC* DateTimeL(); |
|
149 |
|
150 /** |
|
151 * A function to handle descriptor data. |
|
152 * @return Date and time heap descriptor |
|
153 */ |
|
154 static HBufC* DateTimeL( const TTime& aTime ); |
|
155 |
|
156 /** |
|
157 * A function to handle descriptor data. |
|
158 * @param aCommand command to be handled |
|
159 */ |
|
160 static TPtr8 DescriptorCast( const TDesC8& aConstData ); |
|
161 |
|
162 private: |
|
163 |
|
164 /** |
|
165 * Returns the MIME type of the messages |
|
166 * @return TPtrC8 The MIME type of the messages |
|
167 */ |
|
168 CXcapCacheServer( TInt aPriority ); |
|
169 |
|
170 /** |
|
171 * Returns the MIME type of the messages |
|
172 * @return TPtrC8 The MIME type of the messages |
|
173 */ |
|
174 void ConstructL(); |
|
175 |
|
176 /** |
|
177 * Returns the MIME type of the messages |
|
178 * @return TPtrC8 The MIME type of the messages |
|
179 */ |
|
180 void ReadMaxCacheSizeL(); |
|
181 |
|
182 /** |
|
183 * Returns the MIME type of the messages |
|
184 * @return TPtrC8 The MIME type of the messages |
|
185 */ |
|
186 void AddSession(); |
|
187 |
|
188 /** |
|
189 * Returns the MIME type of the messages |
|
190 * @return TPtrC8 The MIME type of the messages |
|
191 */ |
|
192 void DropSession(); |
|
193 |
|
194 private: // Data |
|
195 |
|
196 RFs iFileSession; |
|
197 TInt iMaxCacheSize; |
|
198 TUint iSessionCount; |
|
199 CDir* iCacheDirectory; |
|
200 CXcapShutdownTimer iShutdownTimer; |
|
201 friend class CXcapCacheSession; |
|
202 }; |
|
203 |
|
204 #endif |
|
205 |
|
206 // End of File |