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 Main API header for content screening
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 * @brief Initializes and returns a Malware Screening API handle.
41 * @remarks A Malware Screening API handle (or CSR CS handle) is obtained using the
42 * csr_cs_context_create() function. The handle is required for subsequent
43 * CSR CS API calls. The csr_cs_context_destroy() function releases/closes
44 * the handle. Multiple handles can be obtained using csr_cs_context_create().
46 * @param[out] phandle A pointer of CSR CS context handle.
48 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
50 * @retval #CSR_ERROR_NONE Successful
51 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
52 * @retval #CSR_ERROR_INVALID_PARAMETER phandle is invalid
53 * @retval #CSR_ERROR_PERMISSION_DENIED Permission denied
54 * @retval #CSR_ERROR_SOCKET Socket error between client and server
55 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
56 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
57 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
59 int csr_cs_context_create(csr_cs_context_h *phandle);
62 * @brief Releases all system resources associated with a Malware Screening API handle.
66 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
68 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
70 * @retval #CSR_ERROR_NONE Successful
71 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
72 * @retval #CSR_ERROR_SOCKET Socket error between client and server
73 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
74 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
75 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
77 int csr_cs_context_destroy(csr_cs_context_h handle);
80 * @brief Sets a popup option in case that a malware is detected.
84 * @remarks If #CSR_CS_ASK_USER is set, a popup will be prompted to a user when a malware
85 * is detected(#CSR_CS_SEVERITY_MEDIUM or #CSR_CS_SEVERITY_HIGH). If
86 * #CSR_CS_NOT_ASK_USER is set, no popup will be prompted even when a malware is
87 * detected. The default value of this option is #CSR_CS_ASK_USER. When a user
88 * selects to remove a detected malicious content, the content will be removed
89 * only if the client has the permission to remove the content.
91 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
92 * @param[in] ask_user A popup option in case for a risky URL.
94 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
96 * @retval #CSR_ERROR_NONE Successful
97 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
98 * @retval #CSR_ERROR_INVALID_PARAMETER ask_user is invalid
99 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
101 int csr_cs_set_ask_user(csr_cs_context_h handle, csr_cs_ask_user_e ask_user);
104 * @brief Sets a popup message of a client in case that a malware is detected.
108 * @remarks When a popup is prompted to a user, the message set by this method will be
109 * shown. When a client doesn't set his own popup message, the default message
110 * will be shown in the popup.
112 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
113 * @param[in] message a message in a popup.
115 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
117 * @retval #CSR_ERROR_NONE Successful
118 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
119 * @retval #CSR_ERROR_INVALID_PARAMETER @a message is too long or empty. Max size
121 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
123 * @see csr_cs_context_create()
125 int csr_cs_set_popup_message(csr_cs_context_h handle, const char *message);
128 * @brief Sets a maxium core usage during scanning.
132 * @remarks If a core usage is not set, CSR_CS_USE_CORE_DEFAULT will be used.
134 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
135 * @param[in] usage A maxium core usage during scanning.
137 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
139 * @retval #CSR_ERROR_NONE Successful
140 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
141 * @retval #CSR_ERROR_INVALID_PARAMETER usage is invalid
142 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
144 int csr_cs_set_core_usage(csr_cs_context_h handle, csr_cs_core_usage_e usage);
147 * @brief Sets a database which is used in scanning.
151 * @remarks If a database is not set or an engine does not support "scanning on cloud",
152 * the scanning will be done in a local device.
154 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
156 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
158 * @retval #CSR_ERROR_NONE Successful
159 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
160 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
162 int csr_cs_set_scan_on_cloud(csr_cs_context_h handle);
165 * @brief Main function for caller to scan a data buffer for malware.
169 * @privilege %http://tizen.org/privilege/antivirus.scan
171 * @remarks Scan data synchronously.
173 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
174 * @param[in] data A scan target data.
175 * @param[in] length A size of a scan target data.
176 * @param[out] pdetected A pointer of the detected malware handle. It can be null when no malware detected.
178 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
180 * @retval #CSR_ERROR_NONE Successful
181 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
182 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
183 * @retval #CSR_ERROR_INVALID_PARAMETER data or presult is invalid
184 * @retval #CSR_ERROR_SOCKET Socket error between client and server
185 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
186 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
187 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
188 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
189 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
190 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
192 int csr_cs_scan_data(csr_cs_context_h handle,
193 const unsigned char *data,
195 csr_cs_detected_h *pdetected);
198 * @brief Main function for caller to scan a file specified by file path for malware.
202 * @privilege %http://tizen.org/privilege/antivirus.scan
204 * @remarks Scan file synchronously.
206 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
207 * @param[in] file_path A path of scan target file.
208 * @param[out] pdetected A pointer of the detected malware handle. It can be null when no malware detected.
210 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
212 * @retval #CSR_ERROR_NONE Successful
213 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
214 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
215 * @retval #CSR_ERROR_INVALID_PARAMETER file_path or presult is invalid
216 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
217 * @retval #CSR_ERROR_REMOVE_FAILED File remove failed when malware exist and
218 * user select to remove by popup. @a pdetected
219 * will be allocated on this error unlike others.
220 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File not found
221 * @retval #CSR_ERROR_SOCKET Socket error between client and server
222 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
223 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
224 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
225 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
226 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
227 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
229 int csr_cs_scan_file(csr_cs_context_h handle,
230 const char *file_path,
231 csr_cs_detected_h *pdetected);
234 * @brief Sets a callback function for detection of a malware.
238 * @remarks Callback for asynchronous scan function.
240 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
241 * @param[in] callback a callback function for detection of a malware.
243 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
245 * @retval #CSR_ERROR_NONE Successful
246 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
247 * @retval #CSR_ERROR_INVALID_PARAMETER callback is invalid
248 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
250 int csr_cs_set_callback_on_detected(csr_cs_context_h handle,
251 csr_cs_on_detected_cb callback);
254 * @brief Sets a callback function for scanning completed without an error.
258 * @remarks Callback for asynchronous scan function.
260 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
261 * @param[in] callback a callback function for scanning completed without an error.
263 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
265 * @retval #CSR_ERROR_NONE Successful
266 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
267 * @retval #CSR_ERROR_INVALID_PARAMETER callback is invalid
268 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
270 int csr_cs_set_callback_on_completed(csr_cs_context_h handle,
271 csr_cs_on_completed_cb callback);
274 * @brief Sets a callback function for scanning cancelled.
278 * @remarks Callback for asynchronous scan function.
280 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
281 * @param[in] callback a callback function for scanning cancelled.
283 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
285 * @retval #CSR_ERROR_NONE Successful
286 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
287 * @retval #CSR_ERROR_INVALID_PARAMETER callback is invalid
288 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
290 int csr_cs_set_callback_on_cancelled(csr_cs_context_h handle,
291 csr_cs_on_cancelled_cb callback);
294 * @brief Sets a callback function for scanning stopped with an error.
298 * @remarks Callback for asynchronous scan function.
300 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
301 * @param[in] callback a callback function for scanning stopped with an error.
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 callback is invalid
308 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
310 int csr_cs_set_callback_on_error(csr_cs_context_h handle,
311 csr_cs_on_error_cb callback);
315 * @brief Sets a callback function for the case that a file scan is completed.
319 * @remarks Callback for asynchronous scan function.
321 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
322 * @param[in] callback a callback function for the case that a file scan is completed.
324 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
326 * @retval #CSR_ERROR_NONE Successful
327 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
328 * @retval #CSR_ERROR_INVALID_PARAMETER callback is invalid
329 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
331 int csr_cs_set_callback_on_file_scanned(csr_cs_context_h handle,
332 csr_cs_on_file_scanned_cb callback);
335 * @brief Main function for caller to scan files specified by an array of file paths
340 * @privilege %http://tizen.org/privilege/antivirus.scan
342 * @remarks Asynchronous function. The caller should set callback functions before
345 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
346 * @param[in] file_paths An array of scan target files.
347 * @param[in] count A number of scan target files.
348 * @param[in] user_data The pointer of a user data. It can be null.\n
349 * It is delivered back to the client when a callback function is called.
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_OUT_OF_MEMORY Not enough memory
356 * @retval #CSR_ERROR_INVALID_PARAMETER file_paths or count is invalid
357 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
358 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File not found
359 * @retval #CSR_ERROR_SOCKET Socket error between client and server
360 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
361 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
362 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
363 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
364 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
365 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
367 int csr_cs_scan_files_async(csr_cs_context_h handle,
368 const char *file_paths[],
373 * @brief Main function for caller to scan a directoy specified by
374 * directory path for malware.
378 * @privilege %http://tizen.org/privilege/antivirus.scan
380 * @remarks Asynchronous function. The caller should set callback functions before calls
381 * this. All files under target directory which can be accessed by a client are
384 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
385 * @param[in] dir_path A path of scan target directory.
386 * @param[in] user_data The pointer of a user data. It can be null.\n
387 * It is delivered back to the client when a callback function is called.
389 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
391 * @retval #CSR_ERROR_NONE Successful
392 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
393 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
394 * @retval #CSR_ERROR_INVALID_PARAMETER file_path or presult is invalid
395 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
396 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File not found
397 * @retval #CSR_ERROR_SOCKET Socket error between client and server
398 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
399 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
400 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
401 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
402 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
403 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
405 int csr_cs_scan_dir_async(csr_cs_context_h handle,
406 const char *dir_path,
410 * @brief Main function for caller to scan directories specified by
411 * an array of directory paths for malware.
415 * @privilege %http://tizen.org/privilege/antivirus.scan
417 * @remarks Asynchronous function. The caller should set callback functions before calls
418 * this. All files under target directories which can be accessed by a client
421 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
422 * @param[in] dir_paths An array of scan target directories.
423 * @param[in] count A number of scan target directories.
424 * @param[in] user_data The pointer of a user data. It can be null.
425 * It is delivered back to the client when a callback
426 * function is called.
428 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
430 * @retval #CSR_ERROR_NONE Successful
431 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
432 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
433 * @retval #CSR_ERROR_INVALID_PARAMETER dir_paths or count is invalid
434 * @retval #CSR_ERROR_PERMISSION_DENIED Access denied
435 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File not found
436 * @retval #CSR_ERROR_SOCKET Socket error between client and server
437 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
438 * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists
439 * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state
440 * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated
441 * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error
442 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
444 int csr_cs_scan_dirs_async(csr_cs_context_h handle,
445 const char *dir_paths[],
451 * @brief Cancels a running scanning task.
455 * @remarks It's only for an asynchronous scan function.
457 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
459 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
461 * @retval #CSR_ERROR_NONE Successful
462 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
463 * @retval #CSR_ERROR_NO_TASK No task to cancel
464 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
466 int csr_cs_scan_cancel(csr_cs_context_h handle);
468 //==============================================================================
470 //==============================================================================
473 * @brief extracts the severity of a detected malware from the detected malware handle.
477 * @param[in] detected A detected malware handle returned
478 * by csr_cs_result_get_detected_by_idx() or
479 * csr_cs_result_get_detected_most_severe().
480 * @param[out] pseverity A pointer of the severity of a detected malware.
482 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
484 * @retval #CSR_ERROR_NONE Successful
485 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
486 * @retval #CSR_ERROR_INVALID_PARAMETER pseverity is invalid.
487 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
489 int csr_cs_detected_get_severity(csr_cs_detected_h detected,
490 csr_cs_severity_level_e *pseverity);
493 * @brief extracts the name of a detected malware from the detected malware handle.
497 * @param[in] detected A detected malware handle.
498 * @param[out] malware_name A pointer of the name of a detected malware. A caller
499 * should not free this string.
501 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
503 * @retval #CSR_ERROR_NONE Successful
504 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
505 * @retval #CSR_ERROR_INVALID_PARAMETER malware_name is invalid
506 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
508 int csr_cs_detected_get_malware_name(csr_cs_detected_h detected,
509 const char **pmalware_name);
512 * @brief extracts an url that contains detailed information on vendor's web site from the detected malware handle.
516 * @param[in] detected A detected malware handle.
517 * @param[out] detailed_url A pointer of an url that contains detailed information on vendor's web site.\n
518 * It can be null if a vendor doesn't provide this information.\n
519 * A caller should not free this string.
521 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
523 * @retval #CSR_ERROR_NONE Successful
524 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
525 * @retval #CSR_ERROR_INVALID_PARAMETER malware_name is invalid.
526 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
528 int csr_cs_detected_get_detailed_url(csr_cs_detected_h detected,
529 const char **pdetailed_url);
532 * @brief extracts the time stamp when a malware is detected from the detected malware handle.
536 * @param[in] detected A detected malware handle.
537 * @param[out] timestamp A pointer of the time stamp in milli second when a malware is detected. A caller should not free this.
539 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
541 * @retval #CSR_ERROR_NONE Successful
542 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
543 * @retval #CSR_ERROR_INVALID_PARAMETER timestamp is invalid
544 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
546 int csr_cs_detected_get_timestamp(csr_cs_detected_h detected,
550 * @brief extracts the file name where a malware is detected from the detected malware handle.
554 * @param[in] detected A detected malware handle.
555 * @param[out] file_name A pointer of the file name where a malware is detected. A caller should not free this string. The file name is Null for csr_cs_scan_data.
557 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
559 * @retval #CSR_ERROR_NONE Successful
560 * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle
561 * @retval #CSR_ERROR_INVALID_PARAMETER file_name is invalid
562 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
564 int csr_cs_detected_get_file_name(csr_cs_detected_h detected,
565 const char **pfile_name);
568 * @brief extracts a user reponse of a popup from the detected malware handle.
572 * @param[in] detected A detected malware handle.
573 * @param[out] presponse A pointer of the user response.
575 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
577 * @retval #CSR_ERROR_NONE Successful
578 * @retval #CSR_ERROR_INVALID_HANDLE Invalid result handle
579 * @retval #CSR_ERROR_INVALID_PARAMETER presponse is invalid
580 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
582 int csr_cs_detected_get_user_response(csr_cs_detected_h detected,
583 csr_cs_user_response_e *presponse);
586 * @brief check if a malware was detected in an application or in a file.
590 * @param[in] detected A detected malware handle.
591 * @param[out] pis_app A pointer of a flag indicating the position a malware was detected.
593 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
595 * @retval #CSR_ERROR_NONE Successful
596 * @retval #CSR_ERROR_INVALID_HANDLE Invalid result handle
597 * @retval #CSR_ERROR_INVALID_PARAMETER pis_app is invalid
598 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
600 int csr_cs_detected_is_app(csr_cs_detected_h detected, bool *pis_app);
603 * @brief extracts the package id of an application where a malware is detected from detected malware handle.
607 * @param[in] detected A detected malware handle.
608 * @param[out] ppkg_id A pointer of the pakcage id where a malware is detected. A caller should not free this string. This is a null when a malware was not detected in an application.
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 ppkg_id is invalid
615 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
617 int csr_cs_detected_get_pkg_id(csr_cs_detected_h detected,
618 const char **ppkg_id);
621 * @brief Judges how a detected malware file is handled.
624 * @privlevel platform
625 * @privilege %http://tizen.org/privilege/antivirus.admin
627 * @remarks A detected malware may be removed or ignored. When action is
628 * #CSR_CS_ACTION_REMOVE, the detected malware file will be removed. If a
629 * detected malware is in an application, the application will be removed.
630 * Otherwise, only the file will be removed. When a client removes a detected
631 * malware with this API, the client must have the privilege to remove it.
632 * When action is #CSR_CS_ACTION_IGNORE, the dectected malware file won't be
633 * removed. And the ignored file will not treated as malicious. When action is
634 * #CSR_CS_ACTION_UNIGNORE, the ignored file will be considered as mailicous
637 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
638 * @param[in] detected A handle of a detected malware.
639 * @param[in] action An action to be taken.
641 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
643 * @retval #CSR_ERROR_NONE Successful
644 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
645 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
646 * @retval #CSR_ERROR_INVALID_PARAMETER detected or action is invalid
647 * @retval #CSR_ERROR_PERMISSION_DENIED No permission to remove
648 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST File to take action on not found
649 * @retval #CSR_ERROR_FILE_CHANGED File to take action on changed after detection
650 * @retval #CSR_ERROR_SOCKET Socket error between client and server
651 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
652 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
654 int csr_cs_judge_detected_malware(csr_cs_context_h handle,
655 csr_cs_detected_h detected, csr_cs_action_e action);
659 * @brief Gets information on a detected malware file specified by file path.
663 * @privilege %http://tizen.org/privilege/antivirus.scan
665 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
666 * @param[in] file_path A path of a detected malware file.
667 * @param[out] pdetected A pointer of the detected malware handle. It can be null when
670 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
672 * @retval #CSR_ERROR_NONE Successful
673 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
674 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
675 * @retval #CSR_ERROR_INVALID_PARAMETER file_path or action is invalid
676 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No malware file
677 * @retval #CSR_ERROR_SOCKET Socket error between client and server
678 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
679 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
681 int csr_cs_get_detected_malware(csr_cs_context_h handle, const char *file_path,
682 csr_cs_detected_h *pdetected);
685 * @brief Gets information on a detected malware files specified by directory path.
689 * @privilege %http://tizen.org/privilege/antivirus.scan
691 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
692 * @param[in] dir_paths A directory path where detected malware files exists.
693 * @param[in] count Count of array element of @a dir_paths
694 * @param[out] plist A pointer of the detected malware list handle. It can be null
695 * when no malware file.
696 * @param[out] pcount Count of detected malware files which existed in the specified
699 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
701 * @retval #CSR_ERROR_NONE Successful
702 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
703 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
704 * @retval #CSR_ERROR_INVALID_PARAMETER file_path or action is invalid
705 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No malware file
706 * @retval #CSR_ERROR_SOCKET Socket error between client and server
707 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
708 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
710 int csr_cs_get_detected_malwares(csr_cs_context_h handle,
711 const char *dir_paths[], size_t count,
712 csr_cs_detected_list_h *plist, size_t *pcount);
715 * @brief Gets information on a ignored malware file specified by file path.
719 * @privilege %http://tizen.org/privilege/antivirus.scan
721 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
722 * @param[in] file_path A path of a ignored malware file.
723 * @param[out] pdetected A pointer of the detected malware handle. It can be null when
726 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
728 * @retval #CSR_ERROR_NONE Successful
729 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
730 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
731 * @retval #CSR_ERROR_INVALID_PARAMETER file_path or action is invalid
732 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No ignored file
733 * @retval #CSR_ERROR_SOCKET Socket error between client and server
734 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
735 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
737 int csr_cs_get_ignored_malware(csr_cs_context_h handle, const char *file_path,
738 csr_cs_detected_h *pdetected);
741 * @brief Gets information on a ignored malware files specified by directory path.
745 * @privilege %http://tizen.org/privilege/antivirus.scan
747 * @param[in] handle CSR CS context handle returned by csr_cs_context_create().
748 * @param[in] dir_paths A directory path where ignored malware files exists.
749 * @param[in] count Count of array element of @a dir_paths
750 * @param[out] plist A pointer of the detected malware list handle. It can be null
751 * when no ignored file.
752 * @param[out] pcount Count of ignored malware files which existed in the specified
755 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
757 * @retval #CSR_ERROR_NONE Successful
758 * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle
759 * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory
760 * @retval #CSR_ERROR_INVALID_PARAMETER file_path or action is invalid
761 * @retval #CSR_ERROR_FILE_DO_NOT_EXIST No ingored file
762 * @retval #CSR_ERROR_SOCKET Socket error between client and server
763 * @retval #CSR_ERROR_SERVER Server has been failed for some reason
764 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
766 int csr_cs_get_ignored_malwares(csr_cs_context_h handle,
767 const char *dir_paths[], size_t count,
768 csr_cs_detected_list_h *plist, size_t *pcount);
771 * @brief Extracts the detected malware handle from the detected malware list handle.
775 * @param[in] list A detected malware list handle returned by
776 * csr_cs_get_detected_malwares() or
777 * csr_cs_get_ignored_malwares().
778 * @param[in] index An index of a target detected malware handle to get.
779 * @param[out] pdetected A pointer of the detected malware handle. It can be null when
782 * @return #CSR_ERROR_NONE on success, otherwise a negative error value
784 * @retval #CSR_ERROR_NONE Successful
785 * @retval #CSR_ERROR_INVALID_HANDLE Invalid list
786 * @retval #CSR_ERROR_INVALID_PARAMETER index or pdetected is invalid.
787 * @retval #CSR_ERROR_UNKNOWN Error with unknown reason
789 int csr_cs_dlist_get_detected(csr_cs_detected_list_h list, size_t index,
790 csr_cs_detected_h *pdetected);