|
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: CXcapCacheSession |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __XCAPCACHESESSION_H__ |
|
22 #define __XCAPCACHESESSION_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32std.h> |
|
26 #include <e32cons.h> |
|
27 #include <s32file.h> |
|
28 #include <e32base.h> |
|
29 #include "XcapCacheServer.h" |
|
30 |
|
31 class MDesC16Array; |
|
32 class CXcapCacheIndex; |
|
33 class CXcapCacheIndexAdmin; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 NONSHARABLE_CLASS( CXcapCacheSession ) : public CSession2 |
|
37 { |
|
38 public: // Constructors and destructor |
|
39 |
|
40 /** |
|
41 * Symbian OS default constructor |
|
42 * |
|
43 * @param CXcapCacheServer Pointer to the server object |
|
44 * @return CXcapCacheSession* New session object |
|
45 */ |
|
46 static CXcapCacheSession* NewL( CXcapCacheServer* aServer ); |
|
47 |
|
48 /** |
|
49 * Service a request |
|
50 * |
|
51 * @param RMessage& Kernel message |
|
52 * @return void |
|
53 */ |
|
54 virtual void ServiceL ( const RMessage2& aMessage ); |
|
55 |
|
56 /** |
|
57 * Destructor. |
|
58 */ |
|
59 virtual ~CXcapCacheSession(); |
|
60 |
|
61 private: |
|
62 |
|
63 /** |
|
64 * Second-phase constructor |
|
65 * |
|
66 * @return void |
|
67 */ |
|
68 void ConstructL(); |
|
69 |
|
70 /** |
|
71 * C++ default constructor is private. |
|
72 * |
|
73 * @param CXcapCacheServer Pointer to the server object |
|
74 * @return CXcapCacheSession New session object |
|
75 */ |
|
76 CXcapCacheSession( CXcapCacheServer* aServer ); |
|
77 |
|
78 /** |
|
79 * Check the capabilities of the connecting client |
|
80 * |
|
81 * @param RMessage2& Kernel message |
|
82 * @return TBool Does the client have proper capabilities |
|
83 */ |
|
84 TBool Capabilities( const RMessage2& aMessage ); |
|
85 |
|
86 /** |
|
87 * Panic the client |
|
88 * |
|
89 * @param TInt Panic code |
|
90 * @return void |
|
91 */ |
|
92 void PanicClient( TInt aPanic ); |
|
93 |
|
94 /** |
|
95 * Dispatch the client's request |
|
96 * |
|
97 * @param RMessage2& Kernel message |
|
98 * @return void |
|
99 */ |
|
100 void DispatchMessageL( const RMessage2& aMessage ); |
|
101 |
|
102 /** |
|
103 * Fetch the meta information for a document |
|
104 * |
|
105 * @param RMessage2& Kernel message |
|
106 * @return void |
|
107 */ |
|
108 void FetchDocumentInfoL( const RMessage2& aMessage ); |
|
109 |
|
110 /** |
|
111 * Fetch the contents of a document |
|
112 * |
|
113 * @param RMessage2& Kernel message |
|
114 * @return void |
|
115 */ |
|
116 void FetchDocumentContentsL( const RMessage2& aMessage ); |
|
117 |
|
118 /** |
|
119 * Store a document |
|
120 * |
|
121 * @param RMessage2& Kernel message |
|
122 * @return void |
|
123 */ |
|
124 void CacheXcapDataL( const RMessage2& aMessage ); |
|
125 |
|
126 /** |
|
127 * Delete a document from the cache |
|
128 * |
|
129 * @param RMessage2& Kernel message |
|
130 * @return void |
|
131 */ |
|
132 void DeleteCacheDataL( const RMessage2& aMessage ); |
|
133 |
|
134 /** |
|
135 * Check the currency of a document |
|
136 * |
|
137 * @param RMessage2& Kernel message |
|
138 * @return void |
|
139 */ |
|
140 void CheckValidityL( const RMessage2& aMessage ); |
|
141 |
|
142 /** |
|
143 * Externalize the meta information |
|
144 * |
|
145 * @return void |
|
146 */ |
|
147 void FlushCacheDataL(); |
|
148 |
|
149 /** |
|
150 * Delete unindexed documents from the cache |
|
151 * |
|
152 * @param MDesC16Array Indexed documents |
|
153 * @return void |
|
154 */ |
|
155 void DeleteExcessL( const MDesC16Array& aIndexedEntries ); |
|
156 |
|
157 /** |
|
158 * Check for unindexed entries in the cache |
|
159 * |
|
160 * @param TInt Total number of documents in the cache |
|
161 * @return void |
|
162 */ |
|
163 void CheckUnindexedEntriesL( TInt aTotalCount ); |
|
164 |
|
165 /** |
|
166 * Check whether the "aFileName" document is indexed |
|
167 * |
|
168 * @param MDesC16Array& The indexed entries |
|
169 * @param TDesC& Name of the dile to be checked |
|
170 * @return TBool Is the document indexed |
|
171 */ |
|
172 TBool IsIndexed( const MDesC16Array& aIndexedEntries, const TDesC& aFileName ); |
|
173 |
|
174 /** |
|
175 * Read the specified parameter from the kernel message |
|
176 * |
|
177 * @param TInt The parameter to be read |
|
178 * @param RMessage2& Kernel message |
|
179 * @return HBufC* The parameter data (16-bit) |
|
180 */ |
|
181 HBufC* ReadMsgParam16LC( TInt aMsgIndex, const RMessage2& aMessage ); |
|
182 |
|
183 /** |
|
184 * Read the specified parameter from the kernel message |
|
185 * |
|
186 * @param TInt The parameter to be read |
|
187 * @param RMessage2& Kernel message |
|
188 * @return HBufC8* The parameter data (8-bit) |
|
189 */ |
|
190 HBufC8* ReadMsgParam8LC( TInt aMsgIndex, const RMessage2& aMessage ); |
|
191 |
|
192 /** |
|
193 * Check the temporary buffer for data |
|
194 * |
|
195 * @return void |
|
196 */ |
|
197 void CheckTempBuffer(); |
|
198 |
|
199 /** |
|
200 * Delete a named document from the store |
|
201 * |
|
202 * @param TDesC& Name of the document to be deleted |
|
203 * @return TInt Error code |
|
204 */ |
|
205 TInt DeleteFromStorageL( const TDesC& aFileName ); |
|
206 |
|
207 /** |
|
208 * Read a named document from the store |
|
209 * |
|
210 * @param TDesC& Name of the document to be deleted |
|
211 * @return HBufC* The contents of the document |
|
212 */ |
|
213 HBufC8* ReadFromStorageL( const TDesC& aFileName ); |
|
214 |
|
215 private: //Data |
|
216 |
|
217 HBufC8* iTempBuffer; |
|
218 CFileMan* iFileManager; |
|
219 CXcapCacheServer* iCacheServer; |
|
220 CXcapCacheIndex& iCacheIndex; |
|
221 CXcapCacheIndexAdmin& iCacheIndexAdmin; |
|
222 }; |
|
223 |
|
224 |
|
225 #endif |
|
226 |
|
227 // End of File |