userlibandfileserver/fileserver/sfsrv/cl_notification.h
changeset 0 a41df078684a
child 299 b5a01337d018
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description: 
       
    14 // fileserver/sfsrv/clnotification.h
       
    15 //
       
    16 
       
    17 /**
       
    18  * @file
       
    19  * @internalTechnology
       
    20  * @released
       
    21  */
       
    22 
       
    23 #ifndef __CLNOTIFICATION_H__
       
    24 #define __CLNOTIFICATION_H__
       
    25 
       
    26 #include "f32notification.h"
       
    27 	
       
    28 /* 
       
    29  * This comment is:
       
    30  * @internalTechnology
       
    31  * 
       
    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>
       
    41  */
       
    42 
       
    43 /**
       
    44  * A Mask of all the valid filters that a client can set
       
    45  * @internalTechnology
       
    46  */
       
    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
       
    56 		);
       
    57 
       
    58 /*
       
    59  * Different notification types have different data associated with them.
       
    60  *  
       
    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) ]
       
    65  * 
       
    66  @internalTechnology
       
    67  @released
       
    68  */
       
    69 const TInt KNotificationHeaderSize = (sizeof(TUint16)*2)+(sizeof(TUint));
       
    70 //
       
    71 //When UID is added:
       
    72 //const TInt KNotificationHeaderSize = (sizeof(TUint16)*2)+(sizeof(TUint))+sizeof(TUint32);
       
    73 
       
    74 /*
       
    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
       
    77  *
       
    78 @internalTechnology
       
    79 @released
       
    80 */
       
    81 const TInt KMinNotificationBufferSize = 2*KNotificationHeaderSize + 2*KMaxFileName;
       
    82 
       
    83 
       
    84 
       
    85 /**
       
    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
       
    88  * @internalTechnology
       
    89  */
       
    90 const TUint KNotificationBufferFiller = 0xFFFFFFFF;
       
    91 
       
    92 class TFsNotification; //forward ref
       
    93 
       
    94 /* This class is used as the buffer in the file server notifier framework.
       
    95  * 
       
    96  * The buffer itself is simply a descriptor.
       
    97  * 
       
    98  * This class is internal because we may wish to change the 
       
    99  * buffer mechanism in the future without BC breaks etc.
       
   100  * 
       
   101  * @internalTechnology
       
   102  */
       
   103 class CFsNotificationList : public CBase
       
   104 	{
       
   105 public:
       
   106 	static CFsNotificationList* NewL(TInt aBufferSize);
       
   107 	virtual ~CFsNotificationList();
       
   108 		
       
   109 private:
       
   110 	CFsNotificationList();
       
   111 	const TFsNotification * NextNotification();
       
   112 	TInt BufferSize() const;
       
   113 
       
   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.
       
   117 
       
   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;
       
   122 	}; 
       
   123 
       
   124 /**
       
   125  * @internalTechnology
       
   126  */
       
   127 class RFsNotify : public RSubSessionBase
       
   128 	{
       
   129 	public:
       
   130 		TInt Open(RFs& aFs,CFsNotificationList* aBuffer, TRequestStatus& aBufferStatus);
       
   131 		void Close();
       
   132 
       
   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();
       
   138 	}; 
       
   139 
       
   140 /**
       
   141  * @internalTechnology
       
   142  *
       
   143  * This class is the iBody of CFsNotify. It is being used to shield the client from the internals which are being stored here.
       
   144  *
       
   145  * @see CFsNotify
       
   146  */
       
   147 class CFsNotifyBody : public CBase
       
   148 	{
       
   149 public:
       
   150 	virtual ~CFsNotifyBody();
       
   151 private:
       
   152 	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
       
   156 	RFsNotify iFsNotify;
       
   157 	
       
   158 	friend class CFsNotify;
       
   159 	};
       
   160 #endif //__CLNOTIFICATION_H__
       
   161