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_
29 #include <csr-content-screening-types.h>
30 #include <csr-error.h>
37 * @addtogroup CAPI_CSR_FRAMEWORK_CS_MODULE
43 * @brief Initializes and returns a Content Screening API handle.
47 * @remarks The @a handle should be released using csr_cs_context_destroy().
48 * @remarks Multiple handles can be obtained.
50 * @details A Content Screening API handle (or CSR CS handle) is obtained by this method.
51 * The handle is required for subsequent CSR CS API calls.
53 * @param[out] handle A pointer of CSR CS context handle.
55 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
57 * @retval #CSR_ERROR_NONE Successful
58 * @retval #CSR_ERROR_INVALID_HANDLE @a handle may be null
59 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
60 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
62 * @see csr_cs_context_destroy()
64 int csr_cs_context_create(csr_cs_context_h *handle);
67 * @brief Releases all system resources associated with a Content Screening API handle.
71 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
73 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
75 * @retval #CSR_ERROR_NONE Successful
76 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
77 * @retval #CSR_ERROR_SOCKET Socket error between client and server
78 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
80 * @see csr_cs_context_create()
82 int csr_cs_context_destroy(csr_cs_context_h handle);
85 * @brief Sets a popup option for malware detected.
89 * @remarks This option is disabled(#CSR_CS_NOT_ASK_USER) as a default.
91 * @details If #CSR_CS_ASK_USER is set, a popup will be prompted to a user when a malware
92 * is detected. If #CSR_CS_NOT_ASK_USER is set which is default value, no popup
93 * will be prompted even if a malware is detected. User can allow, disallow and
94 * remove detected malware by popup. Selection can be different between malware's
97 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
98 * @param[in] ask_user Popup option to set or unset.
100 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
102 * @retval #CSR_ERROR_NONE Successful
103 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
104 * @retval #CSR_ERROR_INVALID_PARAMETER @a ask_user is invalid
105 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
107 * @see csr_cs_context_create()
108 * @see csr_cs_context_destroy()
110 int csr_cs_set_ask_user(csr_cs_context_h handle, csr_cs_ask_user_e ask_user);
113 * @brief Sets a popup message of a client in case that a malware is detected.
117 * @remarks Meaningful only when ask user option is set by csr_cs_set_ask_user().
118 * @remarks The message will be printed on popup for user.
119 * @remarks Default popup message will be used if it isn't set.
121 * @details Default message is "Malware which may harm your device is detected.".
123 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
124 * @param[in] message A message to print on a popup.
126 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
128 * @retval #CSR_ERROR_NONE Successful
129 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
130 * @retval #CSR_ERROR_INVALID_PARAMETER @a message is too long or empty. Max size
132 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
134 * @see csr_cs_context_create()
135 * @see csr_cs_context_destroy()
137 int csr_cs_set_popup_message(csr_cs_context_h handle, const char *message);
140 * @brief Sets a maximum core usage during scanning.
144 * @remarks If a core usage is not set, #CSR_CS_USE_CORE_DEFAULT will be used.
146 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
147 * @param[in] usage A maximum core usage during scanning.
149 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
151 * @retval #CSR_ERROR_NONE Successful
152 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
153 * @retval #CSR_ERROR_INVALID_PARAMETER @a usage is invalid
154 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
156 * @see csr_cs_context_create()
157 * @see csr_cs_context_destroy()
159 int csr_cs_set_core_usage(csr_cs_context_h handle, csr_cs_core_usage_e usage);
162 * @brief Sets a scan on cloud option.
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().
171 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
173 * @retval #CSR_ERROR_NONE Successful
174 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
175 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
177 * @see csr_cs_context_create()
178 * @see csr_cs_context_destroy()
180 int csr_cs_set_scan_on_cloud(csr_cs_context_h handle);
183 * @brief Scans a data buffer for malware.
187 * @privilege %http://tizen.org/privilege/antivirus.scan
189 * @remarks Scan data synchronously.
190 * @remarks The @a malware will be released when @a handle is released using
191 * csr_cs_context_destroy().
193 * @details @a malware result of this method is not available for being judged by
194 * csr_cs_judge_detected_malware() because it's data, not file, so cannot being
195 * removed or ignored.
197 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
198 * @param[in] data A scan target data.
199 * @param[in] length A size of a scan target data.
200 * @param[out] malware A pointer of the detected malware handle. It can be null when
201 * no malware detected.
203 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
205 * @retval #CSR_ERROR_NONE Successful
206 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
207 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
208 * @retval #CSR_ERROR_INVALID_PARAMETER @a data or @a malware is invalid
209 * @retval #CSR_ERROR_PERMISSION_DENIED No privilege to call
210 * @retval #CSR_ERROR_NOT_SUPPORTED Device needed to run API is not supported
211 * @retval #CSR_ERROR_SOCKET Socket error between client and server
212 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
213 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
214 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
215 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
216 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
217 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
219 * @see csr_cs_context_create()
220 * @see csr_cs_context_destroy()
222 int csr_cs_scan_data(csr_cs_context_h handle, const unsigned char *data, size_t length,
223 csr_cs_malware_h *malware);
226 * @brief Scans a file specified by file path for malware.
230 * @privilege %http://tizen.org/privilege/antivirus.scan
232 * @remarks Scan file synchronously.
233 * @remarks The @a malware will be released when @a handle is released using
234 * csr_cs_context_destroy().
236 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
237 * @param[in] file_path A path of scan target file.
238 * @param[out] malware A pointer of the detected malware handle. It can be null when
239 * no malware detected.
241 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
243 * @retval #CSR_ERROR_NONE Successful
244 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
245 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
246 * @retval #CSR_ERROR_INVALID_PARAMETER @a file_path or @a malware is invalid
247 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
248 * @retval #CSR_ERROR_NOT_SUPPORTED Device needed to run API is not supported
249 * @retval #CSR_ERROR_DB DB transaction error
250 * @retval #CSR_ERROR_REMOVE_FAILED File remove failed when malware exist and
251 * user select to remove by popup. @a malware
252 * will be allocated on this error unlike others.
253 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File not found
254 * @retval #CSR_ERROR_SOCKET Socket error between client and server
255 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
256 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
257 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
258 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
259 * @retval #CSR_ERROR_ENGINE_PERMISSION Insufficient permission of engine
260 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
261 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
263 * @see csr_cs_context_create()
264 * @see csr_cs_context_destroy()
266 int csr_cs_scan_file(csr_cs_context_h handle, const char *file_path,
267 csr_cs_malware_h *malware);
270 * @brief Sets a callback function for the case that a file scan is completed.
274 * @remarks Callback for asynchronous scan functions.
276 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
277 * @param[in] callback A callback function for each file or application scanning
278 * done without any malware.
280 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
282 * @retval #CSR_ERROR_NONE Successful
283 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
284 * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid
285 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
287 * @see csr_cs_scan_files_async()
288 * @see csr_cs_scan_dir_async()
289 * @see csr_cs_scan_dirs_async()
291 int csr_cs_set_file_scanned_cb(csr_cs_context_h handle, csr_cs_file_scanned_cb callback);
294 * @brief Sets a callback function for detection of a malware.
298 * @remarks Callback for asynchronous scan functions.
300 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
301 * @param[in] callback A callback function for each file or application scanning done
302 * with malware detected.
304 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
306 * @retval #CSR_ERROR_NONE Successful
307 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
308 * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid
309 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
311 * @see csr_cs_scan_files_async()
312 * @see csr_cs_scan_dir_async()
313 * @see csr_cs_scan_dirs_async()
315 int csr_cs_set_detected_cb(csr_cs_context_h handle, csr_cs_detected_cb callback);
318 * @brief Sets a callback function for scanning completed without an error.
322 * @remarks Callback for asynchronous scan functions.
324 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
325 * @param[in] callback A callback function for scanning completed successfully.
327 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
329 * @retval #CSR_ERROR_NONE Successful
330 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
331 * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid
332 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
334 * @see csr_cs_scan_files_async()
335 * @see csr_cs_scan_dir_async()
336 * @see csr_cs_scan_dirs_async()
338 int csr_cs_set_completed_cb(csr_cs_context_h handle, csr_cs_completed_cb callback);
341 * @brief Sets a callback function for scanning cancelled.
345 * @remarks Callback for asynchronous scan functions.
346 * @remarks Client can cancel asynchronous scanning by csr_cs_cancel_scanning().
348 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
349 * @param[in] callback A callback function for scanning cancelled.
351 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
353 * @retval #CSR_ERROR_NONE Successful
354 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
355 * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid
356 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
358 * @see csr_cs_scan_files_async()
359 * @see csr_cs_scan_dir_async()
360 * @see csr_cs_scan_dirs_async()
361 * @see csr_cs_cancel_scanning()
363 int csr_cs_set_cancelled_cb(csr_cs_context_h handle, csr_cs_cancelled_cb callback);
366 * @brief Sets a callback function for scanning stopped with an error.
370 * @remarks Callback for asynchronous scan functions.
372 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
373 * @param[in] callback A callback function for scanning stopped with an error.
375 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
377 * @retval #CSR_ERROR_NONE Successful
378 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
379 * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid
380 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
382 * @see csr_cs_scan_files_async()
383 * @see csr_cs_scan_dir_async()
384 * @see csr_cs_scan_dirs_async()
386 int csr_cs_set_error_cb(csr_cs_context_h handle, csr_cs_error_cb callback);
389 * @brief Scan files specified by an array of file paths for malware.
393 * @privilege %http://tizen.org/privilege/antivirus.scan
395 * @remarks Asynchronous function.
396 * @remarks The caller should set callback functions before call this method.
397 * @remarks Detected malware which is provided to the callback will be released when
398 * @a handle is released using csr_cs_context_destroy().
400 * @details If scanning of the single file is done without detected malware,
401 * csr_cs_file_scanned_cb() called and else if malware detected
402 * csr_cs_detected_cb() called. If scanning is cancelled by
403 * csr_cs_cancel_scanning(), csr_cs_cancelled_cb() called. If scanning is failed
404 * with error, csr_cs_error_cb() is called. If scanning is completed without
405 * error, csr_cs_completed_cb(). Every callbacks are registered by callback
406 * setter methods to @a handle and if callback is not registered, it will just
407 * skipped to be called.
409 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
410 * @param[in] file_paths An array of scan target files.
411 * @param[in] count A number of scan target files.
412 * @param[in] user_data The pointer of a user data. It can be null.
413 * It is delivered back to the client when a callback function
416 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
418 * @retval #CSR_ERROR_NONE Successful
419 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
420 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
421 * @retval #CSR_ERROR_INVALID_PARAMETER @a file_paths is invalid
422 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
423 * @retval #CSR_ERROR_NOT_SUPPORTED Device needed to run API is not supported
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_UNKNOWN Error with unknown reason
435 * @see csr_cs_set_file_scanned_cb()
436 * @see csr_cs_set_detected_cb()
437 * @see csr_cs_set_completed_cb()
438 * @see csr_cs_set_cancelled_cb()
439 * @see csr_cs_set_error_cb()
440 * @see csr_cs_cancel_scanning()
442 int csr_cs_scan_files_async(csr_cs_context_h handle, const char *file_paths[],
443 size_t count, void *user_data);
446 * @brief Scans a directory specified by directory path for malware.
450 * @privilege %http://tizen.org/privilege/antivirus.scan
452 * @remarks Asynchronous function.
453 * @remarks The caller should set callback functions before calls this method.
454 * @remarks Detected malware which is provided to the callback will be released when
455 * @a handle is released using csr_cs_context_destroy().
457 * @details If scanning of the single file is done without detected malware,
458 * csr_cs_file_scanned_cb() called and else if malware detected
459 * csr_cs_detected_cb() called. If scanning is cancelled by
460 * csr_cs_cancel_scanning(), csr_cs_cancelled_cb() called. If scanning is failed
461 * with error, csr_cs_error_cb() is called. If scanning is completed without
462 * error, csr_cs_completed_cb(). Every callbacks are registered by callback
463 * setter methods to @a handle and if callback is not registered, it will just
464 * skipped to be called.
466 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
467 * @param[in] dir_path A path of scan target directory.
468 * @param[in] user_data The pointer of a user data. It can be null. It is used on
469 * the callback functions which are registered to @a handle.
471 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
473 * @retval #CSR_ERROR_NONE Successful
474 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
475 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
476 * @retval #CSR_ERROR_INVALID_PARAMETER @a dir_path is invalid
477 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
478 * @retval #CSR_ERROR_NOT_SUPPORTED Device needed to run API is not supported
479 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File not found
480 * @retval #CSR_ERROR_FILE_SYSTEM File type is invalid. It should be directory
481 * @retval #CSR_ERROR_SOCKET Socket error between client and server
482 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
483 * @retval #CSR_ERROR_DB DB transaction error
484 * @retval #CSR_ERROR_ENGINE_PERMISSION Insufficient permission of engine
485 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
486 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
487 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
488 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
489 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
491 * @see csr_cs_set_file_scanned_cb()
492 * @see csr_cs_set_detected_cb()
493 * @see csr_cs_set_completed_cb()
494 * @see csr_cs_set_cancelled_cb()
495 * @see csr_cs_set_error_cb()
496 * @see csr_cs_cancel_scanning()
498 int csr_cs_scan_dir_async(csr_cs_context_h handle, const char *dir_path, void *user_data);
501 * @brief Scan directories specified by an array of directory paths for malware.
505 * @privilege %http://tizen.org/privilege/antivirus.scan
507 * @remarks Asynchronous function.
508 * @remarks The caller should set callback functions before calls this method.
509 * @remarks Detected malware which is provided to the callback will be released when
510 * @a handle is released using csr_cs_context_destroy().
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.
521 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
522 * @param[in] dir_paths An array of scan target directories.
523 * @param[in] count A number of scan target directories.
524 * @param[in] user_data The pointer of a user data. It can be null. It is used on
525 * the callback functions which are registered to @a handle.
527 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
529 * @retval #CSR_ERROR_NONE Successful
530 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
531 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
532 * @retval #CSR_ERROR_INVALID_PARAMETER @a dir_paths is invalid
533 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
534 * @retval #CSR_ERROR_NOT_SUPPORTED Device needed to run API is not supported
535 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File not found
536 * @retval #CSR_ERROR_FILE_SYSTEM File type is invalid. It should be directory
537 * @retval #CSR_ERROR_SOCKET Socket error between client and server
538 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
539 * @retval #CSR_ERROR_DB DB transaction error
540 * @retval #CSR_ERROR_ENGINE_PERMISSION Insufficient permission of engine
541 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
542 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
543 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
544 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
545 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
547 * @see csr_cs_set_file_scanned_cb()
548 * @see csr_cs_set_detected_cb()
549 * @see csr_cs_set_completed_cb()
550 * @see csr_cs_set_cancelled_cb()
551 * @see csr_cs_set_error_cb()
552 * @see csr_cs_cancel_scanning()
554 int csr_cs_scan_dirs_async(csr_cs_context_h handle, const char *dir_paths[], size_t count,
559 * @brief Cancels a running scanning task.
563 * @remarks Only for asynchronous scan functions.
565 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
567 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
569 * @retval #CSR_ERROR_NONE Successful
570 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
571 * @retval #CSR_ERROR_NO_TASK No task to cancel
572 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
574 * @see csr_cs_scan_files_async()
575 * @see csr_cs_scan_dir_async()
576 * @see csr_cs_scan_dirs_async()
578 int csr_cs_cancel_scanning(csr_cs_context_h handle);
582 * @brief Extracts the severity of a detected malware from the detected malware handle.
586 * @param[in] malware A detected malware handle returned by csr_cs_scan_data(),
587 * csr_cs_scan_file() or csr_cs_malware_list_get_malware().
588 * @param[out] severity A pointer of the severity of a detected malware.
590 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
592 * @retval #CSR_ERROR_NONE Successful
593 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
594 * @retval #CSR_ERROR_INVALID_PARAMETER @a severity is invalid
595 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
597 int csr_cs_malware_get_severity(csr_cs_malware_h malware,
598 csr_cs_severity_level_e *severity);
601 * @brief Extracts the name of a detected malware from the detected malware handle.
605 * @remarks The @a name must be released using free().
607 * @param[in] malware A detected malware handle.
608 * @param[out] name A pointer of the name of a detected malware.
610 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
612 * @retval #CSR_ERROR_NONE Successful
613 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
614 * @retval #CSR_ERROR_INVALID_PARAMETER @a name is invalid
615 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
617 int csr_cs_malware_get_name(csr_cs_malware_h malware, char **name);
620 * @brief Extracts an url that contains detailed information on vendor's web site from
621 * the detected malware handle.
625 * @remarks The @a detailed_url must be released using free().
627 * @param[in] malware A detected malware handle.
628 * @param[out] detailed_url A pointer of an url that contains detailed information on
629 * vendor's web site. It can be null if a vendor doesn't
630 * provide this information.
632 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
634 * @retval #CSR_ERROR_NONE Successful
635 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
636 * @retval #CSR_ERROR_INVALID_PARAMETER @a detailed_url is invalid.
637 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
639 int csr_cs_malware_get_detailed_url(csr_cs_malware_h malware, char **detailed_url);
642 * @brief Extracts the time stamp when a malware is detected from the detected malware
647 * @param[in] malware A detected malware handle.
648 * @param[out] timestamp A pointer of the time stamp in milli second when a malware is
651 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
653 * @retval #CSR_ERROR_NONE Successful
654 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
655 * @retval #CSR_ERROR_INVALID_PARAMETER @a timestamp is invalid
656 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
658 int csr_cs_malware_get_timestamp(csr_cs_malware_h malware, time_t *timestamp);
661 * @brief Extracts the file name where a malware is detected from the detected malware
666 * @remarks The @a file_name must be released using free().
668 * @param[in] malware A detected malware handle.
669 * @param[out] file_name A pointer of the file name where a malware is detected. The
670 * file name is null for csr_cs_scan_data().
672 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
674 * @retval #CSR_ERROR_NONE Successful
675 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
676 * @retval #CSR_ERROR_INVALID_PARAMETER @a file_name is invalid
677 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
679 int csr_cs_malware_get_file_name(csr_cs_malware_h malware, char **file_name);
682 * @brief Extracts a user response of a popup from the detected malware handle.
686 * @param[in] malware A detected malware handle.
687 * @param[out] response A pointer of the user response.
689 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
691 * @retval #CSR_ERROR_NONE Successful
692 * @retval #CSR_ERROR_INVALID_HANDLE Invalid result handle
693 * @retval #CSR_ERROR_INVALID_PARAMETER @a response is invalid
694 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
696 int csr_cs_malware_get_user_response(csr_cs_malware_h malware,
697 csr_cs_user_response_e *response);
700 * @brief Checks if a malware was detected in an application or in a file.
704 * @param[in] malware A detected malware handle.
705 * @param[out] is_app A pointer of a flag indicating the position a malware was detected.
707 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
709 * @retval #CSR_ERROR_NONE Successful
710 * @retval #CSR_ERROR_INVALID_HANDLE Invalid result handle
711 * @retval #CSR_ERROR_INVALID_PARAMETER @a is_app is invalid
712 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
714 int csr_cs_malware_is_app(csr_cs_malware_h malware, bool *is_app);
717 * @brief Extracts the package id of an application where a malware is detected from
718 * detected malware handle.
722 * @remarks The @a pkg_id must be released using free().
724 * @param[in] malware A detected malware handle.
725 * @param[out] pkg_id A pointer of the package id where a malware is detected.
726 * It is null when a malware was not detected in an application.
728 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
730 * @retval #CSR_ERROR_NONE Successful
731 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
732 * @retval #CSR_ERROR_INVALID_PARAMETER @a pkg_id is invalid
733 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
735 int csr_cs_malware_get_pkg_id(csr_cs_malware_h malware, char **pkg_id);
738 * @brief Judges how a detected malware file is handled.
741 * @privlevel platform
742 * @privilege %http://tizen.org/privilege/antivirus.admin
744 * @remarks Detected malware can be removed or ignored.
746 * @remarks Detected malware will removed by #CSR_CS_ACTION_REMOVE action. File or
747 * application which contains malware will be removed.
748 * Detected malware will ignored by #CSR_CS_ACTION_IGNORE action. File or
749 * application which contains malware will be ignored and will not be treated
750 * as malware until this API called with #CSR_CS_ACTION_UNIGNORE action.
752 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
753 * @param[in] malware A handle of a detected malware.
754 * @param[in] action An action to be taken.
756 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
758 * @retval #CSR_ERROR_NONE Successful
759 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
760 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
761 * @retval #CSR_ERROR_INVALID_PARAMETER @a malware or @a action is invalid
762 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
763 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File to take action on not found
764 * @retval #CSR_ERROR_FILE_CHANGED File to take action on changed after detection
765 * @retval #CSR_ERROR_SOCKET Socket error between client and server
766 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
767 * @retval #CSR_ERROR_DB DB transaction error
768 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
770 int csr_cs_judge_detected_malware(csr_cs_context_h handle, csr_cs_malware_h malware,
771 csr_cs_action_e action);
775 * @brief Gets information on a detected malware file specified by file path.
779 * @privilege %http://tizen.org/privilege/antivirus.scan
781 * @remarks The @a malware will be released when @a handle is destroyed.
782 * @remarks @a file_path will be null if it's result of csr_cs_scan_data().
784 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
785 * @param[in] file_path A path of a detected malware file.
786 * @param[out] malware A pointer of the detected malware handle. It can be null when
789 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
791 * @retval #CSR_ERROR_NONE Successful
792 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
793 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
794 * @retval #CSR_ERROR_INVALID_PARAMETER @a file_path or @a malware is invalid
795 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
796 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No malware file
797 * @retval #CSR_ERROR_SOCKET Socket error between client and server
798 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
799 * @retval #CSR_ERROR_DB DB transaction error
800 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
802 * @see csr_cs_scan_data()
803 * @see csr_cs_scan_file()
804 * @see csr_cs_detected_cb
806 int csr_cs_get_detected_malware(csr_cs_context_h handle, const char *file_path,
807 csr_cs_malware_h *malware);
810 * @brief Gets information on a detected malware files specified by directory path.
814 * @privilege %http://tizen.org/privilege/antivirus.scan
816 * @remarks The @a list will be released when @a handle is destroyed.
818 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
819 * @param[in] dir_paths A directory path where detected malware files exists.
820 * @param[in] count Count of array element of @a dir_paths
821 * @param[out] list A pointer of the detected malware list handle. It can be null
822 * when no malware file.
823 * @param[out] list_count Count of detected malware files which existed in the specified
826 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
828 * @retval #CSR_ERROR_NONE Successful
829 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
830 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
831 * @retval #CSR_ERROR_INVALID_PARAMETER @a dir_paths, @a list, or @a count is invalid
832 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
833 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No malware file
834 * @retval #CSR_ERROR_SOCKET Socket error between client and server
835 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
836 * @retval #CSR_ERROR_DB DB transaction error
837 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
839 int csr_cs_get_detected_malwares(csr_cs_context_h handle, const char *dir_paths[],
840 size_t count, csr_cs_malware_list_h *list,
844 * @brief Gets information on a ignored malware file specified by file path.
848 * @privilege %http://tizen.org/privilege/antivirus.scan
850 * @remarks The @a malware will be released when @a handle is destroyed.
852 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
853 * @param[in] file_path A path of a ignored malware file.
854 * @param[out] malware A pointer of the detected malware handle. It can be null when
857 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
859 * @retval #CSR_ERROR_NONE Successful
860 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
861 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
862 * @retval #CSR_ERROR_INVALID_PARAMETER @a file_path or @a malware is invalid
863 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
864 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No ignored file
865 * @retval #CSR_ERROR_SOCKET Socket error between client and server
866 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
867 * @retval #CSR_ERROR_DB DB transaction error
868 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
870 int csr_cs_get_ignored_malware(csr_cs_context_h handle, const char *file_path,
871 csr_cs_malware_h *malware);
874 * @brief Gets information on a ignored malware files specified by directory path.
878 * @privilege %http://tizen.org/privilege/antivirus.scan
880 * @remarks The @a list will be released when @a handle is destroyed.
882 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
883 * @param[in] dir_paths A directory path where ignored malware files exists.
884 * @param[in] count Count of array element of @a dir_paths
885 * @param[out] list A pointer of the detected malware list handle. It can be null
886 * when no ignored file.
887 * @param[out] list_count Count of ignored malware files which existed in the specified
890 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
892 * @retval #CSR_ERROR_NONE Successful
893 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
894 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
895 * @retval #CSR_ERROR_INVALID_PARAMETER @a dir_paths, @a list, or @a count is invalid
896 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
897 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No ignored file
898 * @retval #CSR_ERROR_SOCKET Socket error between client and server
899 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
900 * @retval #CSR_ERROR_DB DB transaction error
901 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
903 int csr_cs_get_ignored_malwares(csr_cs_context_h handle, const char *dir_paths[],
904 size_t count, csr_cs_malware_list_h *list,
908 * @brief Extracts the detected malware handle from the detected malware list handle.
912 * @param[in] list A detected malware list handle returned by
913 * csr_cs_get_detected_malwares() or
914 * csr_cs_get_ignored_malwares().
915 * @param[in] index An index of a target detected malware handle to get.
916 * @param[out] malware A pointer of the detected malware handle. It can be null when
919 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
921 * @retval #CSR_ERROR_NONE Successful
922 * @retval #CSR_ERROR_INVALID_HANDLE Invalid list
923 * @retval #CSR_ERROR_INVALID_PARAMETER @a index or @a malware is invalid.
924 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
926 int csr_cs_malware_list_get_malware(csr_cs_malware_list_h list, size_t index,
927 csr_cs_malware_h *malware);