remove unnecessary dependancy to reduce memory use
[platform/core/messaging/msg-service.git] / include / utils / MsgUtilFile.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
3  *
4  * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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 #include <stdio.h>
21 /*==================================================================================================
22                                         DEFINES
23 ==================================================================================================*/
24 #define FM_READ_WRITE_BUFFER_MAX (1024*1024*3)
25
26 /*==================================================================================================
27                                         FUNCTION PROTOTYPES
28 ==================================================================================================*/
29 bool MakeThumbnail(char *srcPath, char *dstPath);
30 /**  file operation wrapper - for avoding runtime error */
31 FILE* MsgOpenFile(const char* filepath, const char* opt);
32 void MsgCloseFile(FILE* pFile);
33 int MsgFseek(FILE* pFile, long int offset, int origin);
34 size_t MsgWriteFile(const char* pData, size_t size, size_t count, FILE  *pFile);
35 size_t MsgReadFile(void *pData, size_t size, size_t count, FILE *pFile);
36 long int MsgFtell(FILE *pFile);
37 int MsgFflush(FILE *pFile);
38 int MsgFsync(FILE *pFile);
39
40 bool MsgCreateFileName(char *pFileName);
41 bool MsgOpenAndReadFile(const char *pFileName, char **ppData, int *pDataSize);
42 bool MsgReadFileForDecode(FILE* pFile, char* pBuf, int length, int* nSize);
43 bool MsgWriteDataFromEncodeBuffer(FILE* pFile, char* pInBuffer, int *pPtr, int maxLen, int* pOffset);
44 bool MsgWriteIpcFile(const char *pFileName, const char *pData, int DataSize);
45 void MsgDeleteFile(const char *pFileName);
46 bool MsgGetFileSize(const char *pFilePath, int* nSize);
47 int MsgGetFileSize(const char *pFileName);
48 FILE*  MsgOpenMMSFile(char *pFileName);
49 bool MsgOpenCreateAndOverwriteFile(char *pFullPath, char *pBuff, int TotalLength);
50 char* MsgOpenAndReadMmsFile(const char* szFilePath, int offset, int size, int* npSize);
51 bool MsgWriteSmilFile(const char *pFilePath, char *pData, int DataSize);
52 int     MsgReadSmilFile(const char *pFileName, char **ppData);
53 void MsgDeleteSmilFile(const char *pFilePath);
54 int MsgRmRf(char *pDirPath);
55 unsigned int MsgDu(const char *pDirPath);
56 bool MsgAppendFile(const char *pFilePath, const char *pData, int DataSize);
57 void MsgMmsInitDir();
58 bool MsgAccessFile(const char *filepath, int mode);
59 bool MsgChmod(const char *filepath, int mode);
60 bool MsgChown(const char *filepath, int uid, int gid);
61 bool MsgCreateFile(const char *pFilePath, char *pData, int DataSize);
62 char *MsgGetDirName(char *file_path);
63 char *MsgGetFileName(char *file_path);
64 int MsgCheckFilepathSmack(const char *app_smack_label, char *file_path);
65
66 void MsgGetMimeType(char *filePath, char *mimeType, int size);
67 int MsgTcsScanFile(const char *filepath, int *bLevel);
68 bool MsgAclInit();
69 #endif /* MSG_UTIL_FILE_H */
70