userlibandfileserver/fileserver/inc/elocal.h
changeset 0 a41df078684a
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 // f32\inc\elocal.h
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file f32\inc\elocal.h
       
    20  @internalTechnology
       
    21 */
       
    22 
       
    23 #if !defined(__ELOCAL_H__)
       
    24 #define __ELOCAL_H__
       
    25 
       
    26 #include "common.h"
       
    27 #include <f32file.h>
       
    28 #include <f32fsys.h>
       
    29 #include <f32ver.h>
       
    30 
       
    31 #include <e32wins.h>
       
    32 
       
    33 #define WIN32_LEAN_AND_MEAN
       
    34 #pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union
       
    35 #include <windows.h>
       
    36 #pragma warning( default : 4201 ) // nonstandard extension used : nameless struct/union
       
    37 
       
    38 /**
       
    39 @internalTechnology
       
    40 @released
       
    41 */
       
    42 enum TPanic
       
    43 	{
       
    44 	EFileTimeToSystemTime,
       
    45 	EFileClose,
       
    46 	EFileCloseSetAttributes,
       
    47 	EDirClose,
       
    48 	EMapCouldNotConnect
       
    49 	};
       
    50 
       
    51 
       
    52 /**
       
    53 @internalTechnology
       
    54 @released
       
    55 */
       
    56 class CLocalMountCB : public CMountCB, 
       
    57 					  public CMountCB::MFileExtendedInterface
       
    58 	{
       
    59 public:
       
    60 	CLocalMountCB();
       
    61 	~CLocalMountCB();
       
    62 	void MountL(TBool aForceMount);
       
    63 	TInt ReMount();
       
    64 	void Dismounted();
       
    65 	void VolumeL(TVolumeInfo& aVolume) const;
       
    66 	void SetVolumeL(TDes& aName);
       
    67 	void MkDirL(const TDesC& aName);
       
    68 	void RmDirL(const TDesC& aName);
       
    69 	void DeleteL(const TDesC& aName);
       
    70 	void RenameL(const TDesC& anOldName,const TDesC& anNewName);
       
    71 	void ReplaceL(const TDesC& anOldName,const TDesC& anNewName);
       
    72 	void EntryL(const TDesC& aName,TEntry& anEntry) const;
       
    73 	void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
       
    74 	void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile);
       
    75 	void DirOpenL(const TDesC& aName,CDirCB* aDir);
       
    76 	void RawReadL(TInt64 aPos,TInt aLength,const TAny* aDes,TInt anOffset,const RMessagePtr2& aMessage) const;
       
    77 	void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aDes,TInt anOffset,const RMessagePtr2& aMessage);
       
    78 	void ReadUidL(const TDesC& aName,TEntry& anEntry) const;
       
    79 	void GetShortNameL(const TDesC& aLongName,TDes& aShortName);
       
    80 	void GetLongNameL(const TDesC& aShortName,TDes& aLongName);
       
    81 	void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
       
    82 	void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength, const RMessagePtr2& aMessage);
       
    83 	TInt LocalBufferSupport();
       
    84     TInt MountControl(TInt aLevel, TInt aOption, TAny* aParam);
       
    85     
       
    86     // interface extension implementation
       
    87 	virtual void ReadSection64L(const TDesC& aName, TInt64 aPos, TAny* aTrg, TInt aLength, const RMessagePtr2& aMessage);
       
    88 
       
    89 
       
    90     inline TUint64 MaxFileSizeSupported() const {return iMaxFileSizeSupported;}
       
    91 
       
    92 protected:
       
    93 	virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
       
    94 private:
       
    95 	TBool IsRomDrive() const;
       
    96 
       
    97 
       
    98 
       
    99 private:
       
   100 
       
   101     TUint64 iMaxFileSizeSupported;  ///< Max. file size supported by HOST filesystem (4G-1 for FAT, 17,592,185,978,880 bytes for NTFS)
       
   102 
       
   103 	};
       
   104 
       
   105 /**
       
   106 @internalTechnology
       
   107 @released
       
   108 */
       
   109 class CLocalFileCB : public CFileCB, public CFileCB::MExtendedFileInterface
       
   110 	{
       
   111 public:
       
   112 	CLocalFileCB();
       
   113 	~CLocalFileCB();
       
   114 	void RenameL(const TDesC& aNewName);
       
   115 	void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
       
   116 	void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
       
   117 	TInt Address(TInt& aPos) const;
       
   118 	void SetSizeL(TInt aSize);
       
   119 	void SetEntryL(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
       
   120 	void FlushDataL();
       
   121 	void FlushAllL();
       
   122 	inline void SetHandle(HANDLE aHandle) {iWinHandle=aHandle;}
       
   123 	void CheckPosL(TInt64 aPos);
       
   124 	static TInt RomAddress(const TDesC& aName, HANDLE aFile, TUint8*& aAddr);
       
   125 	
       
   126 	// from CFileCB::MExtendedFileInterface
       
   127 	virtual void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset);
       
   128 	virtual void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset);
       
   129 	virtual void SetSizeL(TInt64 aSize);
       
   130 
       
   131 protected:
       
   132 	// from CFileCB
       
   133 	virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
       
   134 
       
   135 private:
       
   136 	TBool IsRomDrive() const;
       
   137     inline CLocalMountCB& LocalMount() const {return((CLocalMountCB&)Mount());}
       
   138 
       
   139 private:
       
   140 	TInt64 iCurrentPos;
       
   141 	TUint8* iFilePtr;
       
   142 	HANDLE iWinHandle;
       
   143 	};
       
   144 
       
   145 /**
       
   146 @internalTechnology
       
   147 @released
       
   148 */
       
   149 class CLocalDirCB : public CDirCB
       
   150 	{
       
   151 public:
       
   152 	CLocalDirCB();
       
   153 	~CLocalDirCB();
       
   154 	void ReadL(TEntry& anEntry);
       
   155 	inline void SetHandle(HANDLE aHandle) {iWinHandle=aHandle;}
       
   156 	inline void SetFullName(const TDesC& aName) {iFullName.Set(aName,NULL,NULL);}
       
   157 private:
       
   158 	TBool MatchUid();
       
   159 public:
       
   160 	TEntry iEntry;
       
   161 private:
       
   162 	HANDLE iWinHandle;
       
   163 	TParse iFullName;
       
   164 	};
       
   165 
       
   166 /**
       
   167 @internalTechnology
       
   168 @released
       
   169 */
       
   170 class CLocalFormatCB : public CFormatCB
       
   171 	{
       
   172 public:
       
   173 	CLocalFormatCB();
       
   174 	~CLocalFormatCB();
       
   175 public:
       
   176 	virtual void DoFormatStepL();
       
   177 	};
       
   178 
       
   179 /**
       
   180 @internalTechnology
       
   181 @released
       
   182 */
       
   183 class CLocal : public CFileSystem
       
   184 	{
       
   185 public:
       
   186 	CLocal();
       
   187 	TInt Install();
       
   188 	CMountCB* NewMountL() const;
       
   189 	CFileCB* NewFileL() const;
       
   190 	CDirCB* NewDirL() const;
       
   191 	CFormatCB* NewFormatL() const;
       
   192 	TInt DefaultPath(TDes& aPath) const;
       
   193 	void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const;
       
   194 	};
       
   195 
       
   196 
       
   197 #endif
       
   198 
       
   199