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-types.h
18 * @author Dongsun Lee (ds73.lee@samsung.com)
20 * @brief Content screening CAPI enums, handles and callbacks
22 #ifndef __CSR_CONTENT_SCREENING_TYPES_H_
23 #define __CSR_CONTENT_SCREENING_TYPES_H_
30 * @addtogroup CAPI_CSR_FRAMEWORK_CS_MODULE
36 * @brief Severity level of a detected malware
40 CSR_CS_SEVERITY_LOW = 0x01, /**< Low Severity. User can choose how to handle between skip, ignore and remove. */
41 CSR_CS_SEVERITY_MEDIUM = 0x02, /**< Medium Severity. User can choose how to handle between skip, ignore and remove. */
42 CSR_CS_SEVERITY_HIGH = 0x03 /**< High Severity. User can choose how to handle between skip and remove. */
43 } csr_cs_severity_level_e;
47 * @brief The option of asking user about handling a detected malware
51 CSR_CS_ASK_USER_NO = 0x00, /**< Do not ask the user even if malicious contents were found.*/
52 CSR_CS_ASK_USER_YES = 0x01 /**< Ask the user when malicious contents were found. */
57 * @brief The user response from popup
61 CSR_CS_USER_RESPONSE_USER_NOT_ASKED = 0x00, /**< No response from user. */
62 CSR_CS_USER_RESPONSE_REMOVE = 0x01, /**< A user decided to remove a detected malicious content and it was removed. */
63 CSR_CS_USER_RESPONSE_PROCESSING_ALLOWED = 0x02, /**< A user decided to process a detected malware. */
64 CSR_CS_USER_RESPONSE_PROCESSING_DISALLOWED = 0x03, /**< A user decided not to process a detected malware. */
65 } csr_cs_user_response_e;
69 * @brief The action types for the detected malware files
73 CSR_CS_ACTION_REMOVE = 0x00, /**< Remove the detected malware file. */
74 CSR_CS_ACTION_IGNORE = 0x01, /**< Ignore the detected malware file. */
75 CSR_CS_ACTION_UNIGNORE = 0x02 /**< Unignore the previously ignored file. */
80 * @brief Maximum core usage during scanning
84 CSR_CS_CORE_USAGE_DEFAULT = 0x00, /**< Use default setting value. */
85 CSR_CS_CORE_USAGE_ALL = 0x01, /**< Use all cores during scanning. */
86 CSR_CS_CORE_USAGE_HALF = 0x02, /**< Use half cores during scanning. */
87 CSR_CS_CORE_USAGE_SINGLE = 0x03 /**< Use a single core during scanning. */
88 } csr_cs_core_usage_e;
92 * @brief Context handle of content screening APIs.
95 typedef struct __csr_cs_context_s *csr_cs_context_h;
99 * @brief Detected malware handle.
102 typedef struct __csr_cs_malware_s *csr_cs_malware_h;
106 * @brief Detected malware list handle.
109 typedef struct __csr_cs_malware_list_s *csr_cs_malware_list_h;
113 * @brief Engine info handle.
116 typedef struct __csr_cs_engine_s *csr_cs_engine_h;
120 * @brief Called when each file scanning is done without malware.
124 * @remarks Only for asynchronous scan functions.
125 * @remarks Called for each file or application which is not detected malware.
127 * @param[in] file_path A path of the file scanned. It would be package path if it's
129 * @param[in] user_data A pointer of a user data. It's provided by client
130 * when calling asyncronous scanning method.
132 * @see csr_cs_set_file_scanned_cb()
133 * @see csr_cs_scan_files_async()
134 * @see csr_cs_scan_dir_async()
135 * @see csr_cs_scan_dirs_async()
137 typedef void (*csr_cs_file_scanned_cb)(const char *file_path, void *user_data);
141 * @brief Called when each file scanning is done with malware.
145 * @remarks Only for asynchronous scan functions.
146 * @remarks Called for each file or application which is detected malware.
147 * @remarks The @a malware will be released when a context is released using
148 * csr_cs_context_destroy().
150 * @param[in] malware The detected malware handle.
151 * @param[in] user_data A pointer of a user data. It's provided by client
152 * when calling asyncronous scanning method.
154 * @see csr_cs_set_detected_cb()
155 * @see csr_cs_scan_files_async()
156 * @see csr_cs_scan_dir_async()
157 * @see csr_cs_scan_dirs_async()
159 typedef void (*csr_cs_detected_cb)(csr_cs_malware_h malware, void *user_data);
163 * @brief Called when scanning is finished successfully.
167 * @remarks Only for asynchronous scan functions.
168 * @remarks Called only once at the end of scanning when success.
170 * @param[in] user_data A pointer of a user data. It's provided by client
171 * when calling asyncronous scanning method.
173 * @see csr_cs_set_completed_cb()
174 * @see csr_cs_scan_files_async()
175 * @see csr_cs_scan_dir_async()
176 * @see csr_cs_scan_dirs_async()
178 typedef void (*csr_cs_completed_cb)(void *user_data);
182 * @brief Called when scanning is cancelled by csr_cs_cancel_scanning().
186 * @remarks Only for asynchronous scan functions.
187 * @remarks Called only once at the end of scanning by being cancelled.
189 * @param[in] user_data A pointer of a user data. It's provided by client
190 * when calling asyncronous scanning method.
192 * @see csr_cs_set_cancelled_cb()
193 * @see csr_cs_cancel_scanning()
194 * @see csr_cs_scan_files_async()
195 * @see csr_cs_scan_dir_async()
196 * @see csr_cs_scan_dirs_async()
198 typedef void (*csr_cs_cancelled_cb)(void *user_data);
202 * @brief Called when scanning is stopped with an error.
204 * @details The following error codes can be delivered.\n
205 * #CSR_ERROR_FILE_DO_NOT_EXIST,\n
206 * #CSR_ERROR_SOCKET,\n
207 * #CSR_ERROR_SERVER,\n
208 * #CSR_ERROR_ENGINE_NOT_EXIST,\n
209 * #CSR_ERROR_ENGINE_DISABLED,\n
210 * #CSR_ERROR_ENGINE_NOT_ACTIVATED,\n
211 * #CSR_ERROR_ENGINE_PERMISSION,\n
212 * #CSR_ERROR_ENGINE_INTERNAL
216 * @remarks Only for asynchronous scan functions.
217 * @remarks Called only once at the end of scanning when failed with error.
219 * @param[in] error_code Error code of #csr_error_e defined in csr-error.h
220 * @param[in] user_data A pointer of a user data. It's provided by client
221 * when calling asynchronous scanning method.
223 * @see csr_cs_set_error_cb()
224 * @see csr_cs_scan_files_async()
225 * @see csr_cs_scan_dir_async()
226 * @see csr_cs_scan_dirs_async()
228 typedef void (*csr_cs_error_cb)(int error_code, void *user_data);