|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Server declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CDCFREPSRV_H |
|
21 #define CDCFREPSRV_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <D32DBMS.H> |
|
25 #include <e32base.h> |
|
26 #include "Pair.h" |
|
27 #include "procwatcher.h" |
|
28 |
|
29 // CONSTANTS |
|
30 // MACROS |
|
31 // DATA TYPES |
|
32 enum TDcfRepSrvPanic |
|
33 { |
|
34 ESrvCreateServer = 1000, |
|
35 ECreateTrapCleanup |
|
36 }; |
|
37 |
|
38 enum TServerState |
|
39 { |
|
40 EStateIdle = 0, |
|
41 EStateSetTtid, |
|
42 EStateFullScan, |
|
43 EStateScan |
|
44 }; |
|
45 // FUNCTION PROTOTYPES |
|
46 // FORWARD DECLARATIONS |
|
47 class CFileScan; |
|
48 class COma2Dcf; |
|
49 // CLASS DECLARATION |
|
50 |
|
51 /** |
|
52 * Server implementation. |
|
53 * DCF Repository |
|
54 * |
|
55 * @lib |
|
56 * @since Series 60 3.0 |
|
57 */ |
|
58 class CDcfRepSrv : public CServer2, public MWatcherObserver |
|
59 { |
|
60 public: // Constructors and destructor |
|
61 |
|
62 /** |
|
63 * Two-phased constructor. |
|
64 */ |
|
65 static CDcfRepSrv* NewLC(); |
|
66 |
|
67 /** |
|
68 * Destructor. |
|
69 */ |
|
70 virtual ~CDcfRepSrv(); |
|
71 |
|
72 public: // New functions |
|
73 |
|
74 /** |
|
75 * Startup starts the actual server after initializing |
|
76 * the cleanup stack and active scheduler. |
|
77 * @since S60Rel3.0 |
|
78 * @return system error code if error happens |
|
79 */ |
|
80 static TInt Startup(void); |
|
81 |
|
82 /** |
|
83 * AddFileL |
|
84 * @since Series 60 3.0 |
|
85 * @param aFile file name |
|
86 * @KErrNotSupported if file is not protected file |
|
87 */ |
|
88 void AddFileL( const TDesC& aFile ); |
|
89 |
|
90 /** |
|
91 * ProcessFile |
|
92 * @since Series 60 3.0 |
|
93 * @param aFile file name |
|
94 * @param aFlag ETrue if the file satisfy to criteria of scanning target |
|
95 * @return system error |
|
96 */ |
|
97 TInt ProcessFile( const TDesC& aFile , TInt& aType ); |
|
98 |
|
99 /** |
|
100 * State |
|
101 * @since Series 60 3.0 |
|
102 * @return state of the server |
|
103 */ |
|
104 TInt State() const; |
|
105 |
|
106 /** |
|
107 * SetState |
|
108 * @since Series 60 3.0 |
|
109 * @param aMode server state |
|
110 * @return |
|
111 */ |
|
112 void SetState(TServerState aMode); |
|
113 |
|
114 /** |
|
115 * CompleteScanning |
|
116 * @since Series 60 3.0 |
|
117 * @param aRet return code |
|
118 */ |
|
119 void CompleteScanning(TInt err); |
|
120 |
|
121 |
|
122 /** |
|
123 * SetMessage |
|
124 * @since Series 60 3.0 |
|
125 * @param aMessage Message from client |
|
126 */ |
|
127 RMessage2* SetMessageL(const RMessage2& aMessage); |
|
128 |
|
129 /** |
|
130 * Scan |
|
131 * @since Series 60 3.0 |
|
132 * @return error code |
|
133 */ |
|
134 TInt Scan(); |
|
135 |
|
136 /** |
|
137 * SetCidList |
|
138 * @since Series 60 3.0 |
|
139 * @param aList content ID list |
|
140 */ |
|
141 void SetCidList(RPointerArray<HBufC8>*& aList); |
|
142 |
|
143 |
|
144 /** |
|
145 * SetPairList |
|
146 * @since Series 60 3.0 |
|
147 * @param aList list of pairs for content ID and transaction ID |
|
148 */ |
|
149 void SetPairList(RPointerArray<CPair>*& aList); |
|
150 |
|
151 /** |
|
152 * Stop watching the Rights Server |
|
153 * @since Series 60 3.1 |
|
154 */ |
|
155 void StopWatchingL(); |
|
156 |
|
157 /** |
|
158 * RemoveMessageL |
|
159 * Called by destructor of the session class |
|
160 */ |
|
161 void RemoveMessageL( const RMessage2* aMessage ); |
|
162 |
|
163 |
|
164 public: // Functions from base classes |
|
165 |
|
166 //class MWatcherObserver |
|
167 |
|
168 /** |
|
169 * Called when the peer process died |
|
170 * |
|
171 * @since S60 3.0 |
|
172 * @param aObject Changed object |
|
173 */ |
|
174 void WatchedObjectChangedL( const TDesC& aObject ); |
|
175 |
|
176 protected: // New functions |
|
177 |
|
178 protected: // Functions from base classes |
|
179 |
|
180 // Class CServer |
|
181 /** |
|
182 * NewSessionL |
|
183 * @since S60Rel3.0 |
|
184 */ |
|
185 CSession2* NewSessionL( const TVersion& aVersion, |
|
186 const RMessage2& aMessage ) const; |
|
187 |
|
188 |
|
189 private: |
|
190 |
|
191 /** |
|
192 * C++ default constructor. |
|
193 */ |
|
194 CDcfRepSrv(); |
|
195 |
|
196 /** |
|
197 * By default Symbian 2nd phase constructor is private. |
|
198 */ |
|
199 void ConstructL(); |
|
200 |
|
201 /** |
|
202 * StartupL called by StartUp |
|
203 * @since S60 Rel 3.0 |
|
204 */ |
|
205 static void StartupL(); |
|
206 |
|
207 /** |
|
208 * PanicServer will panic with panic code |
|
209 * @since S60 Rel 3.0 |
|
210 */ |
|
211 static void PanicServer(TDcfRepSrvPanic aPanic); |
|
212 |
|
213 /** |
|
214 * CleanScanInternal will clean list for Scan |
|
215 * @since S60 Rel 3.0 |
|
216 */ |
|
217 void CleanScanInternal(); |
|
218 |
|
219 /** |
|
220 * CleanDatabase will close database connection |
|
221 * @since S60 Rel 3.0 |
|
222 */ |
|
223 void CleanDatabase(); |
|
224 |
|
225 /** |
|
226 * OpenDatabaseL will open database connection |
|
227 * @since S60 Rel 3.0 |
|
228 */ |
|
229 void OpenDatabaseL(); |
|
230 |
|
231 /** |
|
232 * CleanTableL will clean all items in the table |
|
233 * @since S60 Rel 3.0 |
|
234 */ |
|
235 void CleanTableL(); |
|
236 |
|
237 /** |
|
238 * AddDomainRoL will add domain RO into file if there is any. |
|
239 * @since S60 Rel 3.0 |
|
240 */ |
|
241 void AddDomainRoL( const TDesC& aFile ); |
|
242 |
|
243 /** |
|
244 * CheckFileL will check the file type: dcf1,dcf2,plain |
|
245 * @since S60 Rel 3.0 |
|
246 */ |
|
247 void CheckFileL(const TDesC& aFile , TInt& aType); |
|
248 |
|
249 /** |
|
250 * StoreFileL will store file info |
|
251 * @since S60 Rel 3.0 |
|
252 */ |
|
253 void StoreFileL(const TDesC& aFile , TInt aType); |
|
254 |
|
255 /** |
|
256 * UpdateDatabaseL will store info into database |
|
257 * @since S60 Rel 3.0 |
|
258 */ |
|
259 void UpdateDatabaseL( |
|
260 const TDesC& aFile, |
|
261 TInt aPos, |
|
262 const TDesC& aCid , |
|
263 const TDesC& aGroupId , |
|
264 const TDesC& aTtid); |
|
265 |
|
266 /** |
|
267 * ResetTtidL will write new ttid into file |
|
268 * @since S60 Rel 3.0 |
|
269 */ |
|
270 void ResetTtidL( |
|
271 const TDesC& aFile, |
|
272 const TDesC8& aTtid |
|
273 ); |
|
274 |
|
275 /** |
|
276 * ResetTtidL will write new ttid into file |
|
277 * @since S60 Rel 3.0 |
|
278 */ |
|
279 void ResetTtidL( |
|
280 COma2Dcf* aDcf, |
|
281 const TDesC8& aTtid |
|
282 ); |
|
283 // Prohibit copy constructor if not deriving from CBase. |
|
284 CDcfRepSrv( const CDcfRepSrv& ); |
|
285 // Prohibit assigment operator if not deriving from CBase. |
|
286 CDcfRepSrv& operator=( const CDcfRepSrv& ); |
|
287 |
|
288 public: // Data |
|
289 protected: // Data |
|
290 private: // Data |
|
291 RDbs iDbs; |
|
292 RDbNamedDatabase iDb; |
|
293 RDbView iView; |
|
294 RFs iFs; |
|
295 CFileScan* iScan; |
|
296 RPointerArray<HBufC8>* iCidList; |
|
297 RPointerArray<CPair>* iPairList; |
|
298 RPointerArray<RMessage2> iMessageList; |
|
299 TInt iState; |
|
300 CProcWatcher* iProcWatcher; |
|
301 TBool iArmed; |
|
302 |
|
303 // Reserved pointer for future extension |
|
304 TAny* iReserved; |
|
305 |
|
306 public: // Friend classes |
|
307 protected: // Friend classes |
|
308 private: // Friend classes |
|
309 |
|
310 }; |
|
311 |
|
312 #endif // CDCFREPSRV_H |
|
313 |
|
314 // End of File |