Tizen Native API
4.0
|
It provides APIs scanning contents for data, files, and directories to detect malwares.
#include <csr-content-screening.h> #include <csr-content-screening-types.h> #include <csr-error.h>
It provides APIs scanning contents for data, files, and directories to detect malwares. Actual scanning is performed by underlying anti malware engines which will be provided by a device manufacturer.
Functions | |
int | csr_cs_context_create (csr_cs_context_h *handle) |
Initializes and returns a Content Screening API handle. | |
int | csr_cs_context_destroy (csr_cs_context_h handle) |
Releases all system resources associated with a Content Screening API handle. | |
int | csr_cs_set_ask_user (csr_cs_context_h handle, csr_cs_ask_user_e ask_user) |
Sets a popup option for malware detected. | |
int | csr_cs_set_popup_message (csr_cs_context_h handle, const char *message) |
Sets a popup message of a client in case that a malware is detected. | |
int | csr_cs_set_core_usage (csr_cs_context_h handle, csr_cs_core_usage_e usage) |
Sets a maximum core usage during scanning. | |
int | csr_cs_set_scan_on_cloud (csr_cs_context_h handle, bool scan_on_cloud) |
Sets a scan on cloud option. | |
int | csr_cs_scan_data (csr_cs_context_h handle, const unsigned char *data, size_t length, csr_cs_malware_h *malware) |
Scans a data buffer for malware. | |
int | csr_cs_scan_file (csr_cs_context_h handle, const char *file_path, csr_cs_malware_h *malware) |
Scans a file specified by file path for malware. | |
int | csr_cs_set_file_scanned_cb (csr_cs_context_h handle, csr_cs_file_scanned_cb callback) |
Sets a callback function for the case that a file scan is completed. | |
int | csr_cs_set_detected_cb (csr_cs_context_h handle, csr_cs_detected_cb callback) |
Sets a callback function for detection of a malware. | |
int | csr_cs_set_completed_cb (csr_cs_context_h handle, csr_cs_completed_cb callback) |
Sets a callback function for scanning completed without an error. | |
int | csr_cs_set_cancelled_cb (csr_cs_context_h handle, csr_cs_cancelled_cb callback) |
Sets a callback function for scanning cancelled. | |
int | csr_cs_set_error_cb (csr_cs_context_h handle, csr_cs_error_cb callback) |
Sets a callback function for scanning stopped with an error. | |
int | csr_cs_scan_files_async (csr_cs_context_h handle, const char *file_paths[], size_t count, void *user_data) |
Scan files specified by an array of file paths for malware. | |
int | csr_cs_scan_dir_async (csr_cs_context_h handle, const char *dir_path, void *user_data) |
Scans a directory specified by directory path for malware. | |
int | csr_cs_scan_dirs_async (csr_cs_context_h handle, const char *dir_paths[], size_t count, void *user_data) |
Scan directories specified by an array of directory paths for malware. | |
int | csr_cs_cancel_scanning (csr_cs_context_h handle) |
Cancels a running scanning task, asynchronously. | |
int | csr_cs_malware_get_severity (csr_cs_malware_h malware, csr_cs_severity_level_e *severity) |
Extracts the severity of a detected malware from the detected malware handle. | |
int | csr_cs_malware_get_name (csr_cs_malware_h malware, char **name) |
Extracts the name of a detected malware from the detected malware handle. | |
int | csr_cs_malware_get_detailed_url (csr_cs_malware_h malware, char **detailed_url) |
Extracts an url that contains detailed information on vendor's web site from the detected malware handle. | |
int | csr_cs_malware_get_timestamp (csr_cs_malware_h malware, time_t *timestamp) |
Extracts the time stamp when a malware is detected from the detected malware handle. | |
int | csr_cs_malware_get_file_name (csr_cs_malware_h malware, char **file_name) |
Extracts the file name where a malware is detected from the detected malware handle. | |
int | csr_cs_malware_get_user_response (csr_cs_malware_h malware, csr_cs_user_response_e *response) |
Extracts a user response of a popup from the detected malware handle. | |
int | csr_cs_malware_is_app (csr_cs_malware_h malware, bool *is_app) |
Checks if a malware was detected in an application or in a file. | |
int | csr_cs_malware_get_pkg_id (csr_cs_malware_h malware, char **pkg_id) |
Extracts the package id of an application where a malware is detected from detected malware handle. | |
int | csr_cs_judge_detected_malware (csr_cs_context_h handle, csr_cs_malware_h malware, csr_cs_action_e action) |
Judges how a detected malware file is handled. | |
int | csr_cs_get_detected_malware (csr_cs_context_h handle, const char *file_path, csr_cs_malware_h *malware) |
Gets information on a detected malware file specified by file path. | |
int | csr_cs_get_detected_malwares (csr_cs_context_h handle, const char *dir_paths[], size_t count, csr_cs_malware_list_h *list, size_t *list_count) |
Gets information on a detected malware files specified by directory path. | |
int | csr_cs_get_ignored_malware (csr_cs_context_h handle, const char *file_path, csr_cs_malware_h *malware) |
Gets information on a ignored malware file specified by file path. | |
int | csr_cs_get_ignored_malwares (csr_cs_context_h handle, const char *dir_paths[], size_t count, csr_cs_malware_list_h *list, size_t *list_count) |
Gets information on ignored malware files specified by directory path. | |
int | csr_cs_malware_list_get_malware (csr_cs_malware_list_h list, size_t index, csr_cs_malware_h *malware) |
Extracts the detected malware handle from the detected malware list handle. | |
Typedefs | |
typedef struct __csr_cs_context_s * | csr_cs_context_h |
Content screening APIs context handle. | |
typedef struct __csr_cs_malware_s * | csr_cs_malware_h |
Detected malware handle. | |
typedef struct __csr_cs_malware_list_s * | csr_cs_malware_list_h |
Detected malware list handle. | |
typedef struct __csr_cs_engine_s * | csr_cs_engine_h |
Engine info handle. | |
typedef void(* | csr_cs_file_scanned_cb )(const char *file_path, void *user_data) |
Called when each file scanning is done without malware. | |
typedef void(* | csr_cs_detected_cb )(csr_cs_malware_h malware, void *user_data) |
Called when each file scanning is done with malware. | |
typedef void(* | csr_cs_completed_cb )(void *user_data) |
Called when scanning is finished successfully. | |
typedef void(* | csr_cs_cancelled_cb )(void *user_data) |
Called when scanning is cancelled by csr_cs_cancel_scanning(). | |
typedef void(* | csr_cs_error_cb )(int error_code, void *user_data) |
Called when scanning is stopped with an error. |
typedef void(* csr_cs_cancelled_cb)(void *user_data) |
Called when scanning is cancelled by csr_cs_cancel_scanning().
[in] | user_data | A pointer of a user data. It's provided by client when calling asynchronous scanning method |
typedef void(* csr_cs_completed_cb)(void *user_data) |
Called when scanning is finished successfully.
[in] | user_data | A pointer of a user data. It's provided by client when calling asynchronous scanning method |
typedef struct __csr_cs_context_s* csr_cs_context_h |
Content screening APIs context handle.
typedef void(* csr_cs_detected_cb)(csr_cs_malware_h malware, void *user_data) |
Called when each file scanning is done with malware.
[in] | malware | The detected malware handle |
[in] | user_data | A pointer of a user data. It's provided by client when calling asynchronous scanning method |
typedef struct __csr_cs_engine_s* csr_cs_engine_h |
Engine info handle.
typedef void(* csr_cs_error_cb)(int error_code, void *user_data) |
Called when scanning is stopped with an error.
The following error codes can be delivered.
CSR_ERROR_FILE_DO_NOT_EXIST,
CSR_ERROR_SOCKET,
CSR_ERROR_SERVER,
CSR_ERROR_ENGINE_NOT_EXIST,
CSR_ERROR_ENGINE_DISABLED,
CSR_ERROR_ENGINE_NOT_ACTIVATED,
CSR_ERROR_ENGINE_PERMISSION,
CSR_ERROR_ENGINE_INTERNAL
[in] | error_code | Error code of csr_error_e defined in csr-error.h |
[in] | user_data | A pointer of a user data. It's provided by client when calling asynchronous scanning method |
typedef void(* csr_cs_file_scanned_cb)(const char *file_path, void *user_data) |
Called when each file scanning is done without malware.
[in] | file_path | A path of the file scanned. It would be package path if it's in application |
[in] | user_data | A pointer of a user data. It's provided by client when calling asynchronous scanning method |
typedef struct __csr_cs_malware_s* csr_cs_malware_h |
Detected malware handle.
typedef struct __csr_cs_malware_list_s* csr_cs_malware_list_h |
Detected malware list handle.
enum csr_cs_action_e |
Enumeration for the action types for the detected malware files.
enum csr_cs_ask_user_e |
Enumeration for the option of asking user about handling a detected malware.
enum csr_cs_core_usage_e |
Enumeration for maximum core usage during scanning.
Enumeration for severity level of a detected malware.
Enumeration for the user response from popup.
enum csr_error_e |
Enumeration for CSR Errors.
int csr_cs_cancel_scanning | ( | csr_cs_context_h | handle | ) |
Cancels a running scanning task, asynchronously.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_NO_TASK | No task to cancel |
CSR_ERROR_SYSTEM | System error |
int csr_cs_context_create | ( | csr_cs_context_h * | handle | ) |
Initializes and returns a Content Screening API handle.
A Content Screening API handle (or CSR CS handle) is obtained by this method. The handle is required for subsequent CSR CS API calls.
[out] | handle | A pointer of CSR CS context handle |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | handle may be null |
CSR_ERROR_OUT_OF_MEMORY | Not enough memory |
CSR_ERROR_SYSTEM | System error |
int csr_cs_context_destroy | ( | csr_cs_context_h | handle | ) |
Releases all system resources associated with a Content Screening API handle.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_SOCKET | Socket error between client and server |
CSR_ERROR_SYSTEM | System error |
int csr_cs_get_detected_malware | ( | csr_cs_context_h | handle, |
const char * | file_path, | ||
csr_cs_malware_h * | malware | ||
) |
Gets information on a detected malware file specified by file path.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | file_path | A path of a detected malware file |
[out] | malware | A pointer of the detected malware handle. It can be null when no malware file |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_OUT_OF_MEMORY | Not enough memory |
CSR_ERROR_INVALID_PARAMETER | file_path or malware is invalid |
CSR_ERROR_PERMISSION_DENIED | No permission to remove |
CSR_ERROR_FILE_DO_NOT_EXIST | No malware file |
CSR_ERROR_SOCKET | Socket error between client and server |
CSR_ERROR_SERVER | Server has been failed for some reason |
CSR_ERROR_DB | DB transaction error |
CSR_ERROR_SYSTEM | System error |
int csr_cs_get_detected_malwares | ( | csr_cs_context_h | handle, |
const char * | dir_paths[], | ||
size_t | count, | ||
csr_cs_malware_list_h * | list, | ||
size_t * | list_count | ||
) |
Gets information on a detected malware files specified by directory path.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | dir_paths | A directory path where detected malware files exists |
[in] | count | Count of array element of dir_paths |
[out] | list | A pointer of the detected malware list handle. It can be null when there is no malware file |
[out] | list_count | Count of detected malware files which existed in the specified directory |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_OUT_OF_MEMORY | Not enough memory |
CSR_ERROR_INVALID_PARAMETER | dir_paths, list, or count is invalid |
CSR_ERROR_PERMISSION_DENIED | No permission to remove |
CSR_ERROR_FILE_DO_NOT_EXIST | No malware file |
CSR_ERROR_SOCKET | Socket error between client and server |
CSR_ERROR_SERVER | Server has been failed for some reason |
CSR_ERROR_DB | DB transaction error |
CSR_ERROR_SYSTEM | System error |
int csr_cs_get_ignored_malware | ( | csr_cs_context_h | handle, |
const char * | file_path, | ||
csr_cs_malware_h * | malware | ||
) |
Gets information on a ignored malware file specified by file path.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | file_path | A path of a ignored malware file |
[out] | malware | A pointer of the detected malware handle. It can be null when no ignored file |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_OUT_OF_MEMORY | Not enough memory |
CSR_ERROR_INVALID_PARAMETER | file_path or malware is invalid |
CSR_ERROR_PERMISSION_DENIED | No permission to remove |
CSR_ERROR_FILE_DO_NOT_EXIST | No ignored file |
CSR_ERROR_SOCKET | Socket error between client and server |
CSR_ERROR_SERVER | Server has been failed for some reason |
CSR_ERROR_DB | DB transaction error |
CSR_ERROR_SYSTEM | System error |
int csr_cs_get_ignored_malwares | ( | csr_cs_context_h | handle, |
const char * | dir_paths[], | ||
size_t | count, | ||
csr_cs_malware_list_h * | list, | ||
size_t * | list_count | ||
) |
Gets information on ignored malware files specified by directory path.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | dir_paths | A directory path where ignored malware files exists |
[in] | count | Count of array element of dir_paths |
[out] | list | A pointer of the detected malware list handle. It can be null when no ignored file |
[out] | list_count | Count of ignored malware files which existed in the specified directory |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_OUT_OF_MEMORY | Not enough memory |
CSR_ERROR_INVALID_PARAMETER | dir_paths, list, or count is invalid |
CSR_ERROR_PERMISSION_DENIED | No permission to remove |
CSR_ERROR_FILE_DO_NOT_EXIST | No ignored file |
CSR_ERROR_SOCKET | Socket error between client and server |
CSR_ERROR_SERVER | Server has been failed for some reason |
CSR_ERROR_DB | DB transaction error |
CSR_ERROR_SYSTEM | System error |
int csr_cs_judge_detected_malware | ( | csr_cs_context_h | handle, |
csr_cs_malware_h | malware, | ||
csr_cs_action_e | action | ||
) |
Judges how a detected malware file is handled.
Detected malware will be removed by CSR_CS_ACTION_REMOVE action. File or application which contains malware will be removed. Detected malware will be ignored by CSR_CS_ACTION_IGNORE action. File or application which contains malware will be ignored and will not be treated as malware until this API is called with CSR_CS_ACTION_UNIGNORE action.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | malware | A handle of a detected malware |
[in] | action | An action to be taken |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_OUT_OF_MEMORY | Not enough memory |
CSR_ERROR_INVALID_PARAMETER | malware or action is invalid |
CSR_ERROR_PERMISSION_DENIED | No permission to remove |
CSR_ERROR_FILE_DO_NOT_EXIST | File to take action on not found |
CSR_ERROR_FILE_CHANGED | File to take action on changed after detection |
CSR_ERROR_SOCKET | Socket error between client and server |
CSR_ERROR_SERVER | Server has been failed for some reason |
CSR_ERROR_DB | DB transaction error |
CSR_ERROR_REMOVE_FAILED | Removing file or application is failed |
CSR_ERROR_SYSTEM | System error |
int csr_cs_malware_get_detailed_url | ( | csr_cs_malware_h | malware, |
char ** | detailed_url | ||
) |
Extracts an url that contains detailed information on vendor's web site from the detected malware handle.
[in] | malware | A detected malware handle |
[out] | detailed_url | A pointer of an url that contains detailed information on vendor's web site. It can be null if a vendor doesn't provide this information |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid detected malware handle |
CSR_ERROR_INVALID_PARAMETER | detailed_url is invalid. |
CSR_ERROR_SYSTEM | System error |
int csr_cs_malware_get_file_name | ( | csr_cs_malware_h | malware, |
char ** | file_name | ||
) |
Extracts the file name where a malware is detected from the detected malware handle.
[in] | malware | A detected malware handle |
[out] | file_name | A pointer of the file name where a malware is detected. The file name is null for csr_cs_scan_data() |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid detected malware handle |
CSR_ERROR_INVALID_PARAMETER | file_name is invalid |
CSR_ERROR_SYSTEM | System error |
int csr_cs_malware_get_name | ( | csr_cs_malware_h | malware, |
char ** | name | ||
) |
Extracts the name of a detected malware from the detected malware handle.
[in] | malware | A detected malware handle |
[out] | name | A pointer of the name of a detected malware |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid detected malware handle |
CSR_ERROR_INVALID_PARAMETER | name is invalid |
CSR_ERROR_SYSTEM | System error |
int csr_cs_malware_get_pkg_id | ( | csr_cs_malware_h | malware, |
char ** | pkg_id | ||
) |
Extracts the package id of an application where a malware is detected from detected malware handle.
[in] | malware | A detected malware handle |
[out] | pkg_id | A pointer of the package id where a malware is detected. It is null when a malware was not detected in an application |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid detected malware handle |
CSR_ERROR_INVALID_PARAMETER | pkg_id is invalid |
CSR_ERROR_SYSTEM | System error |
int csr_cs_malware_get_severity | ( | csr_cs_malware_h | malware, |
csr_cs_severity_level_e * | severity | ||
) |
Extracts the severity of a detected malware from the detected malware handle.
[in] | malware | A detected malware handle returned by csr_cs_scan_data(), csr_cs_scan_file() or csr_cs_malware_list_get_malware() |
[out] | severity | A pointer of the severity of a detected malware |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid detected malware handle |
CSR_ERROR_INVALID_PARAMETER | severity is invalid |
CSR_ERROR_SYSTEM | System error |
int csr_cs_malware_get_timestamp | ( | csr_cs_malware_h | malware, |
time_t * | timestamp | ||
) |
Extracts the time stamp when a malware is detected from the detected malware handle.
[in] | malware | A detected malware handle |
[out] | timestamp | A pointer of the time stamp in milli second when a malware is detected |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid detected malware handle |
CSR_ERROR_INVALID_PARAMETER | timestamp is invalid |
CSR_ERROR_SYSTEM | System error |
int csr_cs_malware_get_user_response | ( | csr_cs_malware_h | malware, |
csr_cs_user_response_e * | response | ||
) |
Extracts a user response of a popup from the detected malware handle.
[in] | malware | A detected malware handle |
[out] | response | A pointer of the user response |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid result handle |
CSR_ERROR_INVALID_PARAMETER | response is invalid |
CSR_ERROR_SYSTEM | System error |
int csr_cs_malware_is_app | ( | csr_cs_malware_h | malware, |
bool * | is_app | ||
) |
Checks if a malware was detected in an application or in a file.
[in] | malware | A detected malware handle |
[out] | is_app | A pointer of a flag indicating the position where a malware was detected. |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid result handle |
CSR_ERROR_INVALID_PARAMETER | is_app is invalid |
CSR_ERROR_SYSTEM | System error |
int csr_cs_malware_list_get_malware | ( | csr_cs_malware_list_h | list, |
size_t | index, | ||
csr_cs_malware_h * | malware | ||
) |
Extracts the detected malware handle from the detected malware list handle.
[in] | list | A detected malware list handle returned by csr_cs_get_detected_malwares() or csr_cs_get_ignored_malwares() |
[in] | index | An index of a target detected malware handle to get |
[out] | malware | A pointer of the detected malware handle. It can be null when index is invalid |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid list |
CSR_ERROR_INVALID_PARAMETER | index or malware is invalid |
CSR_ERROR_SYSTEM | System error |
int csr_cs_scan_data | ( | csr_cs_context_h | handle, |
const unsigned char * | data, | ||
size_t | length, | ||
csr_cs_malware_h * | malware | ||
) |
Scans a data buffer for malware.
malware result of this method is not available for being judged by csr_cs_judge_detected_malware() because it's data and not a file, so it cannot be removed or ignored.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | data | A scan target data |
[in] | length | A size of a scan target data |
[out] | malware | A pointer of the detected malware handle. It can be null when no malware detected |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_OUT_OF_MEMORY | Not enough memory |
CSR_ERROR_INVALID_PARAMETER | data or malware is invalid |
CSR_ERROR_PERMISSION_DENIED | No privilege to call |
CSR_ERROR_NOT_SUPPORTED | Device needed to run API is not supported |
CSR_ERROR_SOCKET | Socket error between client and server |
CSR_ERROR_SERVER | Server has been failed for some reason |
CSR_ERROR_USER_RESPONSE_FAILED | Getting user response is failed. malware will be allocated on this error |
CSR_ERROR_ENGINE_NOT_EXIST | No engine exists |
CSR_ERROR_ENGINE_DISABLED | Engine is in disabled state |
CSR_ERROR_ENGINE_NOT_ACTIVATED | Engine is not activated |
CSR_ERROR_ENGINE_INTERNAL | Engine Internal error |
CSR_ERROR_SYSTEM | System error |
int csr_cs_scan_dir_async | ( | csr_cs_context_h | handle, |
const char * | dir_path, | ||
void * | user_data | ||
) |
Scans a directory specified by directory path for malware.
If scanning of the single file is done without detected malware, csr_cs_file_scanned_cb() is called and else if malware detected csr_cs_detected_cb() is called. If scanning is cancelled by csr_cs_cancel_scanning(), csr_cs_cancelled_cb() is called. If scanning is failed with error, csr_cs_error_cb() is called. If scanning is completed without error, csr_cs_completed_cb(). Every callbacks are registered by callback setter methods to handle and if callback is not registered, it will be just skipped to be called.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | dir_path | A path of scan target directory |
[in] | user_data | The pointer of a user data. It can be null. It is used on the callback functions which are registered to handle |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_OUT_OF_MEMORY | Not enough memory |
CSR_ERROR_INVALID_PARAMETER | dir_path is invalid |
CSR_ERROR_PERMISSION_DENIED | Access denied |
CSR_ERROR_NOT_SUPPORTED | Device needed to run API is not supported |
CSR_ERROR_BUSY | Busy for processing another request |
CSR_ERROR_FILE_DO_NOT_EXIST | File not found |
CSR_ERROR_FILE_SYSTEM | File type is invalid. It should be directory |
CSR_ERROR_SOCKET | Socket error between client and server |
CSR_ERROR_SERVER | Server has been failed for some reason |
CSR_ERROR_DB | DB transaction error |
CSR_ERROR_ENGINE_PERMISSION | Insufficient permission of engine |
CSR_ERROR_ENGINE_NOT_EXIST | No engine exists |
CSR_ERROR_ENGINE_DISABLED | Engine is in disabled state |
CSR_ERROR_ENGINE_NOT_ACTIVATED | Engine is not activated |
CSR_ERROR_ENGINE_INTERNAL | Engine Internal error |
CSR_ERROR_SYSTEM | System error |
int csr_cs_scan_dirs_async | ( | csr_cs_context_h | handle, |
const char * | dir_paths[], | ||
size_t | count, | ||
void * | user_data | ||
) |
Scan directories specified by an array of directory paths for malware.
If scanning of the single file is done without detected malware, csr_cs_file_scanned_cb() is called and else if malware detected csr_cs_detected_cb() is called. If scanning is cancelled by csr_cs_cancel_scanning(), csr_cs_cancelled_cb() is called. If scanning is failed with error, csr_cs_error_cb() is called. If scanning is completed without error, csr_cs_completed_cb(). Every callbacks are registered by callback setter methods to handle and if callback is not registered, it will just be skipped to be called.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | dir_paths | An array of scan target directories |
[in] | count | A number of scan target directories |
[in] | user_data | The pointer of a user data. It can be null. It is used on the callback functions which are registered to handle |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_OUT_OF_MEMORY | Not enough memory |
CSR_ERROR_INVALID_PARAMETER | dir_paths is invalid |
CSR_ERROR_PERMISSION_DENIED | Access denied |
CSR_ERROR_NOT_SUPPORTED | Device needed to run API is not supported |
CSR_ERROR_BUSY | Busy for processing another request |
CSR_ERROR_FILE_DO_NOT_EXIST | File not found |
CSR_ERROR_FILE_SYSTEM | File type is invalid. It should be directory |
CSR_ERROR_SOCKET | Socket error between client and server |
CSR_ERROR_SERVER | Server has been failed for some reason |
CSR_ERROR_DB | DB transaction error |
CSR_ERROR_ENGINE_PERMISSION | Insufficient permission of engine |
CSR_ERROR_ENGINE_NOT_EXIST | No engine exists |
CSR_ERROR_ENGINE_DISABLED | Engine is in disabled state |
CSR_ERROR_ENGINE_NOT_ACTIVATED | Engine is not activated |
CSR_ERROR_ENGINE_INTERNAL | Engine Internal error |
CSR_ERROR_SYSTEM | System error |
int csr_cs_scan_file | ( | csr_cs_context_h | handle, |
const char * | file_path, | ||
csr_cs_malware_h * | malware | ||
) |
Scans a file specified by file path for malware.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | file_path | A path of scan target file |
[out] | malware | A pointer of the detected malware handle. It can be null when no malware detected |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_OUT_OF_MEMORY | Not enough memory |
CSR_ERROR_INVALID_PARAMETER | file_path or malware is invalid |
CSR_ERROR_PERMISSION_DENIED | Access denied |
CSR_ERROR_NOT_SUPPORTED | Device needed to run API is not supported |
CSR_ERROR_DB | DB transaction error |
CSR_ERROR_REMOVE_FAILED | Removing file or application is failed when malware exist and user select to remove by popup. malware will be allocated on this error |
CSR_ERROR_USER_RESPONSE_FAILED | Getting user response is failed malware will be allocated on this error |
CSR_ERROR_FILE_DO_NOT_EXIST | File not found |
CSR_ERROR_SOCKET | Socket error between client and server |
CSR_ERROR_SERVER | Server has been failed for some reason |
CSR_ERROR_ENGINE_NOT_EXIST | No engine exists |
CSR_ERROR_ENGINE_DISABLED | Engine is in disabled state |
CSR_ERROR_ENGINE_NOT_ACTIVATED | Engine is not activated |
CSR_ERROR_ENGINE_PERMISSION | Insufficient permission of engine |
CSR_ERROR_ENGINE_INTERNAL | Engine Internal error |
CSR_ERROR_SYSTEM | System error |
int csr_cs_scan_files_async | ( | csr_cs_context_h | handle, |
const char * | file_paths[], | ||
size_t | count, | ||
void * | user_data | ||
) |
Scan files specified by an array of file paths for malware.
If scanning of the single file is done without detected malware, csr_cs_file_scanned_cb() is called and else if malware detected csr_cs_detected_cb() is called. If scanning is cancelled by csr_cs_cancel_scanning(), csr_cs_cancelled_cb() is called. If scanning is failed with error, csr_cs_error_cb() is called. If scanning is completed without error, csr_cs_completed_cb(). Every callbacks are registered by callback setter methods to handle and if callback is not registered, it will be just skipped to be called.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | file_paths | An array of scan target files |
[in] | count | A number of scan target files |
[in] | user_data | The pointer of a user data. It can be null. It is delivered back to the client when a callback function is called |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_OUT_OF_MEMORY | Not enough memory |
CSR_ERROR_INVALID_PARAMETER | file_paths is invalid |
CSR_ERROR_PERMISSION_DENIED | Access denied |
CSR_ERROR_NOT_SUPPORTED | Device needed to run API is not supported |
CSR_ERROR_BUSY | Busy for processing another request |
CSR_ERROR_FILE_DO_NOT_EXIST | File not found |
CSR_ERROR_SOCKET | Socket error between client and server |
CSR_ERROR_SERVER | Server has been failed for some reason |
CSR_ERROR_DB | DB transaction error |
CSR_ERROR_ENGINE_PERMISSION | Insufficient permission of engine |
CSR_ERROR_ENGINE_NOT_EXIST | No engine exists |
CSR_ERROR_ENGINE_DISABLED | Engine is in disabled state |
CSR_ERROR_ENGINE_NOT_ACTIVATED | Engine is not activated |
CSR_ERROR_ENGINE_INTERNAL | Engine Internal error |
CSR_ERROR_SYSTEM | System error |
int csr_cs_set_ask_user | ( | csr_cs_context_h | handle, |
csr_cs_ask_user_e | ask_user | ||
) |
Sets a popup option for malware detected.
If CSR_CS_ASK_USER_YES is set, a popup will be prompted to a user when a malware is detected. If CSR_CS_ASK_USER_NO is set which is default value, no popup will be prompted even if a malware is detected. User can allow, disallow, and remove detected malware by popup. Selection can be different between malware's severity.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | ask_user | Popup option to set or unset |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_INVALID_PARAMETER | ask_user is invalid |
CSR_ERROR_SYSTEM | System error |
int csr_cs_set_cancelled_cb | ( | csr_cs_context_h | handle, |
csr_cs_cancelled_cb | callback | ||
) |
Sets a callback function for scanning cancelled.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | callback | A callback function for scanning cancelled |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_INVALID_PARAMETER | callback is invalid |
CSR_ERROR_SYSTEM | System error |
int csr_cs_set_completed_cb | ( | csr_cs_context_h | handle, |
csr_cs_completed_cb | callback | ||
) |
Sets a callback function for scanning completed without an error.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | callback | A callback function for scanning completed successfully |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_INVALID_PARAMETER | callback is invalid |
CSR_ERROR_SYSTEM | System error |
int csr_cs_set_core_usage | ( | csr_cs_context_h | handle, |
csr_cs_core_usage_e | usage | ||
) |
Sets a maximum core usage during scanning.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | usage | A maximum core usage during scanning |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_INVALID_PARAMETER | usage is invalid |
CSR_ERROR_SYSTEM | System error |
int csr_cs_set_detected_cb | ( | csr_cs_context_h | handle, |
csr_cs_detected_cb | callback | ||
) |
Sets a callback function for detection of a malware.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | callback | A callback function for each file or application scanning done with malware detected |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_INVALID_PARAMETER | callback is invalid |
CSR_ERROR_SYSTEM | System error |
int csr_cs_set_error_cb | ( | csr_cs_context_h | handle, |
csr_cs_error_cb | callback | ||
) |
Sets a callback function for scanning stopped with an error.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | callback | A callback function for scanning stopped due to an error |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_INVALID_PARAMETER | callback is invalid |
CSR_ERROR_SYSTEM | System error |
int csr_cs_set_file_scanned_cb | ( | csr_cs_context_h | handle, |
csr_cs_file_scanned_cb | callback | ||
) |
Sets a callback function for the case that a file scan is completed.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | callback | A callback function for each file or application scanning done without any malware. |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_INVALID_PARAMETER | callback is invalid |
CSR_ERROR_SYSTEM | System error |
int csr_cs_set_popup_message | ( | csr_cs_context_h | handle, |
const char * | message | ||
) |
Sets a popup message of a client in case that a malware is detected.
Default message is "Malware which may harm your device is detected."
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | message | A message to print on a popup |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_INVALID_PARAMETER | message is too long or empty. Max size is 64 bytes |
CSR_ERROR_SYSTEM | System error |
int csr_cs_set_scan_on_cloud | ( | csr_cs_context_h | handle, |
bool | scan_on_cloud | ||
) |
Sets a scan on cloud option.
[in] | handle | CSR CS context handle returned by csr_cs_context_create() |
[in] | scan_on_cloud | Flag of scanning on cloud option |
CSR_ERROR_NONE | Successful |
CSR_ERROR_INVALID_HANDLE | Invalid handle |
CSR_ERROR_SYSTEM | System error |