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 is set, a popup will be prompted to a user when a malware
87 * is detected. If #CSR_CS_NOT_ASK_USER 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_NOT_ASK_USER) 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_USE_CORE_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 If an engine does not support "scanning on cloud", this option is silently
168 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
170 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
172 * @retval #CSR_ERROR_NONE Successful
173 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
174 * @retval #CSR_ERROR_SYSTEM System error
176 * @see csr_cs_context_create()
177 * @see csr_cs_context_destroy()
179 int csr_cs_set_scan_on_cloud(csr_cs_context_h handle);
182 * @brief Scans a data buffer for malware.
184 * @details @a malware result of this method is not available for being judged by
185 * csr_cs_judge_detected_malware() because it's data, not file, so cannot being
186 * removed or ignored.
190 * @privilege %http://tizen.org/privilege/antivirus.scan
192 * @remarks Scan data synchronously.
193 * @remarks The @a malware will be released when @a handle is released using
194 * csr_cs_context_destroy().
196 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
197 * @param[in] data A scan target data.
198 * @param[in] length A size of a scan target data.
199 * @param[out] malware A pointer of the detected malware handle. It can be null when
200 * no malware detected.
202 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
204 * @retval #CSR_ERROR_NONE Successful
205 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
206 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
207 * @retval #CSR_ERROR_INVALID_PARAMETER @a data or @a malware is invalid
208 * @retval #CSR_ERROR_PERMISSION_DENIED No privilege to call
209 * @retval #CSR_ERROR_NOT_SUPPORTED Device needed to run API is not supported
210 * @retval #CSR_ERROR_SOCKET Socket error between client and server
211 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
212 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
213 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
214 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
215 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
216 * @retval #CSR_ERROR_SYSTEM System error
218 * @see csr_cs_context_create()
219 * @see csr_cs_context_destroy()
221 int csr_cs_scan_data(csr_cs_context_h handle, const unsigned char *data, size_t length,
222 csr_cs_malware_h *malware);
225 * @brief Scans a file specified by file path for malware.
229 * @privilege %http://tizen.org/privilege/antivirus.scan
231 * @remarks Scan file synchronously.
232 * @remarks The @a malware will be released when @a handle is released using
233 * csr_cs_context_destroy().
235 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
236 * @param[in] file_path A path of scan target file.
237 * @param[out] malware A pointer of the detected malware handle. It can be null when
238 * no malware detected.
240 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
242 * @retval #CSR_ERROR_NONE Successful
243 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
244 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
245 * @retval #CSR_ERROR_INVALID_PARAMETER @a file_path or @a malware is invalid
246 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
247 * @retval #CSR_ERROR_NOT_SUPPORTED Device needed to run API is not supported
248 * @retval #CSR_ERROR_DB DB transaction error
249 * @retval #CSR_ERROR_REMOVE_FAILED File remove failed when malware exist and
250 * user select to remove by popup. @a malware
251 * will be allocated on this error unlike others.
252 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File not found
253 * @retval #CSR_ERROR_SOCKET Socket error between client and server
254 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
255 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
256 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
257 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
258 * @retval #CSR_ERROR_ENGINE_PERMISSION Insufficient permission of engine
259 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
260 * @retval #CSR_ERROR_SYSTEM System error
262 * @see csr_cs_context_create()
263 * @see csr_cs_context_destroy()
265 int csr_cs_scan_file(csr_cs_context_h handle, const char *file_path,
266 csr_cs_malware_h *malware);
269 * @brief Sets a callback function for the case that a file scan is completed.
273 * @remarks Callback for asynchronous scan functions.
275 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
276 * @param[in] callback A callback function for each file or application scanning
277 * done without any malware.
279 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
281 * @retval #CSR_ERROR_NONE Successful
282 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
283 * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid
284 * @retval #CSR_ERROR_SYSTEM System error
286 * @see csr_cs_scan_files_async()
287 * @see csr_cs_scan_dir_async()
288 * @see csr_cs_scan_dirs_async()
290 int csr_cs_set_file_scanned_cb(csr_cs_context_h handle, csr_cs_file_scanned_cb callback);
293 * @brief Sets a callback function for detection of a malware.
297 * @remarks Callback for asynchronous scan functions.
299 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
300 * @param[in] callback A callback function for each file or application scanning done
301 * with malware detected.
303 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
305 * @retval #CSR_ERROR_NONE Successful
306 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
307 * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid
308 * @retval #CSR_ERROR_SYSTEM System error
310 * @see csr_cs_scan_files_async()
311 * @see csr_cs_scan_dir_async()
312 * @see csr_cs_scan_dirs_async()
314 int csr_cs_set_detected_cb(csr_cs_context_h handle, csr_cs_detected_cb callback);
317 * @brief Sets a callback function for scanning completed without an error.
321 * @remarks Callback for asynchronous scan functions.
323 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
324 * @param[in] callback A callback function for scanning completed successfully.
326 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
328 * @retval #CSR_ERROR_NONE Successful
329 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
330 * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid
331 * @retval #CSR_ERROR_SYSTEM System error
333 * @see csr_cs_scan_files_async()
334 * @see csr_cs_scan_dir_async()
335 * @see csr_cs_scan_dirs_async()
337 int csr_cs_set_completed_cb(csr_cs_context_h handle, csr_cs_completed_cb callback);
340 * @brief Sets a callback function for scanning cancelled.
344 * @remarks Callback for asynchronous scan functions.
345 * @remarks Client can cancel asynchronous scanning by csr_cs_cancel_scanning().
347 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
348 * @param[in] callback A callback function for scanning cancelled.
350 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
352 * @retval #CSR_ERROR_NONE Successful
353 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
354 * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid
355 * @retval #CSR_ERROR_SYSTEM System error
357 * @see csr_cs_scan_files_async()
358 * @see csr_cs_scan_dir_async()
359 * @see csr_cs_scan_dirs_async()
360 * @see csr_cs_cancel_scanning()
362 int csr_cs_set_cancelled_cb(csr_cs_context_h handle, csr_cs_cancelled_cb callback);
365 * @brief Sets a callback function for scanning stopped with an error.
369 * @remarks Callback for asynchronous scan functions.
371 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
372 * @param[in] callback A callback function for scanning stopped with an error.
374 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
376 * @retval #CSR_ERROR_NONE Successful
377 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
378 * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid
379 * @retval #CSR_ERROR_SYSTEM System error
381 * @see csr_cs_scan_files_async()
382 * @see csr_cs_scan_dir_async()
383 * @see csr_cs_scan_dirs_async()
385 int csr_cs_set_error_cb(csr_cs_context_h handle, csr_cs_error_cb callback);
388 * @brief Scan files specified by an array of file paths for malware.
390 * @details If scanning of the single file is done without detected malware,
391 * csr_cs_file_scanned_cb() called and else if malware detected
392 * csr_cs_detected_cb() called. If scanning is cancelled by
393 * csr_cs_cancel_scanning(), csr_cs_cancelled_cb() called. If scanning is failed
394 * with error, csr_cs_error_cb() is called. If scanning is completed without
395 * error, csr_cs_completed_cb(). Every callbacks are registered by callback
396 * setter methods to @a handle and if callback is not registered, it will just
397 * skipped to be called.
401 * @privilege %http://tizen.org/privilege/antivirus.scan
403 * @remarks Asynchronous function.
404 * @remarks The caller should set callback functions before call this method.
405 * @remarks Detected malware which is provided to the callback will be released when
406 * @a handle is released using csr_cs_context_destroy().
408 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
409 * @param[in] file_paths An array of scan target files.
410 * @param[in] count A number of scan target files.
411 * @param[in] user_data The pointer of a user data. It can be null.
412 * It is delivered back to the client when a callback function
415 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
417 * @retval #CSR_ERROR_NONE Successful
418 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
419 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
420 * @retval #CSR_ERROR_INVALID_PARAMETER @a file_paths is invalid
421 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
422 * @retval #CSR_ERROR_NOT_SUPPORTED Device needed to run API is not supported
423 * @retval #CSR_ERROR_BUSY Busy for processing another request
424 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File not found
425 * @retval #CSR_ERROR_SOCKET Socket error between client and server
426 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
427 * @retval #CSR_ERROR_DB DB transaction error
428 * @retval #CSR_ERROR_ENGINE_PERMISSION Insufficient permission of engine
429 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
430 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
431 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
432 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
433 * @retval #CSR_ERROR_SYSTEM System error
435 * @pre It is required to set callbacks, csr_cs_completed_cb, csr_cs_error_cb(),
436 * csr_cs_cancel_scanning(), csr_cs_detected_cb(), and/or csr_cs_file_scanned_cb().
438 * @see csr_cs_set_file_scanned_cb()
439 * @see csr_cs_set_detected_cb()
440 * @see csr_cs_set_completed_cb()
441 * @see csr_cs_set_cancelled_cb()
442 * @see csr_cs_set_error_cb()
443 * @see csr_cs_cancel_scanning()
445 int csr_cs_scan_files_async(csr_cs_context_h handle, const char *file_paths[],
446 size_t count, void *user_data);
449 * @brief Scans a directory specified by directory path for malware.
451 * @details If scanning of the single file is done without detected malware,
452 * csr_cs_file_scanned_cb() called and else if malware detected
453 * csr_cs_detected_cb() called. If scanning is cancelled by
454 * csr_cs_cancel_scanning(), csr_cs_cancelled_cb() called. If scanning is failed
455 * with error, csr_cs_error_cb() is called. If scanning is completed without
456 * error, csr_cs_completed_cb(). Every callbacks are registered by callback
457 * setter methods to @a handle and if callback is not registered, it will just
458 * skipped to be called.
462 * @privilege %http://tizen.org/privilege/antivirus.scan
464 * @remarks Asynchronous function.
465 * @remarks The caller should set callback functions before calls this method.
466 * @remarks Detected malware which is provided to the callback will be released when
467 * @a handle is released using csr_cs_context_destroy().
469 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
470 * @param[in] dir_path A path of scan target directory.
471 * @param[in] user_data The pointer of a user data. It can be null. It is used on
472 * the callback functions which are registered to @a handle.
474 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
476 * @retval #CSR_ERROR_NONE Successful
477 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
478 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
479 * @retval #CSR_ERROR_INVALID_PARAMETER @a dir_path is invalid
480 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
481 * @retval #CSR_ERROR_NOT_SUPPORTED Device needed to run API is not supported
482 * @retval #CSR_ERROR_BUSY Busy for processing another request
483 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File not found
484 * @retval #CSR_ERROR_FILE_SYSTEM File type is invalid. It should be directory
485 * @retval #CSR_ERROR_SOCKET Socket error between client and server
486 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
487 * @retval #CSR_ERROR_DB DB transaction error
488 * @retval #CSR_ERROR_ENGINE_PERMISSION Insufficient permission of engine
489 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
490 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
491 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
492 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
493 * @retval #CSR_ERROR_SYSTEM System error
495 * @pre It is required to set callbacks, csr_cs_completed_cb, csr_cs_error_cb(),
496 * csr_cs_cancel_scanning(), csr_cs_detected_cb(), and/or csr_cs_file_scanned_cb().
498 * @see csr_cs_set_file_scanned_cb()
499 * @see csr_cs_set_detected_cb()
500 * @see csr_cs_set_completed_cb()
501 * @see csr_cs_set_cancelled_cb()
502 * @see csr_cs_set_error_cb()
503 * @see csr_cs_cancel_scanning()
505 int csr_cs_scan_dir_async(csr_cs_context_h handle, const char *dir_path, void *user_data);
508 * @brief Scan directories specified by an array of directory paths for malware.
510 * @details If scanning of the single file is done without detected malware,
511 * csr_cs_file_scanned_cb() called and else if malware detected
512 * csr_cs_detected_cb() called. If scanning is cancelled by
513 * csr_cs_cancel_scanning(), csr_cs_cancelled_cb() called. If scanning is failed
514 * with error, csr_cs_error_cb() is called. If scanning is completed without
515 * error, csr_cs_completed_cb(). Every callbacks are registered by callback
516 * setter methods to @a handle and if callback is not registered, it will just
517 * skipped to be called.
521 * @privilege %http://tizen.org/privilege/antivirus.scan
523 * @remarks Asynchronous function.
524 * @remarks The caller should set callback functions before calls this method.
525 * @remarks Detected malware which is provided to the callback will be released when
526 * @a handle is released using csr_cs_context_destroy().
528 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
529 * @param[in] dir_paths An array of scan target directories.
530 * @param[in] count A number of scan target directories.
531 * @param[in] user_data The pointer of a user data. It can be null. It is used on
532 * the callback functions which are registered to @a handle.
534 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
536 * @retval #CSR_ERROR_NONE Successful
537 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
538 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
539 * @retval #CSR_ERROR_INVALID_PARAMETER @a dir_paths is invalid
540 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
541 * @retval #CSR_ERROR_NOT_SUPPORTED Device needed to run API is not supported
542 * @retval #CSR_ERROR_BUSY Busy for processing another request
543 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File not found
544 * @retval #CSR_ERROR_FILE_SYSTEM File type is invalid. It should be directory
545 * @retval #CSR_ERROR_SOCKET Socket error between client and server
546 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
547 * @retval #CSR_ERROR_DB DB transaction error
548 * @retval #CSR_ERROR_ENGINE_PERMISSION Insufficient permission of engine
549 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
550 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
551 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
552 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
553 * @retval #CSR_ERROR_SYSTEM System error
555 * @pre It is required to set callbacks, csr_cs_completed_cb, csr_cs_error_cb(),
556 * csr_cs_cancel_scanning(), csr_cs_detected_cb(), and/or csr_cs_file_scanned_cb().
558 * @see csr_cs_set_file_scanned_cb()
559 * @see csr_cs_set_detected_cb()
560 * @see csr_cs_set_completed_cb()
561 * @see csr_cs_set_cancelled_cb()
562 * @see csr_cs_set_error_cb()
563 * @see csr_cs_cancel_scanning()
565 int csr_cs_scan_dirs_async(csr_cs_context_h handle, const char *dir_paths[], size_t count,
570 * @brief Cancels a running scanning task, asynchronously.
574 * @remarks Only for asynchronous scan functions.
576 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
578 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
580 * @retval #CSR_ERROR_NONE Successful
581 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
582 * @retval #CSR_ERROR_NO_TASK No task to cancel
583 * @retval #CSR_ERROR_SYSTEM System error
585 * @see csr_cs_scan_files_async()
586 * @see csr_cs_scan_dir_async()
587 * @see csr_cs_scan_dirs_async()
589 int csr_cs_cancel_scanning(csr_cs_context_h handle);
593 * @brief Extracts the severity of a detected malware from the detected malware handle.
597 * @param[in] malware A detected malware handle returned by csr_cs_scan_data(),
598 * csr_cs_scan_file() or csr_cs_malware_list_get_malware().
599 * @param[out] severity A pointer of the severity of a detected malware.
601 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
603 * @retval #CSR_ERROR_NONE Successful
604 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
605 * @retval #CSR_ERROR_INVALID_PARAMETER @a severity is invalid
606 * @retval #CSR_ERROR_SYSTEM System error
608 int csr_cs_malware_get_severity(csr_cs_malware_h malware,
609 csr_cs_severity_level_e *severity);
612 * @brief Extracts the name of a detected malware from the detected malware handle.
616 * @remarks The @a name must be released using free().
618 * @param[in] malware A detected malware handle.
619 * @param[out] name A pointer of the name of a detected malware.
621 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
623 * @retval #CSR_ERROR_NONE Successful
624 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
625 * @retval #CSR_ERROR_INVALID_PARAMETER @a name is invalid
626 * @retval #CSR_ERROR_SYSTEM System error
628 int csr_cs_malware_get_name(csr_cs_malware_h malware, char **name);
631 * @brief Extracts an url that contains detailed information on vendor's web site from
632 * the detected malware handle.
636 * @remarks The @a detailed_url must be released using free().
638 * @param[in] malware A detected malware handle.
639 * @param[out] detailed_url A pointer of an url that contains detailed information on
640 * vendor's web site. It can be null if a vendor doesn't
641 * provide this information.
643 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
645 * @retval #CSR_ERROR_NONE Successful
646 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
647 * @retval #CSR_ERROR_INVALID_PARAMETER @a detailed_url is invalid.
648 * @retval #CSR_ERROR_SYSTEM System error
650 int csr_cs_malware_get_detailed_url(csr_cs_malware_h malware, char **detailed_url);
653 * @brief Extracts the time stamp when a malware is detected from the detected malware
658 * @param[in] malware A detected malware handle.
659 * @param[out] timestamp A pointer of the time stamp in milli second when a malware is
662 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
664 * @retval #CSR_ERROR_NONE Successful
665 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
666 * @retval #CSR_ERROR_INVALID_PARAMETER @a timestamp is invalid
667 * @retval #CSR_ERROR_SYSTEM System error
669 int csr_cs_malware_get_timestamp(csr_cs_malware_h malware, time_t *timestamp);
672 * @brief Extracts the file name where a malware is detected from the detected malware
677 * @remarks The @a file_name must be released using free().
679 * @param[in] malware A detected malware handle.
680 * @param[out] file_name A pointer of the file name where a malware is detected. The
681 * file name is null for csr_cs_scan_data().
683 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
685 * @retval #CSR_ERROR_NONE Successful
686 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
687 * @retval #CSR_ERROR_INVALID_PARAMETER @a file_name is invalid
688 * @retval #CSR_ERROR_SYSTEM System error
690 int csr_cs_malware_get_file_name(csr_cs_malware_h malware, char **file_name);
693 * @brief Extracts a user response of a popup from the detected malware handle.
697 * @param[in] malware A detected malware handle.
698 * @param[out] response A pointer of the user response.
700 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
702 * @retval #CSR_ERROR_NONE Successful
703 * @retval #CSR_ERROR_INVALID_HANDLE Invalid result handle
704 * @retval #CSR_ERROR_INVALID_PARAMETER @a response is invalid
705 * @retval #CSR_ERROR_SYSTEM System error
707 int csr_cs_malware_get_user_response(csr_cs_malware_h malware,
708 csr_cs_user_response_e *response);
711 * @brief Checks if a malware was detected in an application or in a file.
715 * @param[in] malware A detected malware handle.
716 * @param[out] is_app A pointer of a flag indicating the position a malware was detected.
718 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
720 * @retval #CSR_ERROR_NONE Successful
721 * @retval #CSR_ERROR_INVALID_HANDLE Invalid result handle
722 * @retval #CSR_ERROR_INVALID_PARAMETER @a is_app is invalid
723 * @retval #CSR_ERROR_SYSTEM System error
725 int csr_cs_malware_is_app(csr_cs_malware_h malware, bool *is_app);
728 * @brief Extracts the package id of an application where a malware is detected from
729 * detected malware handle.
733 * @remarks The @a pkg_id must be released using free().
735 * @param[in] malware A detected malware handle.
736 * @param[out] pkg_id A pointer of the package id where a malware is detected.
737 * It is null when a malware was not detected in an application.
739 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
741 * @retval #CSR_ERROR_NONE Successful
742 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
743 * @retval #CSR_ERROR_INVALID_PARAMETER @a pkg_id is invalid
744 * @retval #CSR_ERROR_SYSTEM System error
746 int csr_cs_malware_get_pkg_id(csr_cs_malware_h malware, char **pkg_id);
749 * @brief Judges how a detected malware file is handled.
751 * @details Detected malware will removed by #CSR_CS_ACTION_REMOVE action. File or
752 * application which contains malware will be removed.
753 * Detected malware will ignored by #CSR_CS_ACTION_IGNORE action. File or
754 * application which contains malware will be ignored and will not be treated
755 * as malware until this API called with #CSR_CS_ACTION_UNIGNORE action.
758 * @privlevel platform
759 * @privilege %http://tizen.org/privilege/antivirus.admin
761 * @remarks Detected malware can be removed or ignored.
763 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
764 * @param[in] malware A handle of a detected malware.
765 * @param[in] action An action to be taken.
767 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
769 * @retval #CSR_ERROR_NONE Successful
770 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
771 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
772 * @retval #CSR_ERROR_INVALID_PARAMETER @a malware or @a action is invalid
773 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
774 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File to take action on not found
775 * @retval #CSR_ERROR_FILE_CHANGED File to take action on changed after detection
776 * @retval #CSR_ERROR_SOCKET Socket error between client and server
777 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
778 * @retval #CSR_ERROR_DB DB transaction error
779 * @retval #CSR_ERROR_SYSTEM System error
781 int csr_cs_judge_detected_malware(csr_cs_context_h handle, csr_cs_malware_h malware,
782 csr_cs_action_e action);
786 * @brief Gets information on a detected malware file specified by file path.
790 * @privilege %http://tizen.org/privilege/antivirus.scan
792 * @remarks The @a malware will be released when @a handle is destroyed.
793 * @remarks @a file_path will be null if it's result of csr_cs_scan_data().
795 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
796 * @param[in] file_path A path of a detected malware file.
797 * @param[out] malware A pointer of the detected malware handle. It can be null when
800 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
802 * @retval #CSR_ERROR_NONE Successful
803 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
804 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
805 * @retval #CSR_ERROR_INVALID_PARAMETER @a file_path or @a malware is invalid
806 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
807 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No malware file
808 * @retval #CSR_ERROR_SOCKET Socket error between client and server
809 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
810 * @retval #CSR_ERROR_DB DB transaction error
811 * @retval #CSR_ERROR_SYSTEM System error
813 * @see csr_cs_scan_data()
814 * @see csr_cs_scan_file()
815 * @see csr_cs_detected_cb
817 int csr_cs_get_detected_malware(csr_cs_context_h handle, const char *file_path,
818 csr_cs_malware_h *malware);
821 * @brief Gets information on a detected malware files specified by directory path.
825 * @privilege %http://tizen.org/privilege/antivirus.scan
827 * @remarks The @a list will be released when @a handle is destroyed.
829 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
830 * @param[in] dir_paths A directory path where detected malware files exists.
831 * @param[in] count Count of array element of @a dir_paths
832 * @param[out] list A pointer of the detected malware list handle. It can be null
833 * when no malware file.
834 * @param[out] list_count Count of detected malware files which existed in the specified
837 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
839 * @retval #CSR_ERROR_NONE Successful
840 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
841 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
842 * @retval #CSR_ERROR_INVALID_PARAMETER @a dir_paths, @a list, or @a count is invalid
843 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
844 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No malware file
845 * @retval #CSR_ERROR_SOCKET Socket error between client and server
846 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
847 * @retval #CSR_ERROR_DB DB transaction error
848 * @retval #CSR_ERROR_SYSTEM System error
850 int csr_cs_get_detected_malwares(csr_cs_context_h handle, const char *dir_paths[],
851 size_t count, csr_cs_malware_list_h *list,
855 * @brief Gets information on a ignored malware file specified by file path.
859 * @privilege %http://tizen.org/privilege/antivirus.scan
861 * @remarks The @a malware will be released when @a handle is destroyed.
863 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
864 * @param[in] file_path A path of a ignored malware file.
865 * @param[out] malware A pointer of the detected malware handle. It can be null when
868 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
870 * @retval #CSR_ERROR_NONE Successful
871 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
872 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
873 * @retval #CSR_ERROR_INVALID_PARAMETER @a file_path or @a malware is invalid
874 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
875 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No ignored file
876 * @retval #CSR_ERROR_SOCKET Socket error between client and server
877 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
878 * @retval #CSR_ERROR_DB DB transaction error
879 * @retval #CSR_ERROR_SYSTEM System error
881 int csr_cs_get_ignored_malware(csr_cs_context_h handle, const char *file_path,
882 csr_cs_malware_h *malware);
885 * @brief Gets information on a ignored malware files specified by directory path.
889 * @privilege %http://tizen.org/privilege/antivirus.scan
891 * @remarks The @a list will be released when @a handle is destroyed.
893 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
894 * @param[in] dir_paths A directory path where ignored malware files exists.
895 * @param[in] count Count of array element of @a dir_paths
896 * @param[out] list A pointer of the detected malware list handle. It can be null
897 * when no ignored file.
898 * @param[out] list_count Count of ignored malware files which existed in the specified
901 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
903 * @retval #CSR_ERROR_NONE Successful
904 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
905 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
906 * @retval #CSR_ERROR_INVALID_PARAMETER @a dir_paths, @a list, or @a count is invalid
907 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
908 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No ignored file
909 * @retval #CSR_ERROR_SOCKET Socket error between client and server
910 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
911 * @retval #CSR_ERROR_DB DB transaction error
912 * @retval #CSR_ERROR_SYSTEM System error
914 int csr_cs_get_ignored_malwares(csr_cs_context_h handle, const char *dir_paths[],
915 size_t count, csr_cs_malware_list_h *list,
919 * @brief Extracts the detected malware handle from the detected malware list handle.
923 * @param[in] list A detected malware list handle returned by
924 * csr_cs_get_detected_malwares() or
925 * csr_cs_get_ignored_malwares().
926 * @param[in] index An index of a target detected malware handle to get.
927 * @param[out] malware A pointer of the detected malware handle. It can be null when
930 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
932 * @retval #CSR_ERROR_NONE Successful
933 * @retval #CSR_ERROR_INVALID_HANDLE Invalid list
934 * @retval #CSR_ERROR_INVALID_PARAMETER @a index or @a malware is invalid.
935 * @retval #CSR_ERROR_SYSTEM System error
937 int csr_cs_malware_list_get_malware(csr_cs_malware_list_h list, size_t index,
938 csr_cs_malware_h *malware);