RSA sync with private
[platform/core/messaging/msg-service.git] / include / utils / MsgUtilFile.h
1 /*
2 * Copyright 2012  Samsung Electronics Co., Ltd
3 *
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *    http://www.tizenopensource.org/license
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef MSG_UTIL_FILE_H
18 #define MSG_UTIL_FILE_H
19
20
21 /*==================================================================================================
22                                         DEFINES
23 ==================================================================================================*/
24 #define FM_READ_WRITE_BUFFER_MAX (1024*1024*3)
25
26 /*==================================================================================================
27                                         FUNCTION PROTOTYPES
28 ==================================================================================================*/
29 /**  file operation wrapper - for avoding runtime error */
30 FILE* MsgOpenFile(const char* filepath, const char* opt);
31 void MsgCloseFile(FILE* pFile);
32 int MsgFseek(FILE* pFile, long int offset, int origin);
33 size_t MsgWriteFile(const char* pData, size_t size, size_t count, FILE  *pFile);
34 size_t MsgReadFile(void *pData, size_t size, size_t count, FILE *pFile);
35 long int MsgFtell(FILE *pFile);
36 int MsgFflush(FILE *pFile);
37 int MsgFsync(FILE *pFile);
38
39 bool MsgCreateFileName(char *pFileName);
40 bool MsgOpenAndReadFile(const char *pFileName, char **ppData, int *pDataSize);
41 bool MsgReadFileForDecode(FILE* pFile, char* pBuf, int length, int* nSize);
42 bool    MsgWriteDataFromEncodeBuffer(FILE* pFile, char* pInBuffer, int *pPtr, int maxLen, int* pOffset );
43 bool MsgWriteIpcFile(const char *pFileName, const char *pData, int DataSize);
44 void MsgDeleteFile(const char *pFileName);
45 bool MsgGetFileSize(const char *pFilePath, int* nSize);
46 int MsgGetFileSize(const char *pFileName);
47 FILE*  MsgOpenMMSFile(char *pFileName);
48 bool MsgOpenCreateAndOverwriteFile(char *pFullPath, char *pBuff, int TotalLength);
49 char* MsgOpenAndReadMmsFile(const char* szFilePath, int offset, int size, int* npSize );
50 bool MsgWriteSmilFile(const char *pFilePath,char *pData, int DataSize);
51 int     MsgReadSmilFile(const char *pFileName, char **ppData);
52 void MsgDeleteSmilFile(const char *pFilePath);
53 int MsgRmRf(char *pDirPath);
54 unsigned int MsgDu(const char *pDirPath);
55 bool MsgAppendFile(const char *pFilePath, const char *pData, int DataSize);
56 void MsgMmsInitDir();
57 bool MsgAccessFile(const char *filepath, int mode);
58
59 #endif // MSG_UTIL_FILE_H
60