First public contribution.
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // fileserver/sfsrv/clnotification.h
23 #ifndef __CLNOTIFICATION_H__
24 #define __CLNOTIFICATION_H__
26 #include "f32notification.h"
32 * In general, the getter functions for TFsNotification extract data from a given buffer in the order:
33 * <Notification Size> <Path Length> <Type> <Path> [any sub-class members]
34 * Notification of type EOverflow doesn't have a path associated with it
35 * If a new name exists (ERename, EVolumeName and EDriveName) then the order is:
36 * <Notification Size> <Path Length> <New Name Length> <Type> <Path> <New Name>
37 * For EAttribute the order is:
38 * <Notification Size> <Path Length> <Type> <Path> <Attribute>
39 * For EFileChange the order is:
40 * <Notification Size> <Path Length> <Type> <Path> <File Size>
44 * A Mask of all the valid filters that a client can set
47 const TInt KNotificationValidFiltersMask = (TUint)(
48 TFsNotification::EAttribute |
49 TFsNotification::ECreate |
50 TFsNotification::EDelete |
51 TFsNotification::EDriveName |
52 TFsNotification::EFileChange |
53 TFsNotification::EMediaChange |
54 TFsNotification::ERename |
55 TFsNotification::EVolumeName
59 * Different notification types have different data associated with them.
61 * All types have the following data and are aligned in the buffer like so:
62 * Word1 : Size (TUint16 - upper 2 bytes) , NameLength (TUint16 - lower 2 bytes),
63 * Word2 : Type (TUint - 4 bytes)
64 * [not yet supported - Word3 : UID (TUint32 - 4 Bytes) ]
69 const TInt KNotificationHeaderSize = (sizeof(TUint16)*2)+(sizeof(TUint));
72 //const TInt KNotificationHeaderSize = (sizeof(TUint16)*2)+(sizeof(TUint))+sizeof(TUint32);
75 * This is the minimum allowed size of the buffer set by the client that is
76 * equal to the size of a notification of maximum length and an overflow
81 const TInt KMinNotificationBufferSize = 2*KNotificationHeaderSize + 2*KMaxFileName;
86 * Fill any dead space at the end of the buffer with this
87 * If there is any dead space it should always be at least 1 word in size
90 const TUint KNotificationBufferFiller = 0xFFFFFFFF;
92 class TFsNotification; //forward ref
94 /* This class is used as the buffer in the file server notifier framework.
96 * The buffer itself is simply a descriptor.
98 * This class is internal because we may wish to change the
99 * buffer mechanism in the future without BC breaks etc.
101 * @internalTechnology
103 class CFsNotificationList : public CBase
106 static CFsNotificationList* NewL(TInt aBufferSize);
107 virtual ~CFsNotificationList();
110 CFsNotificationList();
111 const TFsNotification * NextNotification();
112 TInt BufferSize() const;
114 HBufC8* iBuf; //Heap based to allow buffer size spec at runtime
115 TInt iHead; //offset to the head of the readable data.
116 TInt iTail; //offset to end of the readable data.
118 TPckg<TInt> iTailPckg; //stores iTail, used in Asyc IPC
119 TPtr8 iBufferPtr; //stores iBuf->Ptr, used in Asyc IPC
120 friend class RFsNotify;
121 friend class CFsNotify;
125 * @internalTechnology
127 class RFsNotify : public RSubSessionBase
130 TInt Open(RFs& aFs,CFsNotificationList* aBuffer, TRequestStatus& aBufferStatus);
133 //[Re]Issues notification request
134 void RequestNotifications(TRequestStatus& aStatus, TPckg<TInt>& aTailPckg);
135 TInt CancelNotifications();
136 TInt AddNotification(TUint aNotificationType, const TDesC& aPath, const TDesC& aFilename);
137 TInt RemoveNotifications();
141 * @internalTechnology
143 * This class is the iBody of CFsNotify. It is being used to shield the client from the internals which are being stored here.
147 class CFsNotifyBody : public CBase
150 virtual ~CFsNotifyBody();
153 TRequestStatus iBufferStatus; //for server->buffer updates
154 TRequestStatus* iClientStatus; //Client's TRS:for receiving notification
155 CFsNotificationList* iBuffer; //Buffer into which the server puts the notifications
158 friend class CFsNotify;
160 #endif //__CLNOTIFICATION_H__