sl@0: /* sl@0: * Copyright (c) 2005-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 "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: Helper class to deal with special system files. sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: sl@0: #ifndef SYSTEM_SPECIAL_FILE_RCG_H sl@0: #define SYSTEM_SPECIAL_FILE_RCG_H sl@0: sl@0: // INCLUDES sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #define KMaxEncDecBuf 9 sl@0: sl@0: // DATA TYPES sl@0: sl@0: enum TSpecialFileType sl@0: { sl@0: EFileGeneralError = -1, sl@0: EFileNotFound, sl@0: EFileTypeGeneral, // not a system specific special file sl@0: EFileTypeMkFifo, // temp file of mkfifo type sl@0: EFileTypeSymLink, // symbolic link sl@0: EFileTypeSocket, sl@0: EFileTypeMax // no enums beyond this. sl@0: }; sl@0: sl@0: struct SSpecialFileMagicHeader { sl@0: char iMagicBuffer[KMaxEncDecBuf]; sl@0: unsigned char iFileType; sl@0: }; sl@0: sl@0: sl@0: /* sl@0: * Encode the system special file magic header. sl@0: * @param aEncBuf Encoded buffer sl@0: * @param aFileType Type of file sl@0: * @return 0 for success, else -1 sl@0: */ sl@0: int _EncodeSystemSplFileMagicHeader( sl@0: struct SSpecialFileMagicHeader *aEncBuf, sl@0: TSpecialFileType aFileType); sl@0: sl@0: /* sl@0: * Try to retrieve file type from buffer. sl@0: * @param buf pointer to the contained buffer. sl@0: * @return File type. sl@0: * EFileTypeGeneral For normal file sl@0: * EFileTypeMkFifo For mkfifo sl@0: * EFileTypeSymLink For Symbolic link. sl@0: */ sl@0: TSpecialFileType _SystemSpecialFileBasedBuffer(const char *buf); sl@0: sl@0: /* sl@0: * Try to retrieve file type from file name (char*). sl@0: * @param aFullFileName pointer to the file name. sl@0: * @param anErrno Ref to the error no. sl@0: * @param aSession File server session. sl@0: * @return File type. sl@0: * EFileTypeGeneral For normal file sl@0: * EFileTypeMkFifo For mkfifo sl@0: * EFileTypeSymLink For Symbolic link. sl@0: */ sl@0: /* sl@0: TSpecialFileType _SystemSpecialFileBasedFilePath sl@0: (const char* aFullFileName, TInt& aErrno, RSessionBase& aSession);*/ sl@0: sl@0: /* sl@0: * Try to retrieve file type from file name (wchar_t*). sl@0: * @param aPathName pointer to the file name. sl@0: * @param anErrno Ref to the error no. sl@0: * @param aSession File server session. sl@0: * @return File type. sl@0: * EFileTypeGeneral For normal file sl@0: * EFileTypeMkFifo For mkfifo sl@0: * EFileTypeSymLink For Symbolic link. sl@0: */ sl@0: IMPORT_C TSpecialFileType _SystemSpecialFileBasedFilePath sl@0: (const wchar_t* aPathName, TInt& aErrno, RSessionBase& aSession); sl@0: sl@0: /* sl@0: * Create a system file. sl@0: * @param aFullFileName pointer to the file name. sl@0: * @param aData Pointer to the data to be writen within the new file sl@0: * @param aLen Length of the data. sl@0: * @param anErrno Ref to the error no. sl@0: * @param aSession File server session. sl@0: * @return 0 for success, else -1 sl@0: */ sl@0: int _CreateSysSplFile(const wchar_t *aFullFileName, sl@0: const char* aData, sl@0: const int aLen, sl@0: int& anErrno, sl@0: RSessionBase& aSession); sl@0: sl@0: /* sl@0: * delete a system file. sl@0: * @param aFullFileName pointer to the file name. sl@0: * @param aSession File server session. sl@0: * @return 0 for success, else -1 sl@0: */ sl@0: /* sl@0: TInt _DeleteSystemSpecialFileBasedFilePath sl@0: (const char* aFullFileName, RSessionBase& aSession);*/ sl@0: sl@0: /* sl@0: * delete a system file. (Wide char) sl@0: * @param aFullFileName pointer to the file name. sl@0: * @param aSession File server session. sl@0: * @return 0 for success, else -1 sl@0: */ sl@0: TInt _DeleteSystemSpecialFileBasedFilePath sl@0: (const wchar_t* aFullFileName, RSessionBase& aSession); sl@0: sl@0: /* sl@0: * Read a system file. sl@0: * @param aFullFileName pointer to the file name. sl@0: * @param aBuf Pointer to the buffer for read data sl@0: * @param aLen Length of the data. sl@0: * @param anErrno Ref to the error no. sl@0: * @param aSession File server session. sl@0: * @return number of bytes read on success, else -1 sl@0: */ sl@0: /* sl@0: IMPORT_C int _ReadSysSplFileL(const char *aFullFileName, sl@0: char* aBuf, sl@0: const int aLen, sl@0: int& anErrno, sl@0: RSessionBase& aSession);*/ sl@0: sl@0: /* sl@0: * Read a system file (wide char variant). sl@0: * @param aFullFileName pointer to the file name. sl@0: * @param aBuf Pointer to the buffer for read data sl@0: * @param aLen Length of the data. sl@0: * @param anErrno Ref to the error no. sl@0: * @param aSession File server session. sl@0: * @return number of bytes read on success, else -1 sl@0: */ sl@0: IMPORT_C int _ReadSysSplFile(const wchar_t *aFullFileName, sl@0: char* aBuf, sl@0: const int aLen, sl@0: int& anErrno, sl@0: RSessionBase& aSession); sl@0: sl@0: sl@0: sl@0: #endif // SYSTEM_SPECIAL_FILE_RCG_H sl@0: sl@0: // End of File sl@0: