Tizen Native API  5.0
Content Screening Module

It provides APIs scanning contents for data, files, and directories to detect malwares.

Required Header

#include <csr-content-screening.h> #include <csr-content-screening-types.h> #include <csr-error.h>

Overview

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 Documentation

typedef void(* csr_cs_cancelled_cb)(void *user_data)

Called when scanning is cancelled by csr_cs_cancel_scanning().

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
Only for asynchronous scan functions.
Called only once at the end of scanning by being cancelled.
Parameters:
[in]user_dataA pointer of a user data. It's provided by client when calling asynchronous scanning method
See also:
csr_cs_set_cancelled_cb()
csr_cs_cancel_scanning()
csr_cs_scan_files_async()
csr_cs_scan_dir_async()
csr_cs_scan_dirs_async()
typedef void(* csr_cs_completed_cb)(void *user_data)

Called when scanning is finished successfully.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
Only for asynchronous scan functions.
Called only once at the end of scanning when success.
Parameters:
[in]user_dataA pointer of a user data. It's provided by client when calling asynchronous scanning method
See also:
csr_cs_set_completed_cb()
csr_cs_scan_files_async()
csr_cs_scan_dir_async()
csr_cs_scan_dirs_async()
typedef struct __csr_cs_context_s* csr_cs_context_h

Content screening APIs context handle.

Warning:
This is not for use by third-party applications.
Since :
3.0
typedef void(* csr_cs_detected_cb)(csr_cs_malware_h malware, void *user_data)

Called when each file scanning is done with malware.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
Only for asynchronous scan functions.
Called for each file or application which is detected malware.
malware will be released when a context is released using csr_cs_context_destroy().
Parameters:
[in]malwareThe detected malware handle
[in]user_dataA pointer of a user data. It's provided by client when calling asynchronous scanning method
See also:
csr_cs_set_detected_cb()
csr_cs_scan_files_async()
csr_cs_scan_dir_async()
csr_cs_scan_dirs_async()
typedef struct __csr_cs_engine_s* csr_cs_engine_h

Engine info handle.

Warning:
This is not for use by third-party applications.
Since :
3.0
typedef void(* csr_cs_error_cb)(int error_code, void *user_data)

Called when scanning is stopped with an error.

Warning:
This is not for use by third-party applications.

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

Since :
3.0
Remarks:
Only for asynchronous scan functions.
Called only once at the end of scanning when failed with error.
Parameters:
[in]error_codeError code of csr_error_e defined in csr-error.h
[in]user_dataA pointer of a user data. It's provided by client when calling asynchronous scanning method
See also:
csr_cs_set_error_cb()
csr_cs_scan_files_async()
csr_cs_scan_dir_async()
csr_cs_scan_dirs_async()
typedef void(* csr_cs_file_scanned_cb)(const char *file_path, void *user_data)

Called when each file scanning is done without malware.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
Only for asynchronous scan functions.
Called for each file or application which is not detected malware.
Parameters:
[in]file_pathA path of the file scanned. It would be package path if it's in application
[in]user_dataA pointer of a user data. It's provided by client when calling asynchronous scanning method
See also:
csr_cs_set_file_scanned_cb()
csr_cs_scan_files_async()
csr_cs_scan_dir_async()
csr_cs_scan_dirs_async()
typedef struct __csr_cs_malware_s* csr_cs_malware_h

Detected malware handle.

Warning:
This is not for use by third-party applications.
Since :
3.0
typedef struct __csr_cs_malware_list_s* csr_cs_malware_list_h

Detected malware list handle.

Warning:
This is not for use by third-party applications.
Since :
3.0

Enumeration Type Documentation

Enumeration for the action types for the detected malware files.

Warning:
This is not for use by third-party applications.
Since :
3.0
Enumerator:
CSR_CS_ACTION_REMOVE 

Remove the detected malware file.

CSR_CS_ACTION_IGNORE 

Ignore the detected malware file.

CSR_CS_ACTION_UNIGNORE 

Unignore the previously ignored file.

Enumeration for the option of asking user about handling a detected malware.

