First public contribution.
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Helper class to deal with special system files.
21 #ifndef SYSTEM_SPECIAL_FILE_RCG_H
22 #define SYSTEM_SPECIAL_FILE_RCG_H
25 #include <sys/cdefs.h>
26 #include <sys/types.h>
30 #define KMaxEncDecBuf 9
36 EFileGeneralError = -1,
38 EFileTypeGeneral, // not a system specific special file
39 EFileTypeMkFifo, // temp file of mkfifo type
40 EFileTypeSymLink, // symbolic link
42 EFileTypeMax // no enums beyond this.
45 struct SSpecialFileMagicHeader {
46 char iMagicBuffer[KMaxEncDecBuf];
47 unsigned char iFileType;
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
57 int _EncodeSystemSplFileMagicHeader(
58 struct SSpecialFileMagicHeader *aEncBuf,
59 TSpecialFileType aFileType);
62 * Try to retrieve file type from buffer.
63 * @param buf pointer to the contained buffer.
65 * EFileTypeGeneral For normal file
66 * EFileTypeMkFifo For mkfifo
67 * EFileTypeSymLink For Symbolic link.
69 TSpecialFileType _SystemSpecialFileBasedBuffer(const char *buf);
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.
77 * EFileTypeGeneral For normal file
78 * EFileTypeMkFifo For mkfifo
79 * EFileTypeSymLink For Symbolic link.
82 TSpecialFileType _SystemSpecialFileBasedFilePath
83 (const char* aFullFileName, TInt& aErrno, RSessionBase& aSession);*/
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.
91 * EFileTypeGeneral For normal file
92 * EFileTypeMkFifo For mkfifo
93 * EFileTypeSymLink For Symbolic link.
95 IMPORT_C TSpecialFileType _SystemSpecialFileBasedFilePath
96 (const wchar_t* aPathName, TInt& aErrno, RSessionBase& aSession);
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
107 int _CreateSysSplFile(const wchar_t *aFullFileName,
111 RSessionBase& aSession);
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
120 TInt _DeleteSystemSpecialFileBasedFilePath
121 (const char* aFullFileName, RSessionBase& aSession);*/
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
129 TInt _DeleteSystemSpecialFileBasedFilePath
130 (const wchar_t* aFullFileName, RSessionBase& aSession);
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
142 IMPORT_C int _ReadSysSplFileL(const char *aFullFileName,
146 RSessionBase& aSession);*/
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
157 IMPORT_C int _ReadSysSplFile(const wchar_t *aFullFileName,
161 RSessionBase& aSession);
165 #endif // SYSTEM_SPECIAL_FILE_RCG_H