Tizen Native API  5.0
Web Protection Module

It provides provides APIs checking URL reputation to see if the URL is risky or not.

Required Header

#include <csr-web-protection.h> #include <csr-web-protection-types.h>

Overview

It provides provides APIs checking URL reputation to see if the URL is risky or not. Actual operation is performed by an underlying anti malware engine which will be provided by a device manufacturer.

Functions

int csr_wp_context_create (csr_wp_context_h *handle)
 Initializes and returns a CSR Web Protection API handle.
int csr_wp_context_destroy (csr_wp_context_h handle)
 Releases all system resources associated with a Web Protection API handle.
int csr_wp_set_ask_user (csr_wp_context_h handle, csr_wp_ask_user_e ask_user)
 Sets a popup option for risky URL checked.
int csr_wp_set_popup_message (csr_wp_context_h handle, const char *message)
 Sets a popup message of a client in case for a risky URL.
int csr_wp_check_url (csr_wp_context_h handle, const char *url, csr_wp_check_result_h *result)
 Checks URL reputation against the engine vendor's database.
int csr_wp_result_get_risk_level (csr_wp_check_result_h result, csr_wp_risk_level_e *level)
 Extracts a risk level of the url from the result handle.
int csr_wp_result_get_detailed_url (csr_wp_check_result_h result, char **detailed_url)
 Extracts an url of vendor's web site that contains detailed information about the risk from the result handle.
int csr_wp_result_get_user_response (csr_wp_check_result_h result, csr_wp_user_response_e *response)
 Extracts a user response of a popup from the result handle.

Typedefs

typedef struct __csr_wp_context_s * csr_wp_context_h
 CSR WP context handle.
typedef struct
__csr_wp_check_result_h * 
csr_wp_check_result_h
 CSR WP scan result handle.

Typedef Documentation

typedef struct __csr_wp_check_result_h* csr_wp_check_result_h

CSR WP scan result handle.

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

CSR WP context handle.

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

Enumeration Type Documentation

Enumeration for the options about prompting a popup to a user.

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

Do not ask the user even if a URL turns out risky.

CSR_WP_ASK_USER_YES 

Ask the user when a URL turns out risky

Enumeration for risk level of a url.

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

Risk Low.

CSR_WP_RISK_UNVERIFIED 

Risk Unverified. There is no information about the url.

CSR_WP_RISK_MEDIUM 

Risk Medium. Prompt the user before processing. Ask the user if they want the application to process the url.

CSR_WP_RISK_HIGH 

High Risk.Do not process the url and just notify the user

Enumeration for the user response for a popup.

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

There was no popup for asking the user.

CSR_WP_USER_RESPONSE_PROCESSING_ALLOWED 

A user allowed to process the url.

CSR_WP_USER_RESPONSE_PROCESSING_DISALLOWED 

A user disallowed to process the url.


Function Documentation

int csr_wp_check_url ( csr_wp_context_h  handle,
const char *  url,
csr_wp_check_result_h result 
)

Checks URL reputation against the engine vendor's database.

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

Checks whether accessing the URL is risky or not and returns a result handle with the risk level for the URL.

Since :
3.0
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/antivirus.webprotect
Remarks:
result will be released when handle is released using csr_wp_context_destroy().
Parameters:
[in]handleCSR WP context handle returned by csr_wp_context_create()
[in]urlURL to check
[out]resultA pointer of the result handle with the Risk level for the URL
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_PERMISSION_DENIEDPermission denied
CSR_ERROR_NOT_SUPPORTEDDevice needed to run API is not supported
CSR_ERROR_INVALID_PARAMETERurl or result is invalid
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. result 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_wp_context_create()
csr_wp_set_ask_user()
csr_wp_set_popup_message()

Initializes and returns a CSR Web Protection API handle.

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

A Web Protection API handle (or CSR WP handle) is obtained by this method. The handle is required for subsequent CSR WP API calls.

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

Releases all system resources associated with a Web Protection API handle.

Warning:
This is not for use by third-party applications.
Since :
3.0
Parameters:
[in]handleCSR WP context handle returned by csr_wp_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_SERVERServer has been failed for some reason
CSR_ERROR_ENGINE_INTERNALEngine Internal error
CSR_ERROR_SYSTEMSystem error
See also:
csr_wp_context_create()
int csr_wp_result_get_detailed_url ( csr_wp_check_result_h  result,
char **  detailed_url 
)

Extracts an url of vendor's web site that contains detailed information about the risk from the result handle.

Warning:
This is not for use by third-party applications.
Since :
3.0
Remarks:
detailed_url must be released using free().
Parameters:
[in]resultA result handle returned by csr_wp_check_url()
[out]detailed_urlA pointer of an url that contains detailed information about the risk If the risk level is CSR_WP_RISK_MEDIUM or CSR_WP_RISK_HIGH, this url should be provided by the engine
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_PARAMETERdetailed_url is invalid
CSR_ERROR_SYSTEMSystem error
See also:
csr_wp_check_url()

Extracts a risk level of the url from the result handle.

Warning:
This is not for use by third-party applications.
Since :
3.0
Parameters:
[in]resultA result handle returned by csr_wp_check_url()
[out]levelA pointer of the risk level for the given URL
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_PARAMETERlevel is invalid
CSR_ERROR_SYSTEMSystem error
See also:
csr_wp_check_url()

Extracts a user response of a popup from the result handle.

Warning:
This is not for use by third-party applications.
Since :
3.0
Parameters:
[in]resultA result handle returned by csr_wp_check_url()
[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
See also:
csr_wp_check_url()
csr_wp_user_response_e
int csr_wp_set_ask_user ( csr_wp_context_h  handle,
csr_wp_ask_user_e  ask_user 
)

Sets a popup option for risky URL checked.

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

If CSR_WP_ASK_USER_YES is set, a popup will be prompted to a user when a URL turns out risky. If CSR_WP_ASK_USER_NO is set, no popup will be prompted even when a URL turns out risky.

Since :
3.0
Remarks:
This option is disabled(CSR_WP_ASK_USER_NO) as a default.
Parameters:
[in]handleCSR WP context handle returned by csr_wp_context_create()
[in]ask_userA popup option in case for a risky URL
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_wp_context_create()
int csr_wp_set_popup_message ( csr_wp_context_h  handle,
const char *  message 
)

Sets a popup message of a client in case for a risky URL.

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

Default message is "Risky URL which may harm your device is detected".

Since :
3.0
Remarks:
Meaningful only when ask user option is set by csr_wp_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 WP context handle returned by csr_wp_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_wp_context_create()