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