Warning:
This is not for use by third-party applications.
Since :
3.0
Enumerator:
CSR_CS_ASK_USER_NO 

Do not ask the user even if malicious contents were found.

CSR_CS_ASK_USER_YES 

Ask the user when malicious contents were found.

Enumeration for maximum core usage during scanning.

Warning:
This is not for use by third-party applications.
Since :
3.0
Enumerator:
CSR_CS_CORE_USAGE_DEFAULT 

Use default setting value.

CSR_CS_CORE_USAGE_ALL 

Use all cores during scanning.

CSR_CS_CORE_USAGE_HALF 

Use half cores during scanning.

CSR_CS_CORE_USAGE_SINGLE 

Use a single core during scanning.

Enumeration for severity level of a detected malware.

Warning:
This is not for use by third-party applications.
Since :
3.0
Enumerator:
CSR_CS_SEVERITY_LOW 

Low Severity. User can choose how to handle between skip, ignore and remove.

CSR_CS_SEVERITY_MEDIUM 

Medium Severity. User can choose how to handle between skip, ignore and remove.

CSR_CS_SEVERITY_HIGH 

High Severity. User can choose how to handle between skip and remove.

Enumeration for the user response from popup.

Warning:
This is not for use by third-party applications.
Since :
3.0
Enumerator:
CSR_CS_USER_RESPONSE_USER_NOT_ASKED 

No response from user.

CSR_CS_USER_RESPONSE_REMOVE 

A user decided to remove a detected malicious content and it was removed.

CSR_CS_USER_RESPONSE_PROCESSING_ALLOWED 

A user decided to process a detected malware.

CSR_CS_USER_RESPONSE_PROCESSING_DISALLOWED 

A user decided not to process a detected malware.

Enumeration for CSR Errors.

Warning:
This is not for use by third-party applications.
Since :
3.0
Enumerator:
CSR_ERROR_NONE 

Successful

CSR_ERROR_INVALID_PARAMETER 

Invalid function parameter

CSR_ERROR_OUT_OF_MEMORY 

Out of memory

CSR_ERROR_PERMISSION_DENIED 

Permission denied

CSR_ERROR_NOT_SUPPORTED 

Device needed to run API is not supported

CSR_ERROR_BUSY 

Busy for processing another request

CSR_ERROR_SOCKET 

Socket error between client and server

CSR_ERROR_INVALID_HANDLE 

The given handle is invalid

CSR_ERROR_SERVER 

Server has been failed for some reason

CSR_ERROR_NO_TASK 

No Task exists

CSR_ERROR_DB 

DB transaction error

CSR_ERROR_REMOVE_FAILED 

Removing file or application is failed

CSR_ERROR_USER_RESPONSE_FAILED 

Getting user response is failed

CSR_ERROR_FILE_DO_NOT_EXIST 

File not exist

CSR_ERROR_FILE_CHANGED 

File changed after detection

CSR_ERROR_FILE_SYSTEM 

File type is invalid

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


Function Documentation

Cancels a running scanning task, asynchronously.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
Only for asynchronous scan functions.
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_NO_TASKNo task to cancel
CSR_ERROR_SYSTEMSystem error
See also:
csr_cs_scan_files_async()
csr_cs_scan_dir_async()
csr_cs_scan_dirs_async()

Initializes and returns a Content Screening API handle.

Warning:
This is not for use by third-party applications.

A Content Screening API handle (or CSR CS handle) is obtained by this method. The handle is required for subsequent CSR CS API calls.

Since :
3.0
Remarks:
handle should be released using csr_cs_context_destroy().
Multiple handles can be obtained.
Parameters:
[out]handleA pointer of CSR CS context handle
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEhandle may be null
CSR_ERROR_OUT_OF_MEMORYNot enough memory
CSR_ERROR_SYSTEMSystem error
See also:
csr_cs_context_destroy()

Releases all system resources associated with a Content Screening API handle.

Warning:
This is not for use by third-party applications.
Since :
3.0
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_SOCKETSocket error between client and server
CSR_ERROR_SYSTEMSystem error
See also:
csr_cs_context_create()
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.

Warning:
This is not for use by third-party applications.
Since :
3.0
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/antivirus.scan
Remarks:
malware will be released when handle is destroyed.
file_path will be null if it's result of csr_cs_scan_data().
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]file_pathA path of a detected malware file
[out]malwareA pointer of the detected malware handle. It can be null when no malware file
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_OUT_OF_MEMORYNot enough memory
CSR_ERROR_INVALID_PARAMETERfile_path or malware is invalid
CSR_ERROR_PERMISSION_DENIEDNo permission to remove
CSR_ERROR_FILE_DO_NOT_EXISTNo malware file
CSR_ERROR_SOCKETSocket error between client and server
CSR_ERROR_SERVERServer has been failed for some reason
CSR_ERROR_DBDB transaction error
CSR_ERROR_SYSTEMSystem error
See also:
csr_cs_scan_data()
csr_cs_scan_file()
csr_cs_detected_cb
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.

Warning:
This is not for use by third-party applications.
Since :
3.0
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/antivirus.scan
Remarks:
list will be released when handle is destroyed.
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]dir_pathsA directory path where detected malware files exists
[in]countCount of array element of dir_paths
[out]listA pointer of the detected malware list handle. It can be null when there is no malware file
[out]list_countCount of detected malware files which existed in the specified directory
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_OUT_OF_MEMORYNot enough memory
CSR_ERROR_INVALID_PARAMETERdir_paths, list, or count is invalid
CSR_ERROR_PERMISSION_DENIEDNo permission to remove
CSR_ERROR_FILE_DO_NOT_EXISTNo malware file
CSR_ERROR_SOCKETSocket error between client and server
CSR_ERROR_SERVERServer has been failed for some reason
CSR_ERROR_DBDB transaction error
CSR_ERROR_SYSTEMSystem 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.

Warning:
This is not for use by third-party applications.
Since :
3.0
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/antivirus.scan
Remarks:
malware will be released when handle is destroyed.
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]file_pathA path of a ignored malware file
[out]malwareA pointer of the detected malware handle. It can be null when no ignored file
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_OUT_OF_MEMORYNot enough memory
CSR_ERROR_INVALID_PARAMETERfile_path or malware is invalid
CSR_ERROR_PERMISSION_DENIEDNo permission to remove
CSR_ERROR_FILE_DO_NOT_EXISTNo ignored file
CSR_ERROR_SOCKETSocket error between client and server
CSR_ERROR_SERVERServer has been failed for some reason
CSR_ERROR_DBDB transaction error
CSR_ERROR_SYSTEMSystem 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.

Warning:
This is not for use by third-party applications.
Since :
3.0
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/antivirus.scan
Remarks:
list will be released when handle is destroyed.
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]dir_pathsA directory path where ignored malware files exists
[in]countCount of array element of dir_paths
[out]listA pointer of the detected malware list handle. It can be null when no ignored file
[out]list_countCount of ignored malware files which existed in the specified directory
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_OUT_OF_MEMORYNot enough memory
CSR_ERROR_INVALID_PARAMETERdir_paths, list, or count is invalid
CSR_ERROR_PERMISSION_DENIEDNo permission to remove
CSR_ERROR_FILE_DO_NOT_EXISTNo ignored file
CSR_ERROR_SOCKETSocket error between client and server
CSR_ERROR_SERVERServer has been failed for some reason
CSR_ERROR_DBDB transaction error
CSR_ERROR_SYSTEMSystem error

Judges how a detected malware file is handled.

Warning:
This is not for use by third-party applications.

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.

Since :
3.0
Privilege Level:
platform
Privilege:
http://tizen.org/privilege/antivirus.admin
Remarks:
Detected malware can be removed or ignored.
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]malwareA handle of a detected malware
[in]actionAn action to be taken
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_OUT_OF_MEMORYNot enough memory
CSR_ERROR_INVALID_PARAMETERmalware or action is invalid
CSR_ERROR_PERMISSION_DENIEDNo permission to remove
CSR_ERROR_FILE_DO_NOT_EXISTFile to take action on not found
CSR_ERROR_FILE_CHANGEDFile to take action on changed after detection
CSR_ERROR_SOCKETSocket error between client and server
CSR_ERROR_SERVERServer has been failed for some reason
CSR_ERROR_DBDB transaction error
CSR_ERROR_REMOVE_FAILEDRemoving file or application is failed
CSR_ERROR_SYSTEMSystem 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.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
detailed_url must be released using free().
Parameters:
[in]malwareA detected malware handle
[out]detailed_urlA 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
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid detected malware handle
CSR_ERROR_INVALID_PARAMETERdetailed_url is invalid.
CSR_ERROR_SYSTEMSystem 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.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
file_name must be released using free().
Parameters:
[in]malwareA detected malware handle
[out]file_nameA pointer of the file name where a malware is detected. The file name is null for csr_cs_scan_data()
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid detected malware handle
CSR_ERROR_INVALID_PARAMETERfile_name is invalid
CSR_ERROR_SYSTEMSystem 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.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
name must be released using free().
Parameters:
[in]malwareA detected malware handle
[out]nameA pointer of the name of a detected malware
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid detected malware handle
CSR_ERROR_INVALID_PARAMETERname is invalid
CSR_ERROR_SYSTEMSystem 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.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
pkg_id must be released using free().
Parameters:
[in]malwareA detected malware handle
[out]pkg_idA pointer of the package id where a malware is detected. It is null when a malware was not detected in an application
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid detected malware handle
CSR_ERROR_INVALID_PARAMETERpkg_id is invalid
CSR_ERROR_SYSTEMSystem error

Extracts the severity of a detected malware from the detected malware handle.

Warning:
This is not for use by third-party applications.
Since :
3.0
Parameters:
[in]malwareA detected malware handle returned by csr_cs_scan_data(), csr_cs_scan_file() or csr_cs_malware_list_get_malware()
[out]severityA pointer of the severity of a detected malware
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid detected malware handle
CSR_ERROR_INVALID_PARAMETERseverity is invalid
CSR_ERROR_SYSTEMSystem 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.

Warning:
This is not for use by third-party applications.
Since :
3.0
Parameters:
[in]malwareA detected malware handle
[out]timestampA pointer of the time stamp in milli second when a malware is detected
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid detected malware handle
CSR_ERROR_INVALID_PARAMETERtimestamp is invalid
CSR_ERROR_SYSTEMSystem error

Extracts a user response of a popup from the detected malware handle.

Warning:
This is not for use by third-party applications.
Since :
3.0
Parameters:
[in]malwareA detected malware handle
[out]responseA pointer of the user response
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid result handle
CSR_ERROR_INVALID_PARAMETERresponse is invalid
CSR_ERROR_SYSTEMSystem 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.

Warning:
This is not for use by third-party applications.
Since :
3.0
Parameters:
[in]malwareA detected malware handle
[out]is_appA pointer of a flag indicating the position where a malware was detected.
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid result handle
CSR_ERROR_INVALID_PARAMETERis_app is invalid
CSR_ERROR_SYSTEMSystem 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.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
malware will be released when a context is released using csr_cs_context_destroy().
Parameters:
[in]listA detected malware list handle returned by csr_cs_get_detected_malwares() or csr_cs_get_ignored_malwares()
[in]indexAn index of a target detected malware handle to get
[out]malwareA pointer of the detected malware handle. It can be null when index is invalid
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid list
CSR_ERROR_INVALID_PARAMETERindex or malware is invalid
CSR_ERROR_SYSTEMSystem 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.

Warning:
This is not for use by third-party applications.

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.

