os/kernelhwsrv/userlibandfileserver/fileserver/sfsrv/cl_notification.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description: 
sl@0
    14
// fileserver/sfsrv/clnotification.h
sl@0
    15
//
sl@0
    16
sl@0
    17
/**
sl@0
    18
 * @file
sl@0
    19
 * @internalTechnology
sl@0
    20
 * @released
sl@0
    21
 */
sl@0
    22
sl@0
    23
#ifndef __CLNOTIFICATION_H__
sl@0
    24
#define __CLNOTIFICATION_H__
sl@0
    25
sl@0
    26
#include "f32notification.h"
sl@0
    27
	
sl@0
    28
/* 
sl@0
    29
 * This comment is:
sl@0
    30
 * @internalTechnology
sl@0
    31
 * 
sl@0
    32
 * In general, the getter functions for TFsNotification extract data from a given buffer in the order:
sl@0
    33
 *  <Notification Size> <Path Length> <Type> <Path> [any sub-class members]
sl@0
    34
 * Notification of type EOverflow doesn't have a path associated with it
sl@0
    35
 * If a new name exists (ERename, EVolumeName and EDriveName) then the order is:
sl@0
    36
 *  <Notification Size> <Path Length> <New Name Length> <Type> <Path> <New Name>
sl@0
    37
 * For EAttribute the order is:
sl@0
    38
 *  <Notification Size> <Path Length> <Type> <Path> <Attribute>
sl@0
    39
 * For EFileChange the order is:
sl@0
    40
 *  <Notification Size> <Path Length> <Type> <Path> <File Size>
sl@0
    41
 */
sl@0
    42
sl@0
    43
/**
sl@0
    44
 * A Mask of all the valid filters that a client can set
sl@0
    45
 * @internalTechnology
sl@0
    46
 */
sl@0
    47
const TInt KNotificationValidFiltersMask = (TUint)(
sl@0
    48
		TFsNotification::EAttribute |
sl@0
    49
		TFsNotification::ECreate |
sl@0
    50
		TFsNotification::EDelete |
sl@0
    51
		TFsNotification::EDriveName | 
sl@0
    52
		TFsNotification::EFileChange |
sl@0
    53
		TFsNotification::EMediaChange |
sl@0
    54
		TFsNotification::ERename |
sl@0
    55
		TFsNotification::EVolumeName
sl@0
    56
		);
sl@0
    57
sl@0
    58
/*
sl@0
    59
 * Different notification types have different data associated with them.
sl@0
    60
 *  
sl@0
    61
 * All types have the following data and are aligned in the buffer like so:
sl@0
    62
 * Word1 : Size (TUint16 - upper 2 bytes) , NameLength (TUint16 - lower 2 bytes),
sl@0
    63
 * Word2 : Type (TUint - 4 bytes)
sl@0
    64
 * [not yet supported - Word3 : UID (TUint32 - 4 Bytes) ]
sl@0
    65
 * 
sl@0
    66
 @internalTechnology
sl@0
    67
 @released
sl@0
    68
 */
sl@0
    69
const TInt KNotificationHeaderSize = (sizeof(TUint16)*2)+(sizeof(TUint));
sl@0
    70
//
sl@0
    71
//When UID is added:
sl@0
    72
//const TInt KNotificationHeaderSize = (sizeof(TUint16)*2)+(sizeof(TUint))+sizeof(TUint32);
sl@0
    73
sl@0
    74
/*
sl@0
    75
 * This is the minimum allowed size of the buffer set by the client that is
sl@0
    76
 * equal to the size of a notification of maximum length and an overflow
sl@0
    77
 *
sl@0
    78
@internalTechnology
sl@0
    79
@released
sl@0
    80
*/
sl@0
    81
const TInt KMinNotificationBufferSize = 2*KNotificationHeaderSize + 2*KMaxFileName;
sl@0
    82
sl@0
    83
sl@0
    84
sl@0
    85
