equal
deleted
inserted
replaced
49 * @internalTechnology |
49 * @internalTechnology |
50 */ |
50 */ |
51 class CFsNotificationPathFilter |
51 class CFsNotificationPathFilter |
52 { |
52 { |
53 public: |
53 public: |
54 static CFsNotificationPathFilter* NewL(const TDesC& aPath, const TDesC& aFilename); |
54 static CFsNotificationPathFilter* NewL(const TDesC& aPath, const TDesC& aFilename, TInt aDriveNum); |
55 ~CFsNotificationPathFilter(); |
55 ~CFsNotificationPathFilter(); |
56 private: |
56 private: |
57 void ConstructL(const TDesC& aPath, const TDesC& aFilename); |
57 void ConstructL(const TDesC& aPath, const TDesC& aFilename, TInt aDriveNum); |
58 CFsNotificationPathFilter(); |
58 CFsNotificationPathFilter(); |
59 public: |
59 public: |
|
60 TInt iDriveNum; |
60 HBufC* iPath; |
61 HBufC* iPath; |
61 HBufC* iFilename; |
62 HBufC* iFilename; |
62 }; |
63 }; |
63 |
64 |
64 /** |
65 /** |
117 static CFsNotifyRequest* NewL(); |
118 static CFsNotifyRequest* NewL(); |
118 virtual ~CFsNotifyRequest(); |
119 virtual ~CFsNotifyRequest(); |
119 |
120 |
120 /* |
121 /* |
121 * Returns the RArray<TFsNotificationFilter> for an index |
122 * Returns the RArray<TFsNotificationFilter> for an index |
122 * as returned from FsNotificationHelper::TypeToIndex() |
123 * as returned from CFsNotificationInfo::TypeToIndex() |
123 */ |
124 */ |
124 TFsNotificationTypeArray* FilterTypeList(TInt aDrive,TInt aIndex); |
125 TFsNotificationTypeArray* FilterTypeList(TInt aDrive,TInt aIndex); |
125 |
126 |
126 //Removes all filters from iFilterList |
127 //Removes all filters from iFilterList |
127 TInt RemoveFilters(); |
128 TInt RemoveFilters(); |
155 * Called from FsNotificationManager::HandleChange(), |
156 * Called from FsNotificationManager::HandleChange(), |
156 * this function packages the data in to a CFsNotificationBlock in preperation for |
157 * this function packages the data in to a CFsNotificationBlock in preperation for |
157 * notification of this operation to the client. |
158 * notification of this operation to the client. |
158 * |
159 * |
159 * Calling of this function means that we are notifying about this operation. (all checks passed) |
160 * Calling of this function means that we are notifying about this operation. (all checks passed) |
160 * |
161 */ |
161 * aRequest can be NULL when the request doesn't come from the file server |
162 TInt NotifyChange(CFsNotificationInfo* aRequest, CFsNotificationBlock& aBlock); |
162 * (such as when a media card is removed) |
|
163 */ |
|
164 TInt NotifyChange(CFsClientMessageRequest* aRequest, const TDesC& aName, TFsNotification::TFsNotificationType aNotificationType, CFsNotificationBlock& aBlock); |
|
165 |
163 |
166 /* |
164 /* |
167 * This function performs the IPC to the client's buffer. |
165 * This function performs the IPC to the client's buffer. |
168 */ |
166 */ |
169 TInt SynchroniseBuffer(CFsNotificationBlock& aBlock,TInt aServerTail, TInt aNotificationSize); |
167 TInt SynchroniseBuffer(CFsNotificationBlock& aBlock,TInt aServerTail, TInt aNotificationSize); |
171 //Closing this notification |
169 //Closing this notification |
172 void CloseNotification(); |
170 void CloseNotification(); |
173 |
171 |
174 //Simple getter |
172 //Simple getter |
175 TInt ClientMsgHandle(); |
173 TInt ClientMsgHandle(); |
|
174 |
|
175 //Platsec needs to check against the path with a message of the *receiving* client. |
|
176 const RMessage2& BufferMessage(); |
176 |
177 |
177 private: |
178 private: |
178 CFsNotifyRequest(); |
179 CFsNotifyRequest(); |
179 void ConstructL(); |
180 void ConstructL(); |
180 |
181 |
214 * associated with a particular drive. |
215 * associated with a particular drive. |
215 * |
216 * |
216 * Each index of the TFsNotificationTypeDriveArray is a TFsNotificationTypeArray |
217 * Each index of the TFsNotificationTypeDriveArray is a TFsNotificationTypeArray |
217 */ |
218 */ |
218 RHashMap<TInt,TFsNotificationTypeDriveArray> iDrivesTypesFiltersMap; |
219 RHashMap<TInt,TFsNotificationTypeDriveArray> iDrivesTypesFiltersMap; |
219 |
220 |
220 /* |
|
221 * The iPathFilterList is an RPointerArray of CFsNotificationPathFilters. |
|
222 * |
|
223 * These are normally only accessed via a TFsNotificationTypeFilter (via iDrivesTypesFiltersMap), |
|
224 * not via this array directly. |
|
225 */ |
|
226 RPointerArray<CFsNotificationPathFilter> iPathFilterList; |
|
227 |
|
228 RMessage2 iBufferMsg; //To update buffer |
221 RMessage2 iBufferMsg; //To update buffer |
229 RMessage2 iClientMsg; //client notification request |
222 RMessage2 iClientMsg; //client notification request |
230 |
223 |
231 CSessionFs* iSession; //Session associated with this request (TFsSessionDisconnect::DoRequestL) |
224 CSessionFs* iSession; //Session associated with this request (TFsSessionDisconnect::DoRequestL) |
232 |
225 |
268 CFsNotificationBlock(); |
261 CFsNotificationBlock(); |
269 TText8 iData[KMinNotificationBufferSize]; |
262 TText8 iData[KMinNotificationBufferSize]; |
270 }; |
263 }; |
271 |
264 |
272 /** |
265 /** |
273 * Helper class to get certain attributes from or about a particular operation to used in a notification |
|
274 * |
|
275 * @internalTechnology |
|
276 */ |
|
277 class FsNotificationHelper |
|
278 { |
|
279 public: |
|
280 static void NotificationType(TInt aFunction,TFsNotification::TFsNotificationType& aNotificationType); |
|
281 static void PathName(CFsClientMessageRequest& aRequest, TDes& aName); |
|
282 static void NewPathName(CFsClientMessageRequest& aRequest, TPtrC& aName); |
|
283 static TInt NotificationSize(CFsClientMessageRequest& aRequest, TFsNotification::TFsNotificationType aNotificationType, const TDesC& aName); |
|
284 static TInt TypeToIndex(TFsNotification::TFsNotificationType aType); |
|
285 static TFsNotification::TFsNotificationType NotificationType(TInt& aIndex); |
|
286 static TInt DriveNumber(const TPtrC& aPath); |
|
287 static void Attributes(CFsClientMessageRequest& aRequest, TUint& aSet, TUint& aClear); |
|
288 }; |
|
289 |
|
290 /** |
|
291 * The FsNotificationManager is a static object |
266 * The FsNotificationManager is a static object |
292 * |
267 * |
293 *@internalTechnology |
268 *@internalTechnology |
294 */ |
269 */ |
295 class FsNotificationManager |
270 class FsNotificationManager |
305 |
280 |
306 /* A change has occurred represented by this request. |
281 /* A change has occurred represented by this request. |
307 * Work out which CFsNotifyRequests are interested |
282 * Work out which CFsNotifyRequests are interested |
308 * (if any) and call CFsNotifyRequest::NotifyChange. |
283 * (if any) and call CFsNotifyRequest::NotifyChange. |
309 */ |
284 */ |
310 static void HandleChange(CFsClientMessageRequest& aRequest); |
285 static void HandleChange(CFsNotificationInfo& aRequest); |
311 |
286 |
312 /* A change has occurred represented by this request. |
|
313 * Work out which CFsNotifyRequests are interested |
|
314 * (if any) and call CFsNotifyRequest::NotifyChange. |
|
315 * |
|
316 * This override is used directly when we want to force a particular notification type |
|
317 */ |
|
318 static void HandleChange(CFsClientMessageRequest& aRequest, TFsNotification::TFsNotificationType aType); |
|
319 |
|
320 /* |
|
321 * This override is used directly when we want to specify the current operation's name (src) and notification type. |
|
322 * |
|
323 * aRequest can be NULL when the request doesn't come from the file server |
|
324 * such as when a media card is removed, see LocalDrives::CompleteDriveNotifications |
|
325 * |
|
326 * @See LocalDrives::CompleteDriveNotifications(TInt aDrive) |
|
327 */ |
|
328 static void HandleChange(CFsClientMessageRequest* aRequest, const TDesC& aOperationName, TFsNotification::TFsNotificationType aType); |
|
329 |
|
330 //Initialise iNotifyRequests and iStaticNotification |
287 //Initialise iNotifyRequests and iStaticNotification |
331 static void OpenL(); |
288 static void OpenL(); |
332 static TBool IsInitialised(); |
289 static TBool IsInitialised(); |
333 |
290 |
334 /* |
291 /* |
348 * HandleChange doesn't need to do any iteration for that type. |
305 * HandleChange doesn't need to do any iteration for that type. |
349 */ |
306 */ |
350 static void SetFilterRegister(TUint aFilter, TBool aAdd, TInt aCount = 1); |
307 static void SetFilterRegister(TUint aFilter, TBool aAdd, TInt aCount = 1); |
351 /* |
308 /* |
352 * Get the number of registers filters set up on a particular type. |
309 * Get the number of registers filters set up on a particular type. |
353 * @param aIndex the TFsNotificationType's index as determined from FsNotificationHelper::TypeToIndex |
310 * @param aIndex the TFsNotificationType's index as determined from CFsNotificationInfo::TypeToIndex |
354 */ |
311 */ |
355 static TInt& FilterRegister(TInt aIndex); |
312 static TInt& FilterRegister(TInt aIndex); |
356 |
313 |
357 /* |
314 /* |
358 * Returns the number of CFsNotifyRequests set up |
315 * Returns the number of CFsNotifyRequests set up |
384 }; |
341 }; |
385 |
342 |
386 /* |
343 /* |
387 * Checks whether aOperation matches the filter name and/or path set in aFilter. |
344 * Checks whether aOperation matches the filter name and/or path set in aFilter. |
388 */ |
345 */ |
389 static TFsNotificationFilterMatch DoMatchFilter(CFsClientMessageRequest* aRequest, const TDesC& aOperationName,CFsNotificationPathFilter& aFilter); |
346 static TFsNotificationFilterMatch DoMatchFilter(const RMessage2& aMessage, const TDesC& aOperationName,CFsNotificationPathFilter& aFilter); |
390 |
347 |
391 /* |
348 /* |
392 * Iterates filters for a particular drive. |
349 * Iterates filters for a particular drive. |
393 * Called from HandleChange |
350 * Called from HandleChange |
394 */ |
351 */ |
395 static void DoHandleChange(TFsNotificationTypeArray* aFilterTypeArray, TInt& aSeenFilter, CFsClientMessageRequest* aRequest, CFsNotifyRequest* aNotifyRequest, const TDesC& aOperationName, TFsNotification::TFsNotificationType& aType); |
352 static void DoHandleChange(TFsNotificationTypeArray* aFilterTypeArray, TInt& aSeenFilter, CFsNotificationInfo& aNotificationInfo, CFsNotifyRequest* aNotifyRequest); |
396 |
353 |
397 /* |
354 /* |
398 * Stores the CFsNotifyRequests |
355 * Stores the CFsNotifyRequests |
399 */ |
356 */ |
400 static CFsObjectCon* iNotifyRequests; |
357 static CFsObjectCon* iNotifyRequests; |