Since :
3.0
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/antivirus.scan
Remarks:
Scan data synchronously.
malware will be released when handle is released using csr_cs_context_destroy().
If multiple malwares exists in data, the malware with the highest severity will be returned.
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]dataA scan target data
[in]lengthA size of a scan target data
[out]malwareA pointer of the detected malware handle. It can be null when no malware detected
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_OUT_OF_MEMORYNot enough memory
CSR_ERROR_INVALID_PARAMETERdata or malware is invalid
CSR_ERROR_PERMISSION_DENIEDNo privilege to call
CSR_ERROR_NOT_SUPPORTEDDevice needed to run API is not supported
CSR_ERROR_SOCKETSocket error between client and server
CSR_ERROR_SERVERServer has been failed for some reason
CSR_ERROR_USER_RESPONSE_FAILEDGetting user response is failed. malware will be allocated on this error
CSR_ERROR_ENGINE_NOT_EXISTNo engine exists
CSR_ERROR_ENGINE_DISABLEDEngine is in disabled state
CSR_ERROR_ENGINE_NOT_ACTIVATEDEngine is not activated
CSR_ERROR_ENGINE_INTERNALEngine Internal error
CSR_ERROR_SYSTEMSystem error
See also:
csr_cs_context_create()
csr_cs_context_destroy()
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.

Warning:
This is not for use by third-party applications.

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.

Since :
3.0
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/antivirus.scan
Remarks:
Asynchronous function.
The caller should set callback functions before calling this method.
Detected malware which is provided to the callback will be released when handle is released using csr_cs_context_destroy().
If multiple malwares exists in a file, the malware with the highest severity will be returned for the file via csr_cs_set_detected_cb().
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]dir_pathA path of scan target directory
[in]user_dataThe pointer of a user data. It can be null. It is used on the callback functions which are registered to handle
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_OUT_OF_MEMORYNot enough memory
CSR_ERROR_INVALID_PARAMETERdir_path is invalid
CSR_ERROR_PERMISSION_DENIEDAccess denied
CSR_ERROR_NOT_SUPPORTEDDevice needed to run API is not supported
CSR_ERROR_BUSYBusy for processing another request
CSR_ERROR_FILE_DO_NOT_EXISTFile not found
CSR_ERROR_FILE_SYSTEMFile type is invalid. It should be directory
CSR_ERROR_SOCKETSocket error between client and server
CSR_ERROR_SERVERServer has been failed for some reason
CSR_ERROR_DBDB transaction error
CSR_ERROR_ENGINE_PERMISSIONInsufficient permission of engine
CSR_ERROR_ENGINE_NOT_EXISTNo engine exists
CSR_ERROR_ENGINE_DISABLEDEngine is in disabled state
CSR_ERROR_ENGINE_NOT_ACTIVATEDEngine is not activated
CSR_ERROR_ENGINE_INTERNALEngine Internal error
CSR_ERROR_SYSTEMSystem error
Precondition:
It is required to set callbacks, csr_cs_completed_cb, csr_cs_error_cb(), csr_cs_cancel_scanning(), csr_cs_detected_cb(), and/or csr_cs_file_scanned_cb().
See also:
csr_cs_set_file_scanned_cb()
csr_cs_set_detected_cb()
csr_cs_set_completed_cb()
csr_cs_set_cancelled_cb()
csr_cs_set_error_cb()
csr_cs_cancel_scanning()
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.

Warning:
This is not for use by third-party applications.

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.

Since :
3.0
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/antivirus.scan
Remarks:
Asynchronous function.
The caller should set callback functions before calls this method.
Detected malware which is provided to the callback will be released when handle is released using csr_cs_context_destroy().
If multiple malwares exists in a file, the malware with the highest severity will be returned for the file via csr_cs_set_detected_cb().
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]dir_pathsAn array of scan target directories
[in]countA number of scan target directories
[in]user_dataThe pointer of a user data. It can be null. It is used on the callback functions which are registered to handle
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_OUT_OF_MEMORYNot enough memory
CSR_ERROR_INVALID_PARAMETERdir_paths is invalid
CSR_ERROR_PERMISSION_DENIEDAccess denied
CSR_ERROR_NOT_SUPPORTEDDevice needed to run API is not supported
CSR_ERROR_BUSYBusy for processing another request
CSR_ERROR_FILE_DO_NOT_EXISTFile not found
CSR_ERROR_FILE_SYSTEMFile type is invalid. It should be directory
CSR_ERROR_SOCKETSocket error between client and server
CSR_ERROR_SERVERServer has been failed for some reason
CSR_ERROR_DBDB transaction error
CSR_ERROR_ENGINE_PERMISSIONInsufficient permission of engine
CSR_ERROR_ENGINE_NOT_EXISTNo engine exists
CSR_ERROR_ENGINE_DISABLEDEngine is in disabled state
CSR_ERROR_ENGINE_NOT_ACTIVATEDEngine is not activated
CSR_ERROR_ENGINE_INTERNALEngine Internal error
CSR_ERROR_SYSTEMSystem error
Precondition:
It is required to set callbacks, csr_cs_completed_cb, csr_cs_error_cb(), csr_cs_cancel_scanning(), csr_cs_detected_cb(), and/or csr_cs_file_scanned_cb().
See also:
csr_cs_set_file_scanned_cb()
csr_cs_set_detected_cb()
csr_cs_set_completed_cb()
csr_cs_set_cancelled_cb()
csr_cs_set_error_cb()
csr_cs_cancel_scanning()
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.

