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-content-screening.h
18 * @author Dongsun Lee (ds73.lee@samsung.com)
20 * @brief Content screening to detect malware in files
22 #ifndef __CSR_CONTENT_SCREENING_API_H_
23 #define __CSR_CONTENT_SCREENING_API_H_
28 #include <csr-content-screening-types.h>
29 #include <csr-error.h>
36 * @addtogroup CAPI_CSR_FRAMEWORK_CS_MODULE
42 * @brief Initializes and returns a Content Screening API handle.
44 * @details A Content Screening API handle (or CSR CS handle) is obtained by this method.
45 * The handle is required for subsequent CSR CS API calls.
49 * @remarks The @a handle should be released using csr_cs_context_destroy().
50 * @remarks Multiple handles can be obtained.
52 * @param[out] handle A pointer of CSR CS context handle.
54 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
56 * @retval #CSR_ERROR_NONE Successful
57 * @retval #CSR_ERROR_INVALID_HANDLE @a handle may be null
58 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
59 * @retval #CSR_ERROR_SYSTEM System error
61 * @see csr_cs_context_destroy()
63 int csr_cs_context_create(csr_cs_context_h *handle);
66 * @brief Releases all system resources associated with a Content Screening API handle.
70 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
72 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
74 * @retval #CSR_ERROR_NONE Successful
75 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
76 * @retval #CSR_ERROR_SOCKET Socket error between client and server
77 * @retval #CSR_ERROR_SYSTEM System error
79 * @see csr_cs_context_create()
81 int csr_cs_context_destroy(csr_cs_context_h handle);
84 * @brief Sets a popup option for malware detected.
86 * @details If #CSR_CS_ASK_USER_YES is set, a popup will be prompted to a user when a malware
87 * is detected. If #CSR_CS_ASK_USER_NO is set which is default value, no popup
88 * will be prompted even if a malware is detected. User can allow, disallow and
89 * remove detected malware by popup. Selection can be different between malware's
94 * @remarks This option is disabled(#CSR_CS_ASK_USER_NO) as a default.
96 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
97 * @param[in] ask_user Popup option to set or unset.
99 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
101 * @retval #CSR_ERROR_NONE Successful
102 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
103 * @retval #CSR_ERROR_INVALID_PARAMETER @a ask_user is invalid
104 * @retval #CSR_ERROR_SYSTEM System error
106 * @see csr_cs_context_create()
107 * @see csr_cs_context_destroy()
109 int csr_cs_set_ask_user(csr_cs_context_h handle, csr_cs_ask_user_e ask_user);
112 * @brief Sets a popup message of a client in case that a malware is detected.
114 * @details Default message is "Malware which may harm your device is detected.".
118 * @remarks Meaningful only when ask user option is set by csr_cs_set_ask_user().
119 * @remarks The message will be printed on popup for user.
120 * @remarks Default popup message will be used if it isn't set.
122 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
123 * @param[in] message A message to print on a popup.
125 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
127 * @retval #CSR_ERROR_NONE Successful
128 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
129 * @retval #CSR_ERROR_INVALID_PARAMETER @a message is too long or empty. Max size
131 * @retval #CSR_ERROR_SYSTEM System error
133 * @see csr_cs_context_create()
134 * @see csr_cs_context_destroy()
136 int csr_cs_set_popup_message(csr_cs_context_h handle, const char *message);
139 * @brief Sets a maximum core usage during scanning.
143 * @remarks If a core usage is not set, #CSR_CS_CORE_USAGE_DEFAULT will be used.
145 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
146 * @param[in] usage A maximum core usage during scanning.
148 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
150 * @retval #CSR_ERROR_NONE Successful
151 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
152 * @retval #CSR_ERROR_INVALID_PARAMETER @a usage is invalid
153 * @retval #CSR_ERROR_SYSTEM System error
155 * @see csr_cs_context_create()
156 * @see csr_cs_context_destroy()
158 int csr_cs_set_core_usage(csr_cs_context_h handle, csr_cs_core_usage_e usage);
161 * @brief Sets a scan on cloud option.
165 * @remarks Scan on cloud option is turned off as a default.
166 * @remarks If an engine does not support "scanning on cloud", this option is silently
169 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
170 * @param[int] is_on_cloud Flag to turn on(#true) or off(#false) of scan on cloud option.
172 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
174 * @retval #CSR_ERROR_NONE Successful
175 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
176 * @retval #CSR_ERROR_SYSTEM System error
178 * @see csr_cs_context_create()
179 * @see csr_cs_context_destroy()
181 int csr_cs_set_scan_on_cloud(csr_cs_context_h handle, bool is_on_cloud);
184 * @brief Scans a data buffer for malware.
186 * @details @a malware result of this method is not available for being judged by
187 * csr_cs_judge_detected_malware() because it's data, not file, so cannot being
188 * removed or ignored.
192 * @privilege %http://tizen.org/privilege/antivirus.scan
194 * @remarks Scan data synchronously.
195 * @remarks The @a malware will be released when @a handle is released using
196 * csr_cs_context_destroy().
198 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
199 * @param[in] data A scan target data.
200 * @param[in] length A size of a scan target data.
201 * @param[out] malware A pointer of the detected malware handle. It can be null when
202 * no malware detected.
204 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
206 * @retval #CSR_ERROR_NONE Successful
207 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
208 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
209 * @retval #CSR_ERROR_INVALID_PARAMETER @a data or @a malware is invalid
210 * @retval #CSR_ERROR_PERMISSION_DENIED No privilege to call
211 * @retval #CSR_ERROR_NOT_SUPPORTED Device needed to run API is not supported
212 * @retval #CSR_ERROR_SOCKET Socket error between client and server
213 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
214 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
215 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
216 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
217 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
218 * @retval #CSR_ERROR_SYSTEM System error
220 * @see csr_cs_context_create()
221 * @see csr_cs_context_destroy()
223 int csr_cs_scan_data(csr_cs_context_h handle, const unsigned char *data, size_t length,
224 csr_cs_malware_h *malware);
227 * @brief Scans a file specified by file path for malware.
231 * @privilege %http://tizen.org/privilege/antivirus.scan
233 * @remarks Scan file synchronously.
234 * @remarks The @a malware will be released when @a handle is released using
235 * csr_cs_context_destroy().
237 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
238 * @param[in] file_path A path of scan target file.
239 * @param[out] malware A pointer of the detected malware handle. It can be null when
240 * no malware detected.
242 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
244 * @retval #CSR_ERROR_NONE Successful
245 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
246 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
247 * @retval #CSR_ERROR_INVALID_PARAMETER @a file_path or @a malware is invalid
248 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
249 * @retval #CSR_ERROR_NOT_SUPPORTED Device needed to run API is not supported
250 * @retval #CSR_ERROR_DB DB transaction error
251 * @retval #CSR_ERROR_REMOVE_FAILED File remove failed when malware exist and
252 * user select to remove by popup. @a malware
253 * will be allocated on this error unlike others.
254 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File not found
255 * @retval #CSR_ERROR_SOCKET Socket error between client and server
256 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
257 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
258 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
259 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
260 * @retval #CSR_ERROR_ENGINE_PERMISSION Insufficient permission of engine
261 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
262 * @retval #CSR_ERROR_SYSTEM System error
264 * @see csr_cs_context_create()
265 * @see csr_cs_context_destroy()
267 int csr_cs_scan_file(csr_cs_context_h handle, const char *file_path,
268 csr_cs_malware_h *malware);
271 * @brief Sets a callback function for the case that a file scan is completed.
275 * @remarks Callback for asynchronous scan functions.
277 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
278 * @param[in] callback A callback function for each file or application scanning
279 * done without any malware.
281 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
283 * @retval #CSR_ERROR_NONE Successful
284 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
285 * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid
286 * @retval #CSR_ERROR_SYSTEM System error
288 * @see csr_cs_scan_files_async()
289 * @see csr_cs_scan_dir_async()
290 * @see csr_cs_scan_dirs_async()
292 int csr_cs_set_file_scanned_cb(csr_cs_context_h handle, csr_cs_file_scanned_cb callback);
295 * @brief Sets a callback function for detection of a malware.
299 * @remarks Callback for asynchronous scan functions.
301 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
302 * @param[in] callback A callback function for each file or application scanning done
303 * with malware detected.
305 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
307 * @retval #CSR_ERROR_NONE Successful
308 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
309 * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid
310 * @retval #CSR_ERROR_SYSTEM System error
312 * @see csr_cs_scan_files_async()
313 * @see csr_cs_scan_dir_async()
314 * @see csr_cs_scan_dirs_async()
316 int csr_cs_set_detected_cb(csr_cs_context_h handle, csr_cs_detected_cb callback);
319 * @brief Sets a callback function for scanning completed without an error.
323 * @remarks Callback for asynchronous scan functions.
325 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
326 * @param[in] callback A callback function for scanning completed successfully.
328 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
330 * @retval #CSR_ERROR_NONE Successful
331 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
332 * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid
333 * @retval #CSR_ERROR_SYSTEM System error
335 * @see csr_cs_scan_files_async()
336 * @see csr_cs_scan_dir_async()
337 * @see csr_cs_scan_dirs_async()
339 int csr_cs_set_completed_cb(csr_cs_context_h handle, csr_cs_completed_cb callback);
342 * @brief Sets a callback function for scanning cancelled.
346 * @remarks Callback for asynchronous scan functions.
347 * @remarks Client can cancel asynchronous scanning by csr_cs_cancel_scanning().
349 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
350 * @param[in] callback A callback function for scanning cancelled.
352 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
354 * @retval #CSR_ERROR_NONE Successful
355 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
356 * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid
357 * @retval #CSR_ERROR_SYSTEM System error
359 * @see csr_cs_scan_files_async()
360 * @see csr_cs_scan_dir_async()
361 * @see csr_cs_scan_dirs_async()
362 * @see csr_cs_cancel_scanning()
364 int csr_cs_set_cancelled_cb(csr_cs_context_h handle, csr_cs_cancelled_cb callback);
367 * @brief Sets a callback function for scanning stopped with an error.
371 * @remarks Callback for asynchronous scan functions.
373 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
374 * @param[in] callback A callback function for scanning stopped with an error.
376 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
378 * @retval #CSR_ERROR_NONE Successful
379 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
380 * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid
381 * @retval #CSR_ERROR_SYSTEM System error
383 * @see csr_cs_scan_files_async()
384 * @see csr_cs_scan_dir_async()
385 * @see csr_cs_scan_dirs_async()
387 int csr_cs_set_error_cb(csr_cs_context_h handle, csr_cs_error_cb callback);
390 * @brief Scan files specified by an array of file paths for malware.
392 * @details If scanning of the single file is done without detected malware,
393 * csr_cs_file_scanned_cb() called and else if malware detected
394 * csr_cs_detected_cb() called. If scanning is cancelled by
395 * csr_cs_cancel_scanning(), csr_cs_cancelled_cb() called. If scanning is failed
396 * with error, csr_cs_error_cb() is called. If scanning is completed without
397 * error, csr_cs_completed_cb(). Every callbacks are registered by callback
398 * setter methods to @a handle and if callback is not registered, it will just
399 * skipped to be called.
403 * @privilege %http://tizen.org/privilege/antivirus.scan
405 * @remarks Asynchronous function.
406 * @remarks The caller should set callback functions before call this method.
407 * @remarks Detected malware which is provided to the callback will be released when
408 * @a handle is released using csr_cs_context_destroy().
410 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
411 * @param[in] file_paths An array of scan target files.
412 * @param[in] count A number of scan target files.
413 * @param[in] user_data The pointer of a user data. It can be null.
414 * It is delivered back to the client when a callback function
417 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
419 * @retval #CSR_ERROR_NONE Successful
420 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
421 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
422 * @retval #CSR_ERROR_INVALID_PARAMETER @a file_paths is invalid
423 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
424 * @retval #CSR_ERROR_NOT_SUPPORTED Device needed to run API is not supported
425 * @retval #CSR_ERROR_BUSY Busy for processing another request
426 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File not found
427 * @retval #CSR_ERROR_SOCKET Socket error between client and server
428 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
429 * @retval #CSR_ERROR_DB DB transaction error
430 * @retval #CSR_ERROR_ENGINE_PERMISSION Insufficient permission of engine
431 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
432 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
433 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
434 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
435 * @retval #CSR_ERROR_SYSTEM System error
437 * @pre It is required to set callbacks, csr_cs_completed_cb, csr_cs_error_cb(),
438 * csr_cs_cancel_scanning(), csr_cs_detected_cb(), and/or csr_cs_file_scanned_cb().
440 * @see csr_cs_set_file_scanned_cb()
441 * @see csr_cs_set_detected_cb()
442 * @see csr_cs_set_completed_cb()
443 * @see csr_cs_set_cancelled_cb()
444 * @see csr_cs_set_error_cb()
445 * @see csr_cs_cancel_scanning()
447 int csr_cs_scan_files_async(csr_cs_context_h handle, const char *file_paths[],
448 size_t count, void *user_data);
451 * @brief Scans a directory specified by directory path for malware.
453 * @details If scanning of the single file is done without detected malware,
454 * csr_cs_file_scanned_cb() called and else if malware detected
455 * csr_cs_detected_cb() called. If scanning is cancelled by
456 * csr_cs_cancel_scanning(), csr_cs_cancelled_cb() called. If scanning is failed
457 * with error, csr_cs_error_cb() is called. If scanning is completed without
458 * error, csr_cs_completed_cb(). Every callbacks are registered by callback
459 * setter methods to @a handle and if callback is not registered, it will just
460 * skipped to be called.
464 * @privilege %http://tizen.org/privilege/antivirus.scan
466 * @remarks Asynchronous function.
467 * @remarks The caller should set callback functions before calls this method.
468 * @remarks Detected malware which is provided to the callback will be released when
469 * @a handle is released using csr_cs_context_destroy().
471 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
472 * @param[in] dir_path A path of scan target directory.
473 * @param[in] user_data The pointer of a user data. It can be null. It is used on
474 * the callback functions which are registered to @a handle.
476 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
478 * @retval #CSR_ERROR_NONE Successful
479 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
480 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
481 * @retval #CSR_ERROR_INVALID_PARAMETER @a dir_path is invalid
482 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
483 * @retval #CSR_ERROR_NOT_SUPPORTED Device needed to run API is not supported
484 * @retval #CSR_ERROR_BUSY Busy for processing another request
485 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File not found
486 * @retval #CSR_ERROR_FILE_SYSTEM File type is invalid. It should be directory
487 * @retval #CSR_ERROR_SOCKET Socket error between client and server
488 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
489 * @retval #CSR_ERROR_DB DB transaction error
490 * @retval #CSR_ERROR_ENGINE_PERMISSION Insufficient permission of engine
491 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
492 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
493 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
494 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
495 * @retval #CSR_ERROR_SYSTEM System error
497 * @pre It is required to set callbacks, csr_cs_completed_cb, csr_cs_error_cb(),
498 * csr_cs_cancel_scanning(), csr_cs_detected_cb(), and/or csr_cs_file_scanned_cb().
500 * @see csr_cs_set_file_scanned_cb()
501 * @see csr_cs_set_detected_cb()
502 * @see csr_cs_set_completed_cb()
503 * @see csr_cs_set_cancelled_cb()
504 * @see csr_cs_set_error_cb()
505 * @see csr_cs_cancel_scanning()
507 int csr_cs_scan_dir_async(csr_cs_context_h handle, const char *dir_path, void *user_data);
510 * @brief Scan directories specified by an array of directory paths for malware.
512 * @details If scanning of the single file is done without detected malware,
513 * csr_cs_file_scanned_cb() called and else if malware detected
514 * csr_cs_detected_cb() called. If scanning is cancelled by
515 * csr_cs_cancel_scanning(), csr_cs_cancelled_cb() called. If scanning is failed
516 * with error, csr_cs_error_cb() is called. If scanning is completed without
517 * error, csr_cs_completed_cb(). Every callbacks are registered by callback
518 * setter methods to @a handle and if callback is not registered, it will just
519 * skipped to be called.
523 * @privilege %http://tizen.org/privilege/antivirus.scan
525 * @remarks Asynchronous function.
526 * @remarks The caller should set callback functions before calls this method.
527 * @remarks Detected malware which is provided to the callback will be released when
528 * @a handle is released using csr_cs_context_destroy().
530 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
531 * @param[in] dir_paths An array of scan target directories.
532 * @param[in] count A number of scan target directories.
533 * @param[in] user_data The pointer of a user data. It can be null. It is used on
534 * the callback functions which are registered to @a handle.
536 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
538 * @retval #CSR_ERROR_NONE Successful
539 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
540 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
541 * @retval #CSR_ERROR_INVALID_PARAMETER @a dir_paths is invalid
542 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
543 * @retval #CSR_ERROR_NOT_SUPPORTED Device needed to run API is not supported
544 * @retval #CSR_ERROR_BUSY Busy for processing another request
545 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File not found
546 * @retval #CSR_ERROR_FILE_SYSTEM File type is invalid. It should be directory
547 * @retval #CSR_ERROR_SOCKET Socket error between client and server
548 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
549 * @retval #CSR_ERROR_DB DB transaction error
550 * @retval #CSR_ERROR_ENGINE_PERMISSION Insufficient permission of engine
551 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
552 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
553 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
554 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
555 * @retval #CSR_ERROR_SYSTEM System error
557 * @pre It is required to set callbacks, csr_cs_completed_cb, csr_cs_error_cb(),
558 * csr_cs_cancel_scanning(), csr_cs_detected_cb(), and/or csr_cs_file_scanned_cb().
560 * @see csr_cs_set_file_scanned_cb()
561 * @see csr_cs_set_detected_cb()
562 * @see csr_cs_set_completed_cb()
563 * @see csr_cs_set_cancelled_cb()
564 * @see csr_cs_set_error_cb()
565 * @see csr_cs_cancel_scanning()
567 int csr_cs_scan_dirs_async(csr_cs_context_h handle, const char *dir_paths[], size_t count,
572 * @brief Cancels a running scanning task, asynchronously.
576 * @remarks Only for asynchronous scan functions.
578 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
580 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
582 * @retval #CSR_ERROR_NONE Successful
583 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
584 * @retval #CSR_ERROR_NO_TASK No task to cancel
585 * @retval #CSR_ERROR_SYSTEM System error
587 * @see csr_cs_scan_files_async()
588 * @see csr_cs_scan_dir_async()
589 * @see csr_cs_scan_dirs_async()
591 int csr_cs_cancel_scanning(csr_cs_context_h handle);
595 * @brief Extracts the severity of a detected malware from the detected malware handle.
599 * @param[in] malware A detected malware handle returned by csr_cs_scan_data(),
600 * csr_cs_scan_file() or csr_cs_malware_list_get_malware().
601 * @param[out] severity A pointer of the severity of a detected malware.
603 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
605 * @retval #CSR_ERROR_NONE Successful
606 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
607 * @retval #CSR_ERROR_INVALID_PARAMETER @a severity is invalid
608 * @retval #CSR_ERROR_SYSTEM System error
610 int csr_cs_malware_get_severity(csr_cs_malware_h malware,
611 csr_cs_severity_level_e *severity);
614 * @brief Extracts the name of a detected malware from the detected malware handle.
618 * @remarks The @a name must be released using free().
620 * @param[in] malware A detected malware handle.
621 * @param[out] name A pointer of the name of a detected malware.
623 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
625 * @retval #CSR_ERROR_NONE Successful
626 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
627 * @retval #CSR_ERROR_INVALID_PARAMETER @a name is invalid
628 * @retval #CSR_ERROR_SYSTEM System error
630 int csr_cs_malware_get_name(csr_cs_malware_h malware, char **name);
633 * @brief Extracts an url that contains detailed information on vendor's web site from
634 * the detected malware handle.
638 * @remarks The @a detailed_url must be released using free().
640 * @param[in] malware A detected malware handle.
641 * @param[out] detailed_url A pointer of an url that contains detailed information on
642 * vendor's web site. It can be null if a vendor doesn't
643 * provide this information.
645 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
647 * @retval #CSR_ERROR_NONE Successful
648 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
649 * @retval #CSR_ERROR_INVALID_PARAMETER @a detailed_url is invalid.
650 * @retval #CSR_ERROR_SYSTEM System error
652 int csr_cs_malware_get_detailed_url(csr_cs_malware_h malware, char **detailed_url);
655 * @brief Extracts the time stamp when a malware is detected from the detected malware
660 * @param[in] malware A detected malware handle.
661 * @param[out] timestamp A pointer of the time stamp in milli second when a malware is
664 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
666 * @retval #CSR_ERROR_NONE Successful
667 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
668 * @retval #CSR_ERROR_INVALID_PARAMETER @a timestamp is invalid
669 * @retval #CSR_ERROR_SYSTEM System error
671 int csr_cs_malware_get_timestamp(csr_cs_malware_h malware, time_t *timestamp);
674 * @brief Extracts the file name where a malware is detected from the detected malware
679 * @remarks The @a file_name must be released using free().
681 * @param[in] malware A detected malware handle.
682 * @param[out] file_name A pointer of the file name where a malware is detected. The
683 * file name is null for csr_cs_scan_data().
685 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
687 * @retval #CSR_ERROR_NONE Successful
688 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
689 * @retval #CSR_ERROR_INVALID_PARAMETER @a file_name is invalid
690 * @retval #CSR_ERROR_SYSTEM System error
692 int csr_cs_malware_get_file_name(csr_cs_malware_h malware, char **file_name);
695 * @brief Extracts a user response of a popup from the detected malware handle.
699 * @param[in] malware A detected malware handle.
700 * @param[out] response A pointer of the user response.
702 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
704 * @retval #CSR_ERROR_NONE Successful
705 * @retval #CSR_ERROR_INVALID_HANDLE Invalid result handle
706 * @retval #CSR_ERROR_INVALID_PARAMETER @a response is invalid
707 * @retval #CSR_ERROR_SYSTEM System error
709 int csr_cs_malware_get_user_response(csr_cs_malware_h malware,
710 csr_cs_user_response_e *response);
713 * @brief Checks if a malware was detected in an application or in a file.
717 * @param[in] malware A detected malware handle.
718 * @param[out] is_app A pointer of a flag indicating the position a malware was detected.
720 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
722 * @retval #CSR_ERROR_NONE Successful
723 * @retval #CSR_ERROR_INVALID_HANDLE Invalid result handle
724 * @retval #CSR_ERROR_INVALID_PARAMETER @a is_app is invalid
725 * @retval #CSR_ERROR_SYSTEM System error
727 int csr_cs_malware_is_app(csr_cs_malware_h malware, bool *is_app);
730 * @brief Extracts the package id of an application where a malware is detected from
731 * detected malware handle.
735 * @remarks The @a pkg_id must be released using free().
737 * @param[in] malware A detected malware handle.
738 * @param[out] pkg_id A pointer of the package id where a malware is detected.
739 * It is null when a malware was not detected in an application.
741 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
743 * @retval #CSR_ERROR_NONE Successful
744 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
745 * @retval #CSR_ERROR_INVALID_PARAMETER @a pkg_id is invalid
746 * @retval #CSR_ERROR_SYSTEM System error
748 int csr_cs_malware_get_pkg_id(csr_cs_malware_h malware, char **pkg_id);
751 * @brief Judges how a detected malware file is handled.
753 * @details Detected malware will removed by #CSR_CS_ACTION_REMOVE action. File or
754 * application which contains malware will be removed.
755 * Detected malware will ignored by #CSR_CS_ACTION_IGNORE action. File or
756 * application which contains malware will be ignored and will not be treated
757 * as malware until this API called with #CSR_CS_ACTION_UNIGNORE action.
760 * @privlevel platform
761 * @privilege %http://tizen.org/privilege/antivirus.admin
763 * @remarks Detected malware can be removed or ignored.
765 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
766 * @param[in] malware A handle of a detected malware.
767 * @param[in] action An action to be taken.
769 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
771 * @retval #CSR_ERROR_NONE Successful
772 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
773 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
774 * @retval #CSR_ERROR_INVALID_PARAMETER @a malware or @a action is invalid
775 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
776 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File to take action on not found
777 * @retval #CSR_ERROR_FILE_CHANGED File to take action on changed after detection
778 * @retval #CSR_ERROR_SOCKET Socket error between client and server
779 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
780 * @retval #CSR_ERROR_DB DB transaction error
781 * @retval #CSR_ERROR_SYSTEM System error
783 int csr_cs_judge_detected_malware(csr_cs_context_h handle, csr_cs_malware_h malware,
784 csr_cs_action_e action);
788 * @brief Gets information on a detected malware file specified by file path.
792 * @privilege %http://tizen.org/privilege/antivirus.scan
794 * @remarks The @a malware will be released when @a handle is destroyed.
795 * @remarks @a file_path will be null if it's result of csr_cs_scan_data().
797 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
798 * @param[in] file_path A path of a detected malware file.
799 * @param[out] malware A pointer of the detected malware handle. It can be null when
802 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
804 * @retval #CSR_ERROR_NONE Successful
805 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
806 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
807 * @retval #CSR_ERROR_INVALID_PARAMETER @a file_path or @a malware is invalid
808 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
809 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No malware file
810 * @retval #CSR_ERROR_SOCKET Socket error between client and server
811 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
812 * @retval #CSR_ERROR_DB DB transaction error
813 * @retval #CSR_ERROR_SYSTEM System error
815 * @see csr_cs_scan_data()
816 * @see csr_cs_scan_file()
817 * @see csr_cs_detected_cb
819 int csr_cs_get_detected_malware(csr_cs_context_h handle, const char *file_path,
820 csr_cs_malware_h *malware);
823 * @brief Gets information on a detected malware files specified by directory path.
827 * @privilege %http://tizen.org/privilege/antivirus.scan
829 * @remarks The @a list will be released when @a handle is destroyed.
831 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
832 * @param[in] dir_paths A directory path where detected malware files exists.
833 * @param[in] count Count of array element of @a dir_paths
834 * @param[out] list A pointer of the detected malware list handle. It can be null
835 * when no malware file.
836 * @param[out] list_count Count of detected malware files which existed in the specified
839 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
841 * @retval #CSR_ERROR_NONE Successful
842 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
843 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
844 * @retval #CSR_ERROR_INVALID_PARAMETER @a dir_paths, @a list, or @a count is invalid
845 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
846 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No malware file
847 * @retval #CSR_ERROR_SOCKET Socket error between client and server
848 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
849 * @retval #CSR_ERROR_DB DB transaction error
850 * @retval #CSR_ERROR_SYSTEM System error
852 int csr_cs_get_detected_malwares(csr_cs_context_h handle, const char *dir_paths[],
853 size_t count, csr_cs_malware_list_h *list,
857 * @brief Gets information on a ignored malware file specified by file path.
861 * @privilege %http://tizen.org/privilege/antivirus.scan
863 * @remarks The @a malware will be released when @a handle is destroyed.
865 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
866 * @param[in] file_path A path of a ignored malware file.
867 * @param[out] malware A pointer of the detected malware handle. It can be null when
870 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
872 * @retval #CSR_ERROR_NONE Successful
873 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
874 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
875 * @retval #CSR_ERROR_INVALID_PARAMETER @a file_path or @a malware is invalid
876 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
877 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No ignored file
878 * @retval #CSR_ERROR_SOCKET Socket error between client and server
879 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
880 * @retval #CSR_ERROR_DB DB transaction error
881 * @retval #CSR_ERROR_SYSTEM System error
883 int csr_cs_get_ignored_malware(csr_cs_context_h handle, const char *file_path,
884 csr_cs_malware_h *malware);
887 * @brief Gets information on a ignored malware files specified by directory path.
891 * @privilege %http://tizen.org/privilege/antivirus.scan
893 * @remarks The @a list will be released when @a handle is destroyed.
895 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
896 * @param[in] dir_paths A directory path where ignored malware files exists.
897 * @param[in] count Count of array element of @a dir_paths
898 * @param[out] list A pointer of the detected malware list handle. It can be null
899 * when no ignored file.
900 * @param[out] list_count Count of ignored malware files which existed in the specified
903 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
905 * @retval #CSR_ERROR_NONE Successful
906 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
907 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
908 * @retval #CSR_ERROR_INVALID_PARAMETER @a dir_paths, @a list, or @a count is invalid
909 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
910 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No ignored file
911 * @retval #CSR_ERROR_SOCKET Socket error between client and server
912 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
913 * @retval #CSR_ERROR_DB DB transaction error
914 * @retval #CSR_ERROR_SYSTEM System error
916 int csr_cs_get_ignored_malwares(csr_cs_context_h handle, const char *dir_paths[],
917 size_t count, csr_cs_malware_list_h *list,
921 * @brief Extracts the detected malware handle from the detected malware list handle.
925 * @remarks The @a malware will be released when a context is released using
926 * csr_cs_context_destroy().
928 * @param[in] list A detected malware list handle returned by
929 * csr_cs_get_detected_malwares() or
930 * csr_cs_get_ignored_malwares().
931 * @param[in] index An index of a target detected malware handle to get.
932 * @param[out] malware A pointer of the detected malware handle. It can be null when
935 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
937 * @retval #CSR_ERROR_NONE Successful
938 * @retval #CSR_ERROR_INVALID_HANDLE Invalid list
939 * @retval #CSR_ERROR_INVALID_PARAMETER @a index or @a malware is invalid.
940 * @retval #CSR_ERROR_SYSTEM System error
942 int csr_cs_malware_list_get_malware(csr_cs_malware_list_h list, size_t index,
943 csr_cs_malware_h *malware);