a64f148f6cd84c05634660f9b3e3dcdb44939f1b
[platform/upstream/csr-framework.git] / src / include / csr / csr-content-screening-types.h
1 /*
2  *  Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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
15  */
16 /*
17  * @file        csr-content-screening-types.h
18  * @author      Dongsun Lee (ds73.lee@samsung.com)
19  * @version     1.0
20  * @brief       Content screening CAPI enums, handles and callbacks
21  */
22 #ifndef __CSR_CONTENT_SCREENING_TYPES_H_
23 #define __CSR_CONTENT_SCREENING_TYPES_H_
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 /**
30  * @addtogroup CAPI_CSR_FRAMEWORK_CS_MODULE
31  * @{
32  */
33
34 /**
35  * @partner
36  * @brief Severity level of a detected malware
37  * @since_tizen 3.0
38  */
39 typedef enum {
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;
44
45 /**
46  * @partner
47  * @brief The option of asking user about handling a detected malware
48  * @since_tizen 3.0
49  */
50 typedef enum {
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. */
53 } csr_cs_ask_user_e;
54
55 /**
56  * @partner
57  * @brief The user response from popup
58  * @since_tizen 3.0
59  */
60 typedef enum {
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;
66
67 /**
68  * @partner
69  * @brief The action types for the detected malware files
70  * @since_tizen 3.0
71  */
72 typedef enum {
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. */
76 } csr_cs_action_e;
77
78 /**
79  * @partner
80  * @brief Maximum core usage during scanning
81  * @since_tizen 3.0
82  */
83 typedef enum {
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;
89
90 /**
91  * @partner
92  * @brief Context handle of content screening APIs.
93  * @since_tizen 3.0
94  */
95 typedef struct __csr_cs_context_s *csr_cs_context_h;
96
97 /**
98  * @partner
99  * @brief Detected malware handle.
100  * @since_tizen 3.0
101  */
102 typedef struct __csr_cs_malware_s *csr_cs_malware_h;
103
104 /**
105  * @partner
106  * @brief Detected malware list handle.
107  * @since_tizen 3.0
108  */
109 typedef struct __csr_cs_malware_list_s *csr_cs_malware_list_h;
110
111 /**
112  * @partner
113  * @brief Engine info handle.
114  * @since_tizen 3.0
115  */
116 typedef struct __csr_cs_engine_s *csr_cs_engine_h;
117
118 /**
119  * @partner
120  * @brief Called when each file scanning is done without malware.
121  *
122  * @since_tizen 3.0
123  *
124  * @remarks Only for asynchronous scan functions.
125  * @remarks Called for each file or application which is not detected malware.
126  *
127  * @param[in] file_path  A path of the file scanned. It would be package path if it's
128  *                       in application.
129  * @param[in] user_data  A pointer of a user data. It's provided by client
130  *                       when calling asyncronous scanning method.
131  *
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()
136  */
137 typedef void (*csr_cs_file_scanned_cb)(const char *file_path, void *user_data);
138
139 /**
140  * @partner
141  * @brief Called when each file scanning is done with malware.
142  *
143  * @since_tizen 3.0
144  *
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().
149  *
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.
153  *
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()
158  */
159 typedef void (*csr_cs_detected_cb)(csr_cs_malware_h malware, void *user_data);
160
161 /**
162  * @partner
163  * @brief Called when scanning is finished successfully.
164  *
165  * @since_tizen 3.0
166  *
167  * @remarks Only for asynchronous scan functions.
168  * @remarks Called only once at the end of scanning when success.
169  *
170  * @param[in] user_data  A pointer of a user data. It's provided by client
171  *                       when calling asyncronous scanning method.
172  *
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()
177  */
178 typedef void (*csr_cs_completed_cb)(void *user_data);
179
180 /**
181  * @partner
182  * @brief Called when scanning is cancelled by csr_cs_cancel_scanning().
183  *
184  * @since_tizen 3.0
185  *
186  * @remarks Only for asynchronous scan functions.
187  * @remarks Called only once at the end of scanning by being cancelled.
188  *
189  * @param[in] user_data  A pointer of a user data. It's provided by client
190  *                       when calling asyncronous scanning method.
191  *
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()
197  */
198 typedef void (*csr_cs_cancelled_cb)(void *user_data);
199
200 /**
201  * @partner
202  * @brief Called when scanning is stopped with an error.
203  *
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
213  *
214  * @since_tizen 3.0
215  *
216  * @remarks Only for asynchronous scan functions.
217  * @remarks Called only once at the end of scanning when failed with error.
218  *
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.
222  *
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()
227  */
228 typedef void (*csr_cs_error_cb)(int error_code, void *user_data);
229
230 /**
231  * @}
232  */
233
234 #ifdef __cplusplus
235 }
236 #endif
237
238 #endif