Warning:
This is not for use by third-party applications.
Since :
3.0
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/antivirus.scan
Remarks:
Scan file synchronously.
malware will be released when handle is released using csr_cs_context_destroy().
If multiple malwares exists in a file, the malware with the highest severity will be returned.
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]file_pathA path of scan target file
[out]malwareA pointer of the detected malware handle. It can be null when no malware detected
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_OUT_OF_MEMORYNot enough memory
CSR_ERROR_INVALID_PARAMETERfile_path or malware is invalid
CSR_ERROR_PERMISSION_DENIEDAccess denied
CSR_ERROR_NOT_SUPPORTEDDevice needed to run API is not supported
CSR_ERROR_DBDB transaction error
CSR_ERROR_REMOVE_FAILEDRemoving 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_FAILEDGetting user response is failed malware will be allocated on this error
CSR_ERROR_FILE_DO_NOT_EXISTFile not found
CSR_ERROR_SOCKETSocket error between client and server
CSR_ERROR_SERVERServer has been failed for some reason
CSR_ERROR_ENGINE_NOT_EXISTNo engine exists
CSR_ERROR_ENGINE_DISABLEDEngine is in disabled state
CSR_ERROR_ENGINE_NOT_ACTIVATEDEngine is not activated
CSR_ERROR_ENGINE_PERMISSIONInsufficient permission of engine
CSR_ERROR_ENGINE_INTERNALEngine Internal error
CSR_ERROR_SYSTEMSystem error
See also:
csr_cs_context_create()
csr_cs_context_destroy()
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.

Warning:
This is not for use by third-party applications.

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.

Since :
3.0
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/antivirus.scan
Remarks:
Asynchronous function.
The caller should set callback functions before calling this method.
Detected malware which is provided to the callback will be released when handle is released using csr_cs_context_destroy().
If multiple malwares exists in a file, the malware with the highest severity will be returned for the file via csr_cs_set_detected_cb().
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]file_pathsAn array of scan target files
[in]countA number of scan target files
[in]user_dataThe pointer of a user data. It can be null. It is delivered back to the client when a callback function is called
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_OUT_OF_MEMORYNot enough memory
CSR_ERROR_INVALID_PARAMETERfile_paths is invalid
CSR_ERROR_PERMISSION_DENIEDAccess denied
CSR_ERROR_NOT_SUPPORTEDDevice needed to run API is not supported
CSR_ERROR_BUSYBusy for processing another request
CSR_ERROR_FILE_DO_NOT_EXISTFile not found
CSR_ERROR_SOCKETSocket error between client and server
CSR_ERROR_SERVERServer has been failed for some reason
CSR_ERROR_DBDB transaction error
CSR_ERROR_ENGINE_PERMISSIONInsufficient permission of engine
CSR_ERROR_ENGINE_NOT_EXISTNo engine exists
CSR_ERROR_ENGINE_DISABLEDEngine is in disabled state
CSR_ERROR_ENGINE_NOT_ACTIVATEDEngine is not activated
CSR_ERROR_ENGINE_INTERNALEngine Internal error
CSR_ERROR_SYSTEMSystem error
Precondition:
It is required to set callbacks, csr_cs_completed_cb, csr_cs_error_cb(), csr_cs_cancel_scanning(), csr_cs_detected_cb(), and/or csr_cs_file_scanned_cb().
See also:
csr_cs_set_file_scanned_cb()
csr_cs_set_detected_cb()
csr_cs_set_completed_cb()
csr_cs_set_cancelled_cb()
csr_cs_set_error_cb()
csr_cs_cancel_scanning()
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.

