userlibandfileserver/fileserver/inc/F32plugin.h
changeset 36 538db54a451d
parent 0 a41df078684a
child 243 c7a0ce20c48c
equal deleted inserted replaced
34:f497542af8e4 36:538db54a451d
    35 const TInt KPluginMessageComplete = 2; ///< Returned from ::Dispatch() to indicate that a request has been processed synchronously and should be passed back up the stack.
    35 const TInt KPluginMessageComplete = 2; ///< Returned from ::Dispatch() to indicate that a request has been processed synchronously and should be passed back up the stack.
    36 
    36 
    37 const TInt KCountNeeded=KMinTInt;
    37 const TInt KCountNeeded=KMinTInt;
    38 
    38 
    39 /**
    39 /**
    40 List of file server operations 
    40 List of file server operations
    41 */
    41 */
    42 enum TFsMessage
    42 enum TFsMessage
    43 	{
    43 	{
    44 	EFsAddFileSystem,           ///< Adds a file system
    44 	EFsAddFileSystem,           ///< Adds a file system
    45 	EFsRemoveFileSystem,        ///< Removes a file system
    45 	EFsRemoveFileSystem,        ///< Removes a file system
    68 	EFsGetDriveName,            ///<  Gets the name of a drive
    68 	EFsGetDriveName,            ///<  Gets the name of a drive
    69 	EFsSetDriveName,            ///< Sets the name of a drive
    69 	EFsSetDriveName,            ///< Sets the name of a drive
    70 	EFsFormatSubClose,          ///< Closes the Format subsession
    70 	EFsFormatSubClose,          ///< Closes the Format subsession
    71 	EFsDirSubClose,             ///< Closes the directory.
    71 	EFsDirSubClose,             ///< Closes the directory.
    72 	EFsFileSubClose,            ///< Closes the file
    72 	EFsFileSubClose,            ///< Closes the file
    73 	EFsRawSubClose,             ///< Closes the direct access channel to the disk 
    73 	EFsRawSubClose,             ///< Closes the direct access channel to the disk
    74 	EFsFileOpen,				///< -- 30 Opens file
    74 	EFsFileOpen,				///< -- 30 Opens file
    75 	EFsFileCreate,				///< Creates and opens a new file
    75 	EFsFileCreate,				///< Creates and opens a new file
    76 	EFsFileReplace,             ///< Replaces a file of the same name or creates a new file
    76 	EFsFileReplace,             ///< Replaces a file of the same name or creates a new file
    77 	EFsFileTemp,				///< Creates and opens a temporary file
    77 	EFsFileTemp,				///< Creates and opens a temporary file
    78 	EFsFileRead,                ///< Reads from the file
    78 	EFsFileRead,                ///< Reads from the file
   140 	EFsFileDuplicate,           ///< Makes a duplicate of this file handle
   140 	EFsFileDuplicate,           ///< Makes a duplicate of this file handle
   141 	EFsFileAdopt,               ///< Adopts an already open file
   141 	EFsFileAdopt,               ///< Adopts an already open file
   142 	EFsSwapFileSystem,          ///< Swaps file systems
   142 	EFsSwapFileSystem,          ///< Swaps file systems
   143 	EFsErasePassword,           ///< Erase the password from the locked MultiMedia card
   143 	EFsErasePassword,           ///< Erase the password from the locked MultiMedia card
   144 	EFsReserveDriveSpace,		///< -- 100 Reserves an area of a drive
   144 	EFsReserveDriveSpace,		///< -- 100 Reserves an area of a drive
   145 	EFsGetReserveAccess,        ///< Get exclusive access to reserved area 
   145 	EFsGetReserveAccess,        ///< Get exclusive access to reserved area
   146 	EFsReleaseReserveAccess,    ///< Release exclusive access to reserved area
   146 	EFsReleaseReserveAccess,    ///< Release exclusive access to reserved area
   147 	EFsFileName,                ///< Gets the final part of a filename
   147 	EFsFileName,                ///< Gets the final part of a filename
   148     EFsGetMediaSerialNumber,    ///<  Gets the serial number of media
   148     EFsGetMediaSerialNumber,    ///<  Gets the serial number of media
   149 	EFsFileFullName,            ///< Gets the full filename
   149 	EFsFileFullName,            ///< Gets the full filename
   150 	EFsAddPlugin,               ///< Adds the specified plugin
   150 	EFsAddPlugin,               ///< Adds the specified plugin
   151 	EFsRemovePlugin,            ///< Removes the specified plugin
   151 	EFsRemovePlugin,            ///< Removes the specified plugin
   152 	EFsMountPlugin,			    ///< Mounts the specified plugin
   152 	EFsMountPlugin,			    ///< Mounts the specified plugin
   153 	EFsDismountPlugin,	        ///< Dismounts the specified plugin
   153 	EFsDismountPlugin,	        ///< Dismounts the specified plugin
   154 	EFsPluginName,				///<-- 110 Gets a plugin's name in specific position and drive 
   154 	EFsPluginName,				///<-- 110 Gets a plugin's name in specific position and drive
   155 	EFsPluginOpen,              ///< Opens the plugin
   155 	EFsPluginOpen,              ///< Opens the plugin
   156 	EFsPluginSubClose,          ///< Closes the plugin
   156 	EFsPluginSubClose,          ///< Closes the plugin
   157 	EFsPluginDoRequest,         ///< Issues an asynchronous plugin request
   157 	EFsPluginDoRequest,         ///< Issues an asynchronous plugin request
   158 	EFsPluginDoControl,         ///< Issues a synchronous plugin request
   158 	EFsPluginDoControl,         ///< Issues a synchronous plugin request
   159 	EFsPluginDoCancel,          ///< Cancels an synchronous plugin request
   159 	EFsPluginDoCancel,          ///< Cancels an synchronous plugin request
   176 	EFsRemoveProxyDrive,		///< Unloads a proxy drive
   176 	EFsRemoveProxyDrive,		///< Unloads a proxy drive
   177 	EFsMountProxyDrive,			///< Mounts a proxy drive
   177 	EFsMountProxyDrive,			///< Mounts a proxy drive
   178 	EFsDismountProxyDrive,		///< Dismounts a proxy drive
   178 	EFsDismountProxyDrive,		///< Dismounts a proxy drive
   179 	EFsNotificationOpen,		///< Opens the notification
   179 	EFsNotificationOpen,		///< Opens the notification
   180 	EFsNotificationBuffer,		///< Communicates buffer to file server
   180 	EFsNotificationBuffer,		///< Communicates buffer to file server
   181 	EFsNotificationRequest,		///< Sends the notification request 
   181 	EFsNotificationRequest,		///< Sends the notification request
   182 	EFsNotificationCancel,		///< Cancels the notification request 
   182 	EFsNotificationCancel,		///< Cancels the notification request
   183 	EFsNotificationSubClose,	///< -- 140 Closes the notification 
   183 	EFsNotificationSubClose,	///< Closes the notification
   184 	EFsNotificationAdd,			///< Adds filter to the server, comprising a path and notification type
   184 	EFsNotificationAdd,			///< -- 140 Adds filter to the server, comprising a path and notification type
   185 	EFsNotificationRemove,		///< Removes filters from Server-Side
   185 	EFsNotificationRemove,		///< Removes filters from Server-Side
   186 	EFsLoadCodePage,			///< Loads a code page library
   186 	EFsLoadCodePage,			///< Loads a code page library
   187 	EMaxClientOperations		///< This must always be the last operation insert above
   187 	EMaxClientOperations		///< This must always be the last operation insert above
   188 	};
   188 	};
   189 
   189 
   190 class CFsRequest;
   190 class CFsRequest;
   191 
   191 
   192 /**
   192 /**
   193 Request wrapper for plugins 
   193 Request wrapper for plugins
   194 */
   194 */
   195 class TFsPluginRequest
   195 class TFsPluginRequest
   196 	{
   196 	{
   197 public:
   197 public:
   198 	
   198 	
   219 		EAtt,
   219 		EAtt,
   220 		EAttMask,
   220 		EAttMask,
   221 		EUid,
   221 		EUid,
   222 		EEntryArray,
   222 		EEntryArray,
   223 		ENewPosition,
   223 		ENewPosition,
       
   224 		EVolumeInfo
   224 		};
   225 		};
   225 	
   226 	
   226 	IMPORT_C TFsPluginRequest(CFsRequest* aRequest);
   227 	IMPORT_C TFsPluginRequest(CFsRequest* aRequest);
   227 	
   228 	
   228 	/**
   229 	/**
   372 	IMPORT_C virtual TInt Remove();
   373 	IMPORT_C virtual TInt Remove();
   373 	IMPORT_C void SetLibrary(RLibrary aLib);
   374 	IMPORT_C void SetLibrary(RLibrary aLib);
   374 	IMPORT_C RLibrary Library() const;
   375 	IMPORT_C RLibrary Library() const;
   375 public:
   376 public:
   376 	/**
   377 	/**
   377 	@internalTechnology 
   378 	@internalTechnology
   378 	Installs the plugin factory 
   379 	Installs the plugin factory
   379 	@return KErrNone or one of the system wide errors
   380 	@return KErrNone or one of the system wide errors
   380 	*/
   381 	*/
   381 	virtual TInt Install()=0;
   382 	virtual TInt Install()=0;
   382 	/** 
   383 	/**
   383 	@internalTechnology
   384 	@internalTechnology
   384 	Creates a new plugin 
   385 	Creates a new plugin
   385 	@return plugin object
   386 	@return plugin object
   386 	*/
   387 	*/
   387 	virtual CFsPlugin* NewPluginL()=0;
   388 	virtual CFsPlugin* NewPluginL()=0;
   388 	/**	
   389 	/**
   389 	@internalTechnology
   390 	@internalTechnology
   390 	Returns unique position of the plugin
   391 	Returns unique position of the plugin
   391 	@return unique position of the plugin
   392 	@return unique position of the plugin
   392 	*/
   393 	*/
   393 	virtual TInt UniquePosition()=0;
   394 	virtual TInt UniquePosition()=0;
   428 	inline TInt Drive();
   429 	inline TInt Drive();
   429 	inline void SetDrive(TInt aDrive);
   430 	inline void SetDrive(TInt aDrive);
   430 	inline virtual TInt SessionDisconnect(CSessionFs* aSession);
   431 	inline virtual TInt SessionDisconnect(CSessionFs* aSession);
   431 protected:
   432 protected:
   432 	IMPORT_C virtual void InitialiseL();
   433 	IMPORT_C virtual void InitialiseL();
   433 	IMPORT_C virtual TInt Deliver(TFsPluginRequest& aRequest);	
   434 	IMPORT_C virtual TInt Deliver(TFsPluginRequest& aRequest);
   434 	virtual TInt DoRequestL(TFsPluginRequest& aRequest) = 0;
   435 	virtual TInt DoRequestL(TFsPluginRequest& aRequest) = 0;
   435 	
   436 	
   436 	IMPORT_C virtual CFsPluginConn* NewPluginConnL();
   437 	IMPORT_C virtual CFsPluginConn* NewPluginConnL();
   437 
   438 
   438 	IMPORT_C TInt RegisterIntercept(TInt aMessage, TInterceptAtts aInterceptAtts);
   439 	IMPORT_C TInt RegisterIntercept(TInt aMessage, TInterceptAtts aInterceptAtts);
   464 
   465 
   465 	/**
   466 	/**
   466 	The remaining space in this base class in release 9.1 is defined as follows:
   467 	The remaining space in this base class in release 9.1 is defined as follows:
   467 		TUint8 iRegisteredIntercepts[EMaxClientOperations << 1];	244 bytes
   468 		TUint8 iRegisteredIntercepts[EMaxClientOperations << 1];	244 bytes
   468 		TInt iUniquePos;											  4 bytes
   469 		TInt iUniquePos;											  4 bytes
   469 															TOTAL	248 bytes 
   470 															TOTAL	248 bytes
   470 	where EMaxClientOperations = 122.
   471 	where EMaxClientOperations = 122.
   471 
   472 
   472 	Unfortunately, the remaining space in release 9.2+ WAS defined as follows:
   473 	Unfortunately, the remaining space in release 9.2+ WAS defined as follows:
   473 	    enum {KIntcArrSize = 123*2};
   474 	    enum {KIntcArrSize = 123*2};
   474 	    TUint8  iRegisteredIntercepts[KIntcArrSize];				246 bytes
   475 	    TUint8  iRegisteredIntercepts[KIntcArrSize];				246 bytes
   475 																	  2 bytes (padding)
   476 																	  2 bytes (padding)
   476 		TInt iUniquePos;											  4 bytes
   477 		TInt iUniquePos;											  4 bytes
   477 															TOTAL:	252 bytes
   478 															TOTAL:	252 bytes
   478   
   479 
   479 	This meant that a 9.1-compiled plugin running on 9.2+ would have it's first data 
   480 	This meant that a 9.1-compiled plugin running on 9.2+ would have its first data
   480 	member overwritten when the base class (CFsPlugin) wrote to iUniquePos.
   481 	member overwritten when the base class (CFsPlugin) wrote to iUniquePos.
   481 
   482 
   482 	To maintain Binary Compatibility (BC), we need to preserve both the (smaller) 9.1 
   483 	To maintain Binary Compatibility (BC), we need to preserve both the (smaller) 9.1
   483 	and (larger) 9.2+ class sizes. 
   484 	and (larger) 9.2+ class sizes.
   484 	To allow 9.1 plugins to work unchanged on 9.2+ iUniquePos has been moved to BEFORE
   485 	To allow 9.1 plugins to work unchanged on 9.2+ iUniquePos has been moved to BEFORE
   485 	the iRegisteredIntercepts byte array
   486 	the iRegisteredIntercepts byte array
   486 
   487 
   487 	N.B. - the iRegisteredIntercepts array uses only 2 bits per function, so the 
   488 	N.B. - the iRegisteredIntercepts array uses only 2 bits per function, so the
   488 	array size only needs to be >= EMaxClientOperations/4. 
   489 	array size only needs to be >= EMaxClientOperations/4.
   489 	*/
   490 	*/
   490     enum {KIntcArrSize = 132};
   491     enum {KIntcArrSize = 132};
   491 	TInt iUniquePos;									//			  4 bytes
   492 	TInt iUniquePos;									//			  4 bytes
   492     TUint8 iRegisteredIntercepts[KIntcArrSize];			//			132 bytes
   493     TUint8 iRegisteredIntercepts[KIntcArrSize];			//			132 bytes
   493 	TInt iLastError;									//            4 bytes
   494 	TInt iLastError;									//            4 bytes
   525 	TFsPluginRequest* iRequest;
   526 	TFsPluginRequest* iRequest;
   526 	TUint iSpare[4];
   527 	TUint iSpare[4];
   527 	};
   528 	};
   528 
   529 
   529 /**
   530 /**
       
   531 A class for making file server request internally from within a
       
   532 file server plugin.
       
   533 
       
   534 See also RFilePlugin and RDirPlugin.
       
   535 
   530 @publishedPartner
   536 @publishedPartner
   531 @released
   537 @released
   532 */
   538 */
   533 class RFsPlugin : private RFs
   539 class RFsPlugin : private RFs
   534    {
   540    {
   543 	IMPORT_C TInt Rename(const TDesC& anOldName,const TDesC& aNewName);
   549 	IMPORT_C TInt Rename(const TDesC& anOldName,const TDesC& aNewName);
   544 	IMPORT_C TInt Replace(const TDesC& anOldName,const TDesC& aNewName);
   550 	IMPORT_C TInt Replace(const TDesC& anOldName,const TDesC& aNewName);
   545 	IMPORT_C TInt Entry(const TDesC& aName,TEntry& anEntry) const;
   551 	IMPORT_C TInt Entry(const TDesC& aName,TEntry& anEntry) const;
   546 	IMPORT_C TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
   552 	IMPORT_C TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
   547 	IMPORT_C TInt ReadFileSection(const TDesC& aName,TInt64 aPos,TDes8& aDes,TInt aLength) const;
   553 	IMPORT_C TInt ReadFileSection(const TDesC& aName,TInt64 aPos,TDes8& aDes,TInt aLength) const;
       
   554 	IMPORT_C TInt Volume(TVolumeInfo &aVol,TInt aDrive=KDefaultDrive) const;
   548 
   555 
   549 protected:
   556 protected:
   550 	TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const;
   557 	TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const;
   551 
   558 
   552 private:
   559 private:
   577     // open a NEW file using same session as passed request
   584     // open a NEW file using same session as passed request
   578 	IMPORT_C TInt Open(const TDesC& aName,TUint aMode);
   585 	IMPORT_C TInt Open(const TDesC& aName,TUint aMode);
   579 	IMPORT_C TInt Create(const TDesC& aName,TUint aFileMode);
   586 	IMPORT_C TInt Create(const TDesC& aName,TUint aFileMode);
   580     IMPORT_C TInt Replace(const TDesC& aName,TUint aFileMode);
   587     IMPORT_C TInt Replace(const TDesC& aName,TUint aFileMode);
   581     IMPORT_C TInt Temp(const TDesC& aPath,TFileName& aName,TUint aFileMode);
   588     IMPORT_C TInt Temp(const TDesC& aPath,TFileName& aName,TUint aFileMode);
   582        
   589 
   583     // re-open SAME file as client's request
   590     // re-open SAME file as client's request
   584     IMPORT_C TInt AdoptFromClient();
   591     IMPORT_C TInt AdoptFromClient();
   585 
   592 
   586     // Transfer the plugin's open file to the client
   593     // Transfer the plugin's open file to the client
   587 	IMPORT_C TInt TransferToClient();
   594 	IMPORT_C TInt TransferToClient();
   588 	
   595 
   589 	IMPORT_C void Close();
   596 	IMPORT_C void Close();
   590 
   597 
   591     // RFile overloads
   598     // RFile overloads
   592     IMPORT_C TInt Read(TInt64 aPos,TDes8& aDes) const;
   599     IMPORT_C TInt Read(TInt64 aPos,TDes8& aDes) const;
   593 	IMPORT_C TInt Read(TInt64 aPos,TDes8& aDes,TInt aLength) const;
   600 	IMPORT_C TInt Read(TInt64 aPos,TDes8& aDes,TInt aLength) const;
   688 	void DoRequest();
   695 	void DoRequest();
   689 	inline void Complete(TInt aError);
   696 	inline void Complete(TInt aError);
   690 public:
   697 public:
   691 	TInt InitControl(CFsRequest* aRequest);
   698 	TInt InitControl(CFsRequest* aRequest);
   692 	TInt InitRequest(CFsRequest* aRequest);
   699 	TInt InitRequest(CFsRequest* aRequest);
   693 private:	
   700 private:
   694 	TDblQueLink iLink;
   701 	TDblQueLink iLink;
   695 	CFsPluginConn& iPluginConn;
   702 	CFsPluginConn& iPluginConn;
   696 	TInt iFunction;
   703 	TInt iFunction;
   697 	TDes8* iParam1;
   704 	TDes8* iParam1;
   698 	TDes8* iParam2;
   705 	TDes8* iParam2;