[CAPI description changed] The @a -> @a
[platform/upstream/csr-framework.git] / src / include / csr / csr-engine-manager.h
1 /*
2  *  Copyright (c) 2016 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  * @file        csr-engine-manager.h
18  * @author      Dongsun Lee (ds73.lee@samsung.com)
19  * @version     1.0
20  * @brief       Engine management CAPI header
21  */
22 #ifndef __CSR_ENGINE_MANAGER_H_
23 #define __CSR_ENGINE_MANAGER_H_
24
25 #include <time.h>
26 #include <csr-error.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /**
33  * @addtogroup CAPI_CSR_FRAMEWORK_ADMIN_MODULE
34  * @{
35  */
36
37 /**
38  * @platform
39  * @brief Engine handle
40  * @since_tizen 3.0
41  */
42 typedef struct __csr_engine_h *csr_engine_h;
43
44 /**
45  * @platform
46  * @brief Engine identifier
47  * @since_tizen 3.0
48  */
49 typedef enum {
50         CSR_ENGINE_CS = 0x01,  /**< Content screening engine id */
51         CSR_ENGINE_WP = 0x02   /**< Web protection engine id */
52 } csr_engine_id_e;
53
54 /**
55  * @platform
56  * @brief State of engine activation
57  * @since_tizen 3.0
58  */
59 typedef enum {
60         CSR_NOT_ACTIVATED = 0x01,  /**< Engine is not activated */
61         CSR_ACTIVATED     = 0x02   /**< Engine is activated */
62 } csr_activated_e;
63
64 /**
65  * @platform
66  * @brief State of engine
67  * @since_tizen 3.0
68  */
69 typedef enum {
70         CSR_STATE_ENABLE        = 0x01,  /**< Enable engine */
71         CSR_STATE_DISABLE       = 0x02   /**< Disable engine */
72 } csr_state_e;
73
74 /**
75  * @platform
76  * @brief Gets the handle of a current engine information.
77  *
78  * @since_tizen 3.0
79  *
80  * @remarks @a engine should be released using csr_engine_destroy().
81  *
82  * @param[in]  id       Engine identifier to get handle.
83  * @param[out] engine   A pointer of the engine information handle.
84  *
85  * @return #CSR_ERROR_NONE on success, otherwise a negative error value
86  *
87  * @retval #CSR_ERROR_NONE                 Successful
88  * @retval #CSR_ERROR_INVALID_PARAMETER    @a engine is invalid
89  * @retval #CSR_ERROR_ENGINE_NOT_EXIST     No engine exists
90  * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
91  * @retval #CSR_ERROR_ENGINE_INTERNAL      Engine Internal error
92  * @retval #CSR_ERROR_SYSTEM               System error
93  *
94  * @see csr_engine_destroy()
95  */
96 int csr_get_current_engine(csr_engine_id_e id, csr_engine_h *engine);
97
98 /**
99  * @platform
100  * @brief Extracts an vendor name from the engine information handle.
101  *
102  * @since_tizen 3.0
103  * @privlevel platform
104  * @privilege %http://tizen.org/privilege/antivirus.admin
105  *
106  * @remarks  @a vendor must be released using free().
107  *
108  * @param[in]  engine   The engine information handle.
109  * @param[out] vendor   A pointer of the engine's vendor name.
110  *
111  * @return #CSR_ERROR_NONE on success, otherwise a negative error value
112  *
113  * @retval #CSR_ERROR_NONE                 Successful
114  * @retval #CSR_ERROR_INVALID_HANDLE       Invalid engine information handle
115  * @retval #CSR_ERROR_INVALID_PARAMETER    @a vendor is invalid
116  * @retval #CSR_ERROR_PERMISSION_DENIED    Permission denied
117  * @retval #CSR_ERROR_ENGINE_INTERNAL      Engine Internal error
118  * @retval #CSR_ERROR_SYSTEM               System error
119  *
120  * @see csr_get_current_engine()
121  */
122 int csr_engine_get_vendor(csr_engine_h engine, char **vendor);
123
124 /**
125  * @platform
126  * @brief Extracts an engine name from the engine information handle.
127  *
128  * @since_tizen 3.0
129  * @privlevel platform
130  * @privilege %http://tizen.org/privilege/antivirus.admin
131  *
132  * @remarks  @a name must be released using free().
133  *
134  * @param[in]  engine  The engine information handle.
135  * @param[out] name    A pointer of the engine's name.
136  *
137  * @return #CSR_ERROR_NONE on success, otherwise a negative error value
138  *
139  * @retval #CSR_ERROR_NONE                 Successful
140  * @retval #CSR_ERROR_INVALID_HANDLE       Invalid engine information handle
141  * @retval #CSR_ERROR_INVALID_PARAMETER    @a name is invalid
142  * @retval #CSR_ERROR_PERMISSION_DENIED    Permission denied
143  * @retval #CSR_ERROR_ENGINE_INTERNAL      Engine Internal error
144  * @retval #CSR_ERROR_SYSTEM               System error
145  *
146  * @see csr_get_current_engine()
147  */
148 int csr_engine_get_name(csr_engine_h engine, char **name);
149
150 /**
151  * @platform
152  * @brief Extracts an engine version from the engine information handle.
153  *
154  * @since_tizen 3.0
155  * @privlevel platform
156  * @privilege %http://tizen.org/privilege/antivirus.admin
157  *
158  * @remarks  @a version must be released using free().
159  *
160  * @param[in]  engine    An engine information handle.
161  * @param[out] version   A pointer of the engine's version.
162  *
163  * @return #CSR_ERROR_NONE on success, otherwise a negative error value
164  *
165  * @retval #CSR_ERROR_NONE                 Successful
166  * @retval #CSR_ERROR_INVALID_HANDLE       Invalid engine information handle
167  * @retval #CSR_ERROR_INVALID_PARAMETER    @a version is invalid
168  * @retval #CSR_ERROR_PERMISSION_DENIED    Permission denied
169  * @retval #CSR_ERROR_ENGINE_INTERNAL      Engine Internal error
170  * @retval #CSR_ERROR_SYSTEM               System error
171  *
172  * @see csr_get_current_engine()
173  */
174 int csr_engine_get_version(csr_engine_h engine, char **version);
175
176 /**
177  * @platform
178  * @brief Extracts an engine's data version from the engine information handle.
179  *
180  * @since_tizen 3.0
181  * @privlevel platform
182  * @privilege %http://tizen.org/privilege/antivirus.admin
183  *
184  * @remarks  @a version must be released using free().
185  *
186  * @param[in]  engine    The engine information handle.
187  * @param[out] version   A pointer of the data version. It can be null.
188  *
189  * @return #CSR_ERROR_NONE on success, otherwise a negative error value
190  *
191  * @retval #CSR_ERROR_NONE                 Successful
192  * @retval #CSR_ERROR_INVALID_HANDLE       Invalid engine information handle
193  * @retval #CSR_ERROR_INVALID_PARAMETER    @a version is invalid
194  * @retval #CSR_ERROR_PERMISSION_DENIED    Permission denied
195  * @retval #CSR_ERROR_ENGINE_INTERNAL      Engine Internal error
196  * @retval #CSR_ERROR_SYSTEM               System error
197  *
198  * @see csr_get_current_engine()
199  */
200 int csr_engine_get_data_version(csr_engine_h engine, char **version);
201
202 /**
203  * @platform
204  * @brief Extracts the latest update time of an engine from the engine information handle.
205  *
206  * @since_tizen 3.0
207  * @privlevel platform
208  * @privilege %http://tizen.org/privilege/antivirus.admin
209  *
210  * @param[in]  engine   The engine information handle.
211  * @param[out] time     A pointer of lasted update time.
212  *
213  * @return #CSR_ERROR_NONE on success, otherwise a negative error value
214  *
215  * @retval #CSR_ERROR_NONE                 Successful
216  * @retval #CSR_ERROR_INVALID_HANDLE       Invalid engine information handle
217  * @retval #CSR_ERROR_INVALID_PARAMETER    @a time is invalid
218  * @retval #CSR_ERROR_PERMISSION_DENIED    Permission denied
219  * @retval #CSR_ERROR_ENGINE_INTERNAL      Engine Internal error
220  * @retval #CSR_ERROR_SYSTEM               System error
221  *
222  * @see csr_get_current_engine()
223  */
224 int csr_engine_get_latest_update_time(csr_engine_h engine, time_t *time);
225
226 /**
227  * @platform
228  * @brief Extracts the state of engine activation from the engine information handle.
229  *
230  * @since_tizen 3.0
231  * @privlevel platform
232  * @privilege %http://tizen.org/privilege/antivirus.admin
233  *
234  * @param[in]  engine      The engine information handle.
235  * @param[out] activated   A pointer of the engine activation state.
236  *
237  * @return #CSR_ERROR_NONE on success, otherwise a negative error value
238  *
239  * @retval #CSR_ERROR_NONE                 Successful
240  * @retval #CSR_ERROR_INVALID_HANDLE       Invalid engine information handle
241  * @retval #CSR_ERROR_INVALID_PARAMETER    @a activated is invalid
242  * @retval #CSR_ERROR_PERMISSION_DENIED    Permission denied
243  * @retval #CSR_ERROR_ENGINE_INTERNAL      Engine Internal error
244  * @retval #CSR_ERROR_SYSTEM               System error
245  *
246  * @see csr_get_current_engine()
247  */
248 int csr_engine_get_activated(csr_engine_h engine, csr_activated_e *activated);
249
250 /**
251  * @platform
252  * @brief Enable or disable an engine.
253  *
254  * @since_tizen 3.0
255  * @privlevel platform
256  * @privilege %http://tizen.org/privilege/antivirus.admin
257  *
258  * @remarks If an engine is disabled, all major operations would be failed with
259  *          #CSR_ERROR_ENGINE_DISABLED error code.
260  *
261  * @param[in]  engine  The engine information handle.
262  * @param[in]  state   The engine state.
263  *
264  * @return #CSR_ERROR_NONE on success, otherwise a negative error value
265  *
266  * @retval #CSR_ERROR_NONE                 Successful
267  * @retval #CSR_ERROR_INVALID_HANDLE       Invalid engine information handle
268  * @retval #CSR_ERROR_INVALID_PARAMETER    @a state is invalid
269  * @retval #CSR_ERROR_PERMISSION_DENIED    Permission denied
270  * @retval #CSR_ERROR_ENGINE_INTERNAL      Engine Internal error
271  * @retval #CSR_ERROR_SYSTEM               System error
272  *
273  * @see csr_get_current_engine()
274  */
275 int csr_engine_set_state(csr_engine_h engine, csr_state_e state);
276
277 /**
278  * @platform
279  * @brief Gets the engine state.
280  *
281  * @since_tizen 3.0
282  * @privlevel platform
283  * @privilege %http://tizen.org/privilege/antivirus.admin
284  *
285  * @param[in]  engine      The engine information handle.
286  * @param[out] state       A pointer of the engine state.
287  *
288  * @return #CSR_ERROR_NONE on success, otherwise a negative error value
289  *
290  * @retval #CSR_ERROR_NONE                 Successful
291  * @retval #CSR_ERROR_INVALID_HANDLE       Invalid engine information handle
292  * @retval #CSR_ERROR_INVALID_PARAMETER    @a state is invalid
293  * @retval #CSR_ERROR_PERMISSION_DENIED    Permission denied
294  * @retval #CSR_ERROR_ENGINE_INTERNAL      Engine Internal error
295  * @retval #CSR_ERROR_SYSTEM               System error
296  *
297  * @see csr_get_current_engine()
298  */
299 int csr_engine_get_state(csr_engine_h engine, csr_state_e *state);
300
301 /**
302  * @platform
303  * @brief Releases all system resources associated with a engine information handle.
304  *
305  * @since_tizen 3.0
306  *
307  * @param[in]  engine      The engine information handle.
308  *
309  * @return #CSR_ERROR_NONE on success, otherwise a negative error value
310  *
311  * @retval #CSR_ERROR_NONE                  Successful
312  * @retval #CSR_ERROR_INVALID_HANDLE        Invalid engine information handle
313  */
314 int csr_engine_destroy(csr_engine_h engine);
315
316 /**
317  * @}
318  */
319
320 #ifdef __cplusplus
321 }
322 #endif
323
324 #endif