blob: 5c49899f6084d91ed764e38f0b69c56c53fc6362 [file] [log] [blame]
Sungmin Choi5fd819d2012-07-18 01:49:40 -07001/*
2 * Copyright 2012 The Android Open Source Project
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 __WFC_UTIL_FCTRL_H__
18#define __WFC_UTIL_FCTRL_H__
19
20/*
21 * wfc_util_fset_buffer
22 *
23 * return : void
24 */
25void wfc_util_fset_buffer(char *pFileName, int positionStart, unsigned char *pNewValue, int newValueLength);
26
27/*
28 * wfc_util_fget_buffer
29 *
30 * return : it will return the length of the stored buffer value if procedure is success
31 * or will return 0 if not.
32 */
33extern int wfc_util_fget_buffer(char *pFileName, int positionStart, int lengthToRead, unsigned char *pValueBuff, int buffLength);
34
35/*
36 * wfc_util_fset_string
37 *
38 * The following format string will be added or updated to the file pFileName.
39 * [pSTagString][pNewValueString][pETagString]
40 *
41 * pFileName : file name and path
42 * pEndOfCfg : tag string to notify the end of configuration file
43 * pSTagString : tag string to notify purpose of the value
44 * pETagString : tag string to notify the end of the value
45 * pNewValueString : string to set for pSTagString
46 *
47 * return : void
48 */
49extern void wfc_util_fset_string(char *pFileName, char *pEndOfCfg, char *pSTagString, char *pETagString, char *pNewValueString);
50
51/*
52 * wfc_util_fget_string
53 *
54 * Read value from the following format string in the file pFileName.
55 * [pSTagString][string value to read][pETagString]
56 *
57 * pFileName : file name and path
58 * pEndOfCfg : tag string to notify the end of configuration file
59 * pSTagString : tag string to notify purpose of the value
60 * pETagString : tag string to notify the end of the value
61 * pValueStringBuff : string buffer to get string value
62 * stringBuffLength : the length of pValueStringBuff
63 *
64 * return : it will return the length of the stored string value if procedure is success
65 * or will return 0 if not.
66 */
67extern int wfc_util_fget_string(char *pFileName, char *pEndOfCfg, char *pSTagString, char *pETagString, char *pValueStringBuff, int stringBuffLength);
68
69/*
70 * wfc_util_ffile_check
71 *
72 * check whether pDestFName file exist or not
73 *
74 * pFileName : file name and path
75 * access_mode : R_OK | W_OK | X_OK | F_OK
76 *
77 * return : it will return 0 if the file exist
78 * or will return -1 if not.
79 */
80extern int wfc_util_ffile_check(char *pDestFName, int access_mode);
81
82/*
83 * wfc_util_ffile_check_copy
84 *
85 * check whether pDestFName file exist if not it will copy from pSourceFName file
86 *
87 * return : it will return 0 if procedure is success
88 * or will return -1 if not.
89 */
90extern int wfc_util_ffile_check_copy(char *pDestFName, char *pSourceFName, mode_t mode, uid_t uID, gid_t gID);
91
92#endif