Warning:
This is not for use by third-party applications.

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.

Since :
3.0
Remarks:
This option is disabled(CSR_CS_ASK_USER_NO) as a default.
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]ask_userPopup option to set or unset
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_INVALID_PARAMETERask_user is invalid
CSR_ERROR_SYSTEMSystem error
See also:
csr_cs_context_create()
csr_cs_context_destroy()

Sets a callback function for scanning cancelled.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
Callback for asynchronous scan functions.
Client can cancel asynchronous scanning by csr_cs_cancel_scanning().
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]callbackA callback function for scanning cancelled
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_INVALID_PARAMETERcallback is invalid
CSR_ERROR_SYSTEMSystem error
See also:
csr_cs_scan_files_async()
csr_cs_scan_dir_async()
csr_cs_scan_dirs_async()
csr_cs_cancel_scanning()

Sets a callback function for scanning completed without an error.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
Callback for asynchronous scan functions.
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]callbackA callback function for scanning completed successfully
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_INVALID_PARAMETERcallback is invalid
CSR_ERROR_SYSTEMSystem error
See also:
csr_cs_scan_files_async()
csr_cs_scan_dir_async()
csr_cs_scan_dirs_async()

Sets a maximum core usage during scanning.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
If a core usage is not set, CSR_CS_CORE_USAGE_DEFAULT will be used.
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]usageA maximum core usage during scanning
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_INVALID_PARAMETERusage is invalid
CSR_ERROR_SYSTEMSystem error
See also:
csr_cs_context_create()
csr_cs_context_destroy()

Sets a callback function for detection of a malware.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
Callback for asynchronous scan functions.
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]callbackA callback function for each file or application scanning done with malware detected
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_INVALID_PARAMETERcallback is invalid
CSR_ERROR_SYSTEMSystem error
See also:
csr_cs_scan_files_async()
csr_cs_scan_dir_async()
csr_cs_scan_dirs_async()
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.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
Callback for asynchronous scan functions.
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]callbackA callback function for scanning stopped due to an error
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_INVALID_PARAMETERcallback is invalid
CSR_ERROR_SYSTEMSystem error
See also:
csr_cs_scan_files_async()
csr_cs_scan_dir_async()
csr_cs_scan_dirs_async()

Sets a callback function for the case that a file scan is completed.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
Callback for asynchronous scan functions.
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]callbackA callback function for each file or application scanning done without any malware.
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_INVALID_PARAMETERcallback is invalid
CSR_ERROR_SYSTEMSystem error
See also:
csr_cs_scan_files_async()
csr_cs_scan_dir_async()
csr_cs_scan_dirs_async()
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.

Warning:
This is not for use by third-party applications.

Default message is "Malware which may harm your device is detected."

Since :
3.0
Remarks:
Meaningful only when ask user option is set by csr_cs_set_ask_user().
The message will be printed on popup for user.
Default popup message will be used if it isn't set.
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]messageA message to print on a popup
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_INVALID_PARAMETERmessage is too long or empty. Max size is 64 bytes
CSR_ERROR_SYSTEMSystem error
See also:
csr_cs_context_create()
csr_cs_context_destroy()
int csr_cs_set_scan_on_cloud ( csr_cs_context_h  handle,
bool  scan_on_cloud 
)

Sets a scan on cloud option.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
Scan on cloud option is turned off as a default.
If an engine does not support "scanning on cloud", this option is silently ignored.
Parameters:
[in]handleCSR CS context handle returned by csr_cs_context_create()
[in]scan_on_cloudFlag of scanning on cloud option
Returns:
CSR_ERROR_NONE on success, otherwise a negative error value
Return values:
CSR_ERROR_NONESuccessful
CSR_ERROR_INVALID_HANDLEInvalid handle
CSR_ERROR_SYSTEMSystem error
See also:
csr_cs_context_create()
csr_cs_context_destroy()