/**
sl@0
    86
 * Fill any dead space at the end of the buffer with this
sl@0
    87
 * If there is any dead space it should always be at least 1 word in size
sl@0
    88
 * @internalTechnology
sl@0
    89
 */
sl@0
    90
const TUint KNotificationBufferFiller = 0xFFFFFFFF;
sl@0
    91
sl@0
    92
class TFsNotification; //forward ref
sl@0
    93
sl@0
    94
/* This class is used as the buffer in the file server notifier framework.
sl@0
    95
 * 
sl@0
    96
 * The buffer itself is simply a descriptor.
sl@0
    97
 * 
sl@0
    98
 * This class is internal because we may wish to change the 
sl@0
    99
 * buffer mechanism in the future without BC breaks etc.
sl@0
   100
 * 
sl@0
   101
 * @internalTechnology
sl@0
   102
 */
sl@0
   103
class CFsNotificationList : public CBase
sl@0
   104
	{
sl@0
   105
public:
sl@0
   106
	static CFsNotificationList* NewL(TInt aBufferSize);
sl@0
   107
	virtual ~CFsNotificationList();
sl@0
   108
		
sl@0
   109
private:
sl@0
   110
	CFsNotificationList();
sl@0
   111
	const TFsNotification * NextNotification();
sl@0
   112
	TInt BufferSize() const;
sl@0
   113
sl@0
   114
	HBufC8* iBuf;			//Heap based to allow buffer size spec at runtime
sl@0
   115
	TInt iHead; 			//offset to the head of the readable data.
sl@0
   116
	TInt iTail;				//offset to end of the readable data.
sl@0
   117
sl@0
   118
	TPckg<TInt> iTailPckg;	//stores iTail, used in Asyc IPC
sl@0
   119
	TPtr8 iBufferPtr;		//stores iBuf->Ptr, used in Asyc IPC
sl@0
   120
	friend class RFsNotify;
sl@0
   121
	friend class CFsNotify;
sl@0
   122
	}; 
sl@0
   123
sl@0
   124
/**
sl@0
   125
 * @internalTechnology
sl@0
   126
 */
sl@0
   127
class RFsNotify : public RSubSessionBase
sl@0
   128
	{
sl@0
   129
	public:
sl@0
   130
		TInt Open(RFs& aFs,CFsNotificationList* aBuffer, TRequestStatus& aBufferStatus);
sl@0
   131
		void Close();
sl@0
   132
sl@0
   133
		//[Re]Issues notification request
sl@0
   134
		void RequestNotifications(TRequestStatus& aStatus, TPckg<TInt>& aTailPckg);
sl@0
   135
		TInt CancelNotifications();
sl@0
   136
		TInt AddNotification(TUint aNotificationType, const TDesC& aPath,  const TDesC& aFilename);
sl@0
   137
		TInt RemoveNotifications();
sl@0
   138
	}; 
sl@0
   139
sl@0
   140
/**
sl@0
   141
 * @internalTechnology
sl@0
   142
 *
sl@0
   143
 * 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
   144
 *
sl@0
   145
 * @see CFsNotify
sl@0
   146
 */
sl@0
   147
class CFsNotifyBody : public CBase
sl@0
   148
	{
sl@0
   149
public:
sl@0
   150
	virtual ~CFsNotifyBody();
sl@0
   151
private:
sl@0
   152
	CFsNotifyBody();
sl@0
   153
	TRequestStatus iBufferStatus;	//for server->buffer updates
sl@0
   154
	TRequestStatus* iClientStatus;	//Client's TRS:for receiving notification
sl@0
   155
	CFsNotificationList* iBuffer;	//Buffer into which the server puts the notifications
sl@0
   156
	RFsNotify iFsNotify;
sl@0
   157
	
sl@0
   158
	friend class CFsNotify;
sl@0
   159
	};
sl@0
   160
#endif //__CLNOTIFICATION_H__
sl@0
   161