os/ossrv/genericopenlibs/openenvcore/backend/inc/systemspecialfilercg.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/backend/inc/systemspecialfilercg.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,168 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:  Helper class to deal with special system files.
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +
    1.23 +
    1.24 +#ifndef SYSTEM_SPECIAL_FILE_RCG_H
    1.25 +#define SYSTEM_SPECIAL_FILE_RCG_H
    1.26 +
    1.27 +// INCLUDES
    1.28 +#include <sys/cdefs.h>
    1.29 +#include <sys/types.h>
    1.30 +#include <wchar.h>
    1.31 +#include <e32cmn.h>
    1.32 +
    1.33 +#define KMaxEncDecBuf 9
    1.34 +
    1.35 +// DATA TYPES
    1.36 +
    1.37 +enum TSpecialFileType
    1.38 +    {
    1.39 +    EFileGeneralError = -1,
    1.40 +    EFileNotFound,
    1.41 +    EFileTypeGeneral, // not a system specific special file
    1.42 +    EFileTypeMkFifo, // temp file of mkfifo type
    1.43 +    EFileTypeSymLink, // symbolic link
    1.44 +    EFileTypeSocket,
    1.45 +    EFileTypeMax // no enums beyond this.
    1.46 +    };
    1.47 +
    1.48 +struct SSpecialFileMagicHeader {
    1.49 +   char iMagicBuffer[KMaxEncDecBuf];
    1.50 +   unsigned char iFileType;
    1.51 +};
    1.52 +
    1.53 +
    1.54 +/*
    1.55 + * Encode the system special file magic header.
    1.56 + * @param aEncBuf Encoded buffer
    1.57 + * @param aFileType Type of file
    1.58 + * @return 0 for success, else -1
    1.59 + */
    1.60 +int _EncodeSystemSplFileMagicHeader(
    1.61 +                    struct SSpecialFileMagicHeader *aEncBuf, 
    1.62 +                    TSpecialFileType aFileType);
    1.63 +                    
    1.64 +/*
    1.65 + * Try to retrieve file type from buffer.
    1.66 + * @param buf pointer to the contained buffer.
    1.67 + * @return File type. 
    1.68 + *      EFileTypeGeneral For normal file
    1.69 + *      EFileTypeMkFifo  For mkfifo
    1.70 + *      EFileTypeSymLink For Symbolic link.
    1.71 + */
    1.72 +TSpecialFileType _SystemSpecialFileBasedBuffer(const char *buf);
    1.73 +
    1.74 +/*
    1.75 + * Try to retrieve file type from file name (char*).
    1.76 + * @param aFullFileName pointer to the file name.
    1.77 + * @param anErrno Ref to the error no.
    1.78 + * @param aSession File server session.
    1.79 + * @return File type. 
    1.80 + *      EFileTypeGeneral For normal file
    1.81 + *      EFileTypeMkFifo  For mkfifo
    1.82 + *      EFileTypeSymLink For Symbolic link.
    1.83 + */
    1.84 +/*
    1.85 +TSpecialFileType _SystemSpecialFileBasedFilePath 
    1.86 +        (const char* aFullFileName, TInt& aErrno, RSessionBase& aSession);*/
    1.87 +
    1.88 +/*
    1.89 + * Try to retrieve file type from file name (wchar_t*).
    1.90 + * @param aPathName pointer to the file name.
    1.91 + * @param anErrno Ref to the error no. 
    1.92 + * @param aSession File server session.
    1.93 + * @return File type. 
    1.94 + *      EFileTypeGeneral For normal file
    1.95 + *      EFileTypeMkFifo  For mkfifo
    1.96 + *      EFileTypeSymLink For Symbolic link.
    1.97 + */
    1.98 +IMPORT_C TSpecialFileType _SystemSpecialFileBasedFilePath
    1.99 +        (const wchar_t* aPathName, TInt& aErrno, RSessionBase& aSession);
   1.100 +
   1.101 +/*
   1.102 + * Create a system file.
   1.103 + * @param aFullFileName pointer to the file name.
   1.104 + * @param aData Pointer to the data to be writen within the new file
   1.105 + * @param aLen Length of the data.
   1.106 + * @param anErrno Ref to the error no.
   1.107 + * @param aSession File server session.
   1.108 + * @return 0 for success, else -1
   1.109 + */
   1.110 +int _CreateSysSplFile(const wchar_t *aFullFileName, 
   1.111 +                    const char* aData, 
   1.112 +                    const int aLen,
   1.113 +                    int& anErrno,
   1.114 +                    RSessionBase& aSession);
   1.115 +
   1.116 +/*
   1.117 + * delete a system file.
   1.118 + * @param aFullFileName pointer to the file name.
   1.119 + * @param aSession File server session.
   1.120 + * @return 0 for success, else -1
   1.121 + */
   1.122 +/*
   1.123 +TInt _DeleteSystemSpecialFileBasedFilePath
   1.124 +        (const char* aFullFileName, RSessionBase& aSession);*/
   1.125 +
   1.126 +/*
   1.127 + * delete a system file. (Wide char)
   1.128 + * @param aFullFileName pointer to the file name.
   1.129 + * @param aSession File server session.
   1.130 + * @return 0 for success, else -1
   1.131 + */
   1.132 +TInt _DeleteSystemSpecialFileBasedFilePath
   1.133 +        (const wchar_t* aFullFileName, RSessionBase& aSession);
   1.134 +
   1.135 +/*
   1.136 + * Read a system file.
   1.137 + * @param aFullFileName pointer to the file name.
   1.138 + * @param aBuf Pointer to the buffer for read data
   1.139 + * @param aLen Length of the data.
   1.140 + * @param anErrno Ref to the error no.
   1.141 + * @param aSession File server session.
   1.142 + * @return number of bytes read on success, else -1
   1.143 + */
   1.144 +/*
   1.145 +IMPORT_C int _ReadSysSplFileL(const char *aFullFileName,
   1.146 +                    char* aBuf, 
   1.147 +                    const int aLen,
   1.148 +                    int& anErrno,
   1.149 +                    RSessionBase& aSession);*/
   1.150 +
   1.151 +/*
   1.152 + * Read a system file (wide char variant).
   1.153 + * @param aFullFileName pointer to the file name.
   1.154 + * @param aBuf Pointer to the buffer for read data
   1.155 + * @param aLen Length of the data.
   1.156 + * @param anErrno Ref to the error no.
   1.157 + * @param aSession File server session.
   1.158 + * @return number of bytes read on success, else -1
   1.159 + */
   1.160 +IMPORT_C int _ReadSysSplFile(const wchar_t *aFullFileName,
   1.161 +                    char* aBuf, 
   1.162 +                    const int aLen,
   1.163 +                    int& anErrno,
   1.164 +                    RSessionBase& aSession);
   1.165 +
   1.166 +
   1.167 +
   1.168 +#endif      // SYSTEM_SPECIAL_FILE_RCG_H
   1.169 +
   1.170 +// End of File
   1.171 +