os/ossrv/genericopenlibs/openenvcore/backend/inc/systemspecialfilercg.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.
     1 /*
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:  Helper class to deal with special system files.
    15 *
    16 */
    17 
    18 
    19 
    20 
    21 #ifndef SYSTEM_SPECIAL_FILE_RCG_H
    22 #define SYSTEM_SPECIAL_FILE_RCG_H
    23 
    24 // INCLUDES
    25 #include <sys/cdefs.h>
    26 #include <sys/types.h>
    27 #include <wchar.h>
    28 #include <e32cmn.h>
    29 
    30 #define KMaxEncDecBuf 9
    31 
    32 // DATA TYPES
    33 
    34 enum TSpecialFileType
    35     {
    36     EFileGeneralError = -1,
    37     EFileNotFound,
    38     EFileTypeGeneral, // not a system specific special file
    39     EFileTypeMkFifo, // temp file of mkfifo type
    40     EFileTypeSymLink, // symbolic link
    41     EFileTypeSocket,
    42     EFileTypeMax // no enums beyond this.
    43     };
    44 
    45 struct SSpecialFileMagicHeader {
    46    char iMagicBuffer[KMaxEncDecBuf];
    47    unsigned char iFileType;
    48 };
    49 
    50 
    51 /*
    52  * Encode the system special file magic header.
    53  * @param aEncBuf Encoded buffer
    54  * @param aFileType Type of file
    55  * @return 0 for success, else -1
    56  */
    57 int _EncodeSystemSplFileMagicHeader(
    58                     struct SSpecialFileMagicHeader *aEncBuf, 
    59                     TSpecialFileType aFileType);
    60                     
    61 /*
    62  * Try to retrieve file type from buffer.
    63  * @param buf pointer to the contained buffer.
    64  * @return File type. 
    65  *      EFileTypeGeneral For normal file
    66  *      EFileTypeMkFifo  For mkfifo
    67  *      EFileTypeSymLink For Symbolic link.
    68  */
    69 TSpecialFileType _SystemSpecialFileBasedBuffer(const char *buf);
    70 
    71 /*
    72  * Try to retrieve file type from file name (char*).
    73  * @param aFullFileName pointer to the file name.
    74  * @param anErrno Ref to the error no.
    75  * @param aSession File server session.
    76  * @return File type. 
    77  *      EFileTypeGeneral For normal file
    78  *      EFileTypeMkFifo  For mkfifo
    79  *      EFileTypeSymLink For Symbolic link.
    80  */
    81 /*
    82 TSpecialFileType _SystemSpecialFileBasedFilePath 
    83         (const char* aFullFileName, TInt& aErrno, RSessionBase& aSession);*/
    84 
    85 /*
    86  * Try to retrieve file type from file name (wchar_t*).
    87  * @param aPathName pointer to the file name.
    88  * @param anErrno Ref to the error no. 
    89  * @param aSession File server session.
    90  * @return File type. 
    91  *      EFileTypeGeneral For normal file
    92  *      EFileTypeMkFifo  For mkfifo
    93  *      EFileTypeSymLink For Symbolic link.
    94  */
    95 IMPORT_C TSpecialFileType _SystemSpecialFileBasedFilePath
    96         (const wchar_t* aPathName, TInt& aErrno, RSessionBase& aSession);
    97 
    98 /*
    99  * Create a system file.
   100  * @param aFullFileName pointer to the file name.
   101  * @param aData Pointer to the data to be writen within the new file
   102  * @param aLen Length of the data.
   103  * @param anErrno Ref to the error no.
   104  * @param aSession File server session.
   105  * @return 0 for success, else -1
   106  */
   107 int _CreateSysSplFile(const wchar_t *aFullFileName, 
   108                     const char* aData, 
   109                     const int aLen,
   110                     int& anErrno,
   111                     RSessionBase& aSession);
   112 
   113 /*
   114  * delete a system file.
   115  * @param aFullFileName pointer to the file name.
   116  * @param aSession File server session.
   117  * @return 0 for success, else -1
   118  */
   119 /*
   120 TInt _DeleteSystemSpecialFileBasedFilePath
   121         (const char* aFullFileName, RSessionBase& aSession);*/
   122 
   123 /*
   124  * delete a system file. (Wide char)
   125  * @param aFullFileName pointer to the file name.
   126  * @param aSession File server session.
   127  * @return 0 for success, else -1
   128  */
   129 TInt _DeleteSystemSpecialFileBasedFilePath
   130         (const wchar_t* aFullFileName, RSessionBase& aSession);
   131 
   132 /*
   133  * Read a system file.
   134  * @param aFullFileName pointer to the file name.
   135  * @param aBuf Pointer to the buffer for read data
   136  * @param aLen Length of the data.
   137  * @param anErrno Ref to the error no.
   138  * @param aSession File server session.
   139  * @return number of bytes read on success, else -1
   140  */
   141 /*
   142 IMPORT_C int _ReadSysSplFileL(const char *aFullFileName,
   143                     char* aBuf, 
   144                     const int aLen,
   145                     int& anErrno,
   146                     RSessionBase& aSession);*/
   147 
   148 /*
   149  * Read a system file (wide char variant).
   150  * @param aFullFileName pointer to the file name.
   151  * @param aBuf Pointer to the buffer for read data
   152  * @param aLen Length of the data.
   153  * @param anErrno Ref to the error no.
   154  * @param aSession File server session.
   155  * @return number of bytes read on success, else -1
   156  */
   157 IMPORT_C int _ReadSysSplFile(const wchar_t *aFullFileName,
   158                     char* aBuf, 
   159                     const int aLen,
   160                     int& anErrno,
   161                     RSessionBase& aSession);
   162 
   163 
   164 
   165 #endif      // SYSTEM_SPECIAL_FILE_RCG_H
   166 
   167 // End of File
   168