2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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
17 * @file csr-engine-manager.h
18 * @author Dongsun Lee (ds73.lee@samsung.com)
20 * @brief Engine management CAPI header
22 #ifndef __CSR_ENGINE_MANAGER_H_
23 #define __CSR_ENGINE_MANAGER_H_
26 #include <csr-error.h>
33 * @addtogroup CAPI_CSR_FRAMEWORK_ADMIN_MODULE
39 * @brief Engine handle
42 typedef struct __csr_engine_h *csr_engine_h;
46 * @brief Engine identifier
50 CSR_ENGINE_CS = 0x01, /**< Content screening engine id */
51 CSR_ENGINE_WP = 0x02 /**< Web protection engine id */
56 * @brief State of engine activation
60 CSR_NOT_ACTIVATED = 0x01, /**< Engine is not activated */
61 CSR_ACTIVATED = 0x02 /**< Engine is activated */
66 * @brief State of engine
70 CSR_STATE_ENABLE = 0x01, /**< Enable engine */
71 CSR_STATE_DISABLE = 0x02 /**< Disable engine */
76 * @brief Gets the handle of a current engine information.
80 * @remarks The @a engine should be released using csr_engine_destroy().
82 * @param[in] id Engine identifier to get handle.
83 * @param[out] engine A pointer of the engine information handle.
85 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
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
94 * @see csr_engine_destroy()
96 int csr_get_current_engine(csr_engine_id_e id, csr_engine_h *engine);
100 * @brief Extracts an vendor name from the engine information handle.
103 * @privlevel platform
104 * @privilege %http://tizen.org/privilege/antivirus.admin
106 * @remarks The @a vendor must be released using free().
108 * @param[in] engine The engine information handle.
109 * @param[out] vendor A pointer of the engine's vendor name.
111 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
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
120 * @see csr_get_current_engine()
122 int csr_engine_get_vendor(csr_engine_h engine, char **vendor);
126 * @brief Extracts an engine name from the engine information handle.
129 * @privlevel platform
130 * @privilege %http://tizen.org/privilege/antivirus.admin
132 * @remarks The @a name must be released using free().
134 * @param[in] engine The engine information handle.
135 * @param[out] name A pointer of the engine's name.
137 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
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
146 * @see csr_get_current_engine()
148 int csr_engine_get_name(csr_engine_h engine, char **name);
152 * @brief Extracts an engine version from the engine information handle.
155 * @privlevel platform
156 * @privilege %http://tizen.org/privilege/antivirus.admin
158 * @remarks The @a version must be released using free().
160 * @param[in] engine An engine information handle.
161 * @param[out] version A pointer of the engine's version.
163 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
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
172 * @see csr_get_current_engine()
174 int csr_engine_get_version(csr_engine_h engine, char **version);
178 * @brief Extracts an engine's data version from the engine information handle.
181 * @privlevel platform
182 * @privilege %http://tizen.org/privilege/antivirus.admin
184 * @remarks The @a version must be released using free().
186 * @param[in] engine The engine information handle.
187 * @param[out] version A pointer of the data version. It can be null.
189 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
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
198 * @see csr_get_current_engine()
200 int csr_engine_get_data_version(csr_engine_h engine, char **version);
204 * @brief Extracts the latest update time of an engine from the engine information handle.
207 * @privlevel platform
208 * @privilege %http://tizen.org/privilege/antivirus.admin
210 * @param[in] engine The engine information handle.
211 * @param[out] time A pointer of lasted update time.
213 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
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
222 * @see csr_get_current_engine()
224 int csr_engine_get_latest_update_time(csr_engine_h engine, time_t *time);
228 * @brief Extracts the state of engine activation from the engine information handle.
231 * @privlevel platform
232 * @privilege %http://tizen.org/privilege/antivirus.admin
234 * @param[in] engine The engine information handle.
235 * @param[out] activated A pointer of the engine activation state.
237 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
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
246 * @see csr_get_current_engine()
248 int csr_engine_get_activated(csr_engine_h engine, csr_activated_e *activated);
252 * @brief Enable or disable an engine.
255 * @privlevel platform
256 * @privilege %http://tizen.org/privilege/antivirus.admin
258 * @remarks If an engine is disabled, all major operations would be failed with
259 * #CSR_ERROR_ENGINE_DISABLED error code.
261 * @param[in] engine The engine information handle.
262 * @param[in] state The engine state.
264 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
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
273 * @see csr_get_current_engine()
275 int csr_engine_set_state(csr_engine_h engine, csr_state_e state);
279 * @brief Gets the engine state.
282 * @privlevel platform
283 * @privilege %http://tizen.org/privilege/antivirus.admin
285 * @param[in] engine The engine information handle.
286 * @param[out] state A pointer of the engine state.
288 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
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
297 * @see csr_get_current_engine()
299 int csr_engine_get_state(csr_engine_h engine, csr_state_e *state);
303 * @brief Releases all system resources associated with a engine information handle.
307 * @param[in] engine The engine information handle.
309 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
311 * @retval #CSR_ERROR_NONE Successful
312 * @retval #CSR_ERROR_INVALID_HANDLE Invalid engine information handle
314 int csr_engine_destroy(csr_engine_h engine);