[Internal: merge sync-agent]
[platform/core/system/sync-agent.git] / include / utility / fw_compress.h
1 /*
2  * sync-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #ifndef FW_COMPRESS_H_
19 #define FW_COMPRESS_H_
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif                          /* __cplusplus */
24
25 /**
26  * @file fw_compress.h
27  * @brief Provides folder de/compress operations
28  */
29
30 /** @addtogroup utility
31  *      @{
32  */
33
34 /**
35  * Enumerations of compress result
36  */
37         typedef enum {
38                 SYNC_AGENT_UTIL_COMPRESS_SUCCESS = 1,
39                                               /**< operation success */
40                 SYNC_AGENT_UTIL_COMPRESS_FAIL
41                                       /**< operation failed */
42         } sync_agent_util_compress_result_e;
43
44 /**
45  * Enumerations of compress type
46  */
47         typedef enum {
48                 SYNC_AGENT_UTIL_COMPRESS_TYPE_TAR = 1,
49                                                /**< compress type : tar */
50                 SYNC_AGENT_UTIL_COMPRESS_TYPE_ZIP
51                                           /**< compress type : zip */
52         } sync_agent_util_compress_type_e;
53
54 /**
55  * API to compress folder into desired format
56  *
57  * @par Usage:
58  * @code
59                 sync_agent_util_compress_result_e result = SYNC_AGENT_UTIL_COMPRESS_SUCCESS;
60                 sync_agent_util_compress_type_e type = SYNC_AGENT_UTIL_COMPRESS_TYPE_TAR;
61                 char *input_path = NULL;
62                 char *output_path = NULL;
63                 ...
64                 result = sync_agent_compress(type, input_path, output_path);
65                 if (result != SYNC_AGENT_UTIL_COMPRESS_SUCCESS) {
66                         // error handling
67                         ...
68                 }
69  *
70  * @endcode
71  *
72  * @param[in] type type of compress in sync_agent_util_compress_type_e type of value
73  * @param[in] input_directory_path folder path to compress
74  * @param[in] output_file_path path to put compressed file
75  *
76  * @return SYNC_AGENT_UTIL_COMPRESS_SUCCESS on success, SYNC_AGENT_UTIL_COMPRESS_FAIL on error
77  *
78  * @par Since:
79  *
80  *
81  * @see sync_agent_compress(sync_agent_util_compress_type_e, const char *, const char *)
82  *
83  */
84         sync_agent_util_compress_result_e sync_agent_compress(sync_agent_util_compress_type_e type, const char *input_directory_path, const char *output_file_path);
85
86 /**
87  * API to decompress compressed file in specific format
88  *
89  * @par Usage:
90  * @code
91                 sync_agent_util_compress_type_e type = SYNC_AGENT_UTIL_COMPRESS_TYPE_TAR;
92                 char *input_path = NULL;
93                 char *output_path = NULL;
94                 ...
95                 result = sync_agent_uncompress(type, input_path, output_path);
96                 if (result != SYNC_AGENT_UTIL_COMPRESS_SUCCESS) {
97                         // error handling
98                         ...
99                 }
100  *
101  * @endcode
102  *
103  * @param[in] type type of compress in sync_agent_util_compress_type_e type of value
104  * @param[in] input_file_path compressed file path to decompress
105  * @param[in] output_direcory_path path to put decompressed folder
106  *
107  * @return SYNC_AGENT_UTIL_COMPRESS_SUCCESS on success, SYNC_AGENT_UTIL_COMPRESS_FAIL on error
108  *
109  * @par Since:
110  *
111  *
112  * @see sync_agent_uncompress(sync_agent_util_compress_type_e, const char *, const char *)
113  *
114  */
115         sync_agent_util_compress_result_e sync_agent_uncompress(sync_agent_util_compress_type_e type, const char *input_file_path, const char *output_direcory_path);
116
117 /**
118  * API to decompress compressed file in specific format
119  *
120  * @par Usage:
121  * @code
122                 sync_agent_util_compress_type_e type = SYNC_AGENT_UTIL_COMPRESS_TYPE_TAR;
123                 char *input_path = NULL;
124                 char *output_path = NULL;
125                 ...
126                 result = sync_agent_ua_uncompress(type, input_path, output_path);
127                 if (result != SYNC_AGENT_UTIL_COMPRESS_SUCCESS) {
128                         // error handling
129                         ...
130                 }
131  *
132  * @endcode
133  *
134  * @param[in] type type of compress in sync_agent_util_compress_type_e type of value
135  * @param[in] input_file_path compressed file path to decompress
136  * @param[in] output_direcory_path path to Update-Agent put decompressed folder
137  *
138  * @return SYNC_AGENT_UTIL_COMPRESS_SUCCESS on success, SYNC_AGENT_UTIL_COMPRESS_FAIL on error
139  *
140  * @par Since:
141  *
142  *
143  * @see sync_agent_ua_uncompress(sync_agent_util_compress_type_e, const char *, const char *)
144  *
145  */
146         sync_agent_util_compress_result_e sync_agent_ua_uncompress(sync_agent_util_compress_type_e type, const char *input_file_path, const char *output_direcory_path);
147
148 /**
149  *      @}
150  */
151
152 #ifdef __cplusplus
153 }
154 #endif                          /* __cplusplus */
155 #endif                          /* FW_COMPRESS_H_ */