sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // fileserver/sfsrv/clnotification.h sl@0: // sl@0: sl@0: /** sl@0: * @file sl@0: * @internalTechnology sl@0: * @released sl@0: */ sl@0: sl@0: #ifndef __CLNOTIFICATION_H__ sl@0: #define __CLNOTIFICATION_H__ sl@0: sl@0: #include "f32notification.h" sl@0: sl@0: /* sl@0: * This comment is: sl@0: * @internalTechnology sl@0: * sl@0: * In general, the getter functions for TFsNotification extract data from a given buffer in the order: sl@0: * [any sub-class members] sl@0: * Notification of type EOverflow doesn't have a path associated with it sl@0: * If a new name exists (ERename, EVolumeName and EDriveName) then the order is: sl@0: * sl@0: * For EAttribute the order is: sl@0: * sl@0: * For EFileChange the order is: sl@0: * sl@0: */ sl@0: sl@0: /** sl@0: * A Mask of all the valid filters that a client can set sl@0: * @internalTechnology sl@0: */ sl@0: const TInt KNotificationValidFiltersMask = (TUint)( sl@0: TFsNotification::EAttribute | sl@0: TFsNotification::ECreate | sl@0: TFsNotification::EDelete | sl@0: TFsNotification::EDriveName | sl@0: TFsNotification::EFileChange | sl@0: TFsNotification::EMediaChange | sl@0: TFsNotification::ERename | sl@0: TFsNotification::EVolumeName sl@0: ); sl@0: sl@0: /* sl@0: * Different notification types have different data associated with them. sl@0: * sl@0: * All types have the following data and are aligned in the buffer like so: sl@0: * Word1 : Size (TUint16 - upper 2 bytes) , NameLength (TUint16 - lower 2 bytes), sl@0: * Word2 : Type (TUint - 4 bytes) sl@0: * [not yet supported - Word3 : UID (TUint32 - 4 Bytes) ] sl@0: * sl@0: @internalTechnology sl@0: @released sl@0: */ sl@0: const TInt KNotificationHeaderSize = (sizeof(TUint16)*2)+(sizeof(TUint)); sl@0: // sl@0: //When UID is added: sl@0: //const TInt KNotificationHeaderSize = (sizeof(TUint16)*2)+(sizeof(TUint))+sizeof(TUint32); sl@0: sl@0: /* sl@0: * This is the minimum allowed size of the buffer set by the client that is sl@0: * equal to the size of a notification of maximum length and an overflow sl@0: * sl@0: @internalTechnology sl@0: @released sl@0: */ sl@0: const TInt KMinNotificationBufferSize = 2*KNotificationHeaderSize + 2*KMaxFileName; sl@0: sl@0: sl@0: sl@0: /** sl@0: * Fill any dead space at the end of the buffer with this sl@0: * If there is any dead space it should always be at least 1 word in size sl@0: * @internalTechnology sl@0: */ sl@0: const TUint KNotificationBufferFiller = 0xFFFFFFFF; sl@0: sl@0: class TFsNotification; //forward ref sl@0: sl@0: /* This class is used as the buffer in the file server notifier framework. sl@0: * sl@0: * The buffer itself is simply a descriptor. sl@0: * sl@0: * This class is internal because we may wish to change the sl@0: * buffer mechanism in the future without BC breaks etc. sl@0: * sl@0: * @internalTechnology sl@0: */ sl@0: class CFsNotificationList : public CBase sl@0: { sl@0: public: sl@0: static CFsNotificationList* NewL(TInt aBufferSize); sl@0: virtual ~CFsNotificationList(); sl@0: sl@0: private: sl@0: CFsNotificationList(); sl@0: const TFsNotification * NextNotification(); sl@0: TInt BufferSize() const; sl@0: sl@0: HBufC8* iBuf; //Heap based to allow buffer size spec at runtime sl@0: TInt iHead; //offset to the head of the readable data. sl@0: TInt iTail; //offset to end of the readable data. sl@0: sl@0: TPckg iTailPckg; //stores iTail, used in Asyc IPC sl@0: TPtr8 iBufferPtr; //stores iBuf->Ptr, used in Asyc IPC sl@0: friend class RFsNotify; sl@0: friend class CFsNotify; sl@0: }; sl@0: sl@0: /** sl@0: * @internalTechnology sl@0: */ sl@0: class RFsNotify : public RSubSessionBase sl@0: { sl@0: public: sl@0: TInt Open(RFs& aFs,CFsNotificationList* aBuffer, TRequestStatus& aBufferStatus); sl@0: void Close(); sl@0: sl@0: //[Re]Issues notification request sl@0: void RequestNotifications(TRequestStatus& aStatus, TPckg& aTailPckg); sl@0: TInt CancelNotifications(); sl@0: TInt AddNotification(TUint aNotificationType, const TDesC& aPath, const TDesC& aFilename); sl@0: TInt RemoveNotifications(); sl@0: }; sl@0: sl@0: /** sl@0: * @internalTechnology sl@0: * sl@0: * This class is the iBody of CFsNotify. It is being used to shield the client from the internals which are being stored here. sl@0: * sl@0: * @see CFsNotify sl@0: */ sl@0: class CFsNotifyBody : public CBase sl@0: { sl@0: public: sl@0: virtual ~CFsNotifyBody(); sl@0: private: sl@0: CFsNotifyBody(); sl@0: TRequestStatus iBufferStatus; //for server->buffer updates sl@0: TRequestStatus* iClientStatus; //Client's TRS:for receiving notification sl@0: CFsNotificationList* iBuffer; //Buffer into which the server puts the notifications sl@0: RFsNotify iFsNotify; sl@0: sl@0: friend class CFsNotify; sl@0: }; sl@0: #endif //__CLNOTIFICATION_H__ sl@0: