From 28e11b1ad3b91fea8d02513a04147feec65edb0c Mon Sep 17 00:00:00 2001 From: Dongsun Lee Date: Tue, 31 May 2016 14:13:00 +0900 Subject: [PATCH] APIs and description changed for ACR - enum name change : CSR_ENABLE -> CSR_STATE_ENABLE, CSR_DISABLE -> CSR_STATE_DISABLE - error code change : CSR_ERROR_UNKNOWN -> CSR_ERROR_SYSTEM - user_data parameter after other parameters in callback functions - error description for error callback - @pre tag added in async scanning method - csr_cs_cancel_scanning description changed - @detail tag right after @brief Change-Id: Ib0c60f40a43fd14ba10e5f2758d1ebc7f3512e23 Signed-off-by: Dongsun Lee --- src/framework/client/async-logic.cpp | 8 +- src/framework/client/callback.h | 6 +- src/framework/client/engine-manager.cpp | 4 +- src/framework/client/utils.cpp | 4 +- src/framework/service/cs-logic.cpp | 6 +- src/framework/service/em-logic.cpp | 18 +-- src/framework/service/exception.cpp | 4 +- src/framework/service/wp-logic.cpp | 2 +- src/include/csr/csr-content-screening-types.h | 24 ++-- src/include/csr/csr-content-screening.h | 165 ++++++++++++++------------ src/include/csr/csr-engine-manager.h | 22 ++-- src/include/csr/csr-error.h | 4 +- src/include/csr/csr-web-protection.h | 40 +++---- test/internals/test-db.cpp | 12 +- test/test-api-content-screening-async.cpp | 6 +- test/test-api-engine-manager.cpp | 36 +++--- test/test-common.cpp | 2 +- test/test-main.cpp | 4 +- 18 files changed, 193 insertions(+), 174 deletions(-) diff --git a/src/framework/client/async-logic.cpp b/src/framework/client/async-logic.cpp index 02da879..72e7b5f 100644 --- a/src/framework/client/async-logic.cpp +++ b/src/framework/client/async-logic.cpp @@ -82,7 +82,7 @@ AsyncLogic::Ending AsyncLogic::scanDir(const std::string &dir) auto ec = retFiles.first; return std::make_pair(Callback::Id::OnError, [this, ec] { if (this->m_cb.onError) - this->m_cb.onError(this->m_userdata, ec); + this->m_cb.onError(ec, this->m_userdata); }); } @@ -143,7 +143,7 @@ AsyncLogic::Ending AsyncLogic::scanFiles(const StrSet &fileSet) auto ec = ret.first; return std::make_pair(Callback::Id::OnError, [this, ec] { if (this->m_cb.onError) - this->m_cb.onError(this->m_userdata, ec); + this->m_cb.onError(ec, this->m_userdata); return; }); @@ -154,12 +154,12 @@ AsyncLogic::Ending AsyncLogic::scanFiles(const StrSet &fileSet) m_results.emplace_back(std::move(resultPtr)); if (m_cb.onDetected) - m_cb.onDetected(m_userdata, reinterpret_cast(ret.second)); + m_cb.onDetected(reinterpret_cast(ret.second), m_userdata); } else { DEBUG("[Scanned] file[" << file << "]"); if (m_cb.onScanned) - m_cb.onScanned(m_userdata, file.c_str()); + m_cb.onScanned(file.c_str(), m_userdata); } } diff --git a/src/framework/client/callback.h b/src/framework/client/callback.h index c21c2f5..8927fda 100644 --- a/src/framework/client/callback.h +++ b/src/framework/client/callback.h @@ -58,11 +58,11 @@ struct Callback { return *this; } - std::function onScanned; - std::function onDetected; + std::function onScanned; + std::function onDetected; std::function onCompleted; std::function onCancelled; - std::function onError; + std::function onError; }; } diff --git a/src/framework/client/engine-manager.cpp b/src/framework/client/engine-manager.cpp index 32b9bf6..dd8d564 100644 --- a/src/framework/client/engine-manager.cpp +++ b/src/framework/client/engine-manager.cpp @@ -71,8 +71,8 @@ bool _isValid(const csr_engine_id_e &id) noexcept bool _isValid(const csr_state_e &state) noexcept { switch (state) { - case CSR_ENABLE: - case CSR_DISABLE: + case CSR_STATE_ENABLE: + case CSR_STATE_DISABLE: return true; default: diff --git a/src/framework/client/utils.cpp b/src/framework/client/utils.cpp index 7a21525..ba54100 100644 --- a/src/framework/client/utils.cpp +++ b/src/framework/client/utils.cpp @@ -51,10 +51,10 @@ int exceptionGuard(const std::function &func) return CSR_ERROR_OUT_OF_MEMORY; } catch (const std::exception &e) { ERROR("std exception: " << e.what()); - return CSR_ERROR_UNKNOWN; + return CSR_ERROR_SYSTEM; } catch (...) { ERROR("Unknown exception occured!"); - return CSR_ERROR_UNKNOWN; + return CSR_ERROR_SYSTEM; } } diff --git a/src/framework/service/cs-logic.cpp b/src/framework/service/cs-logic.cpp index 100d5e4..7400fb7 100644 --- a/src/framework/service/cs-logic.cpp +++ b/src/framework/service/cs-logic.cpp @@ -64,7 +64,7 @@ RawBuffer CsLogic::scanData(const CsContext &context, const RawBuffer &data) { EXCEPTION_GUARD_START - if (this->m_db.getEngineState(CSR_ENGINE_CS) != CSR_ENABLE) + if (this->m_db.getEngineState(CSR_ENGINE_CS) != CSR_STATE_ENABLE) ThrowExc(EngineDisabled, "engine is disabled"); setCoreUsage(context.coreUsage); @@ -317,7 +317,7 @@ RawBuffer CsLogic::scanFile(const CsContext &context, const std::string &filepat { EXCEPTION_GUARD_START - if (this->m_db.getEngineState(CSR_ENGINE_CS) != CSR_ENABLE) + if (this->m_db.getEngineState(CSR_ENGINE_CS) != CSR_STATE_ENABLE) ThrowExc(EngineDisabled, "engine is disabled"); setCoreUsage(context.coreUsage); @@ -392,7 +392,7 @@ RawBuffer CsLogic::getScannableFiles(const std::string &dir) { EXCEPTION_GUARD_START - if (this->m_db.getEngineState(CSR_ENGINE_CS) != CSR_ENABLE) + if (this->m_db.getEngineState(CSR_ENGINE_CS) != CSR_STATE_ENABLE) ThrowExc(EngineDisabled, "engine is disabled"); auto lastScanTime = this->m_db.getLastScanTime(dir, this->m_dataVersion); diff --git a/src/framework/service/em-logic.cpp b/src/framework/service/em-logic.cpp index a1370d8..88e2581 100644 --- a/src/framework/service/em-logic.cpp +++ b/src/framework/service/em-logic.cpp @@ -49,8 +49,8 @@ bool _isValid(const csr_engine_id_e &id) bool _isValid(const csr_state_e &state) { switch (state) { - case CSR_ENABLE: - case CSR_DISABLE: + case CSR_STATE_ENABLE: + case CSR_STATE_DISABLE: return true; default: @@ -69,7 +69,7 @@ RawBuffer EmLogic::getEngineName(const EmContext &context) { EXCEPTION_GUARD_START - if (this->m_db.getEngineState(context.engineId) != CSR_ENABLE) + if (this->m_db.getEngineState(context.engineId) != CSR_STATE_ENABLE) ThrowExc(EngineDisabled, "engine is disabled"); if (context.engineId == CSR_ENGINE_CS) { @@ -97,7 +97,7 @@ RawBuffer EmLogic::getEngineVendor(const EmContext &context) { EXCEPTION_GUARD_START - if (this->m_db.getEngineState(context.engineId) != CSR_ENABLE) + if (this->m_db.getEngineState(context.engineId) != CSR_STATE_ENABLE) ThrowExc(EngineDisabled, "engine is disabled"); if (context.engineId == CSR_ENGINE_CS) { @@ -125,7 +125,7 @@ RawBuffer EmLogic::getEngineVersion(const EmContext &context) { EXCEPTION_GUARD_START - if (this->m_db.getEngineState(context.engineId) != CSR_ENABLE) + if (this->m_db.getEngineState(context.engineId) != CSR_STATE_ENABLE) ThrowExc(EngineDisabled, "engine is disabled"); if (context.engineId == CSR_ENGINE_CS) { @@ -153,7 +153,7 @@ RawBuffer EmLogic::getEngineDataVersion(const EmContext &context) { EXCEPTION_GUARD_START - if (this->m_db.getEngineState(context.engineId) != CSR_ENABLE) + if (this->m_db.getEngineState(context.engineId) != CSR_STATE_ENABLE) ThrowExc(EngineDisabled, "engine is disabled"); if (context.engineId == CSR_ENGINE_CS) { @@ -181,7 +181,7 @@ RawBuffer EmLogic::getEngineUpdatedTime(const EmContext &context) { EXCEPTION_GUARD_START - if (this->m_db.getEngineState(context.engineId) != CSR_ENABLE) + if (this->m_db.getEngineState(context.engineId) != CSR_STATE_ENABLE) ThrowExc(EngineDisabled, "engine is disabled"); if (context.engineId == CSR_ENGINE_CS) { @@ -213,7 +213,7 @@ RawBuffer EmLogic::getEngineActivated(const EmContext &context) { EXCEPTION_GUARD_START - if (this->m_db.getEngineState(context.engineId) != CSR_ENABLE) + if (this->m_db.getEngineState(context.engineId) != CSR_STATE_ENABLE) ThrowExc(EngineDisabled, "engine is disabled"); csr_activated_e activated = CSR_NOT_ACTIVATED; @@ -263,7 +263,7 @@ RawBuffer EmLogic::getEngineState(const EmContext &context) auto state = this->m_db.getEngineState(context.engineId); return BinaryQueue::Serialize(CSR_ERROR_NONE, - static_cast(state) == -1 ? static_cast(CSR_DISABLE) : + static_cast(state) == -1 ? static_cast(CSR_STATE_DISABLE) : static_cast(state)).pop(); EXCEPTION_GUARD_END diff --git a/src/framework/service/exception.cpp b/src/framework/service/exception.cpp index 39979be..7e5bf95 100644 --- a/src/framework/service/exception.cpp +++ b/src/framework/service/exception.cpp @@ -45,10 +45,10 @@ RawBuffer exceptionGuard(const std::function &func) return BinaryQueue::Serialize(CSR_ERROR_OUT_OF_MEMORY).pop(); } catch (const std::exception &e) { ERROR("std exception: " << e.what()); - return BinaryQueue::Serialize(CSR_ERROR_UNKNOWN).pop(); + return BinaryQueue::Serialize(CSR_ERROR_SYSTEM).pop(); } catch (...) { ERROR("Unknown exception occured in logic"); - return BinaryQueue::Serialize(CSR_ERROR_UNKNOWN).pop(); + return BinaryQueue::Serialize(CSR_ERROR_SYSTEM).pop(); } } diff --git a/src/framework/service/wp-logic.cpp b/src/framework/service/wp-logic.cpp index a25f095..6c7d824 100644 --- a/src/framework/service/wp-logic.cpp +++ b/src/framework/service/wp-logic.cpp @@ -43,7 +43,7 @@ RawBuffer WpLogic::checkUrl(const WpContext &context, const std::string &url) { EXCEPTION_GUARD_START - if (this->m_db.getEngineState(CSR_ENGINE_WP) != CSR_ENABLE) + if (this->m_db.getEngineState(CSR_ENGINE_WP) != CSR_STATE_ENABLE) ThrowExc(EngineDisabled, "engine is disabled"); WpEngineContext engineContext(this->m_loader); diff --git a/src/include/csr/csr-content-screening-types.h b/src/include/csr/csr-content-screening-types.h index e425fb1..bca3ced 100644 --- a/src/include/csr/csr-content-screening-types.h +++ b/src/include/csr/csr-content-screening-types.h @@ -114,17 +114,17 @@ typedef struct __csr_cs_engine_s *csr_cs_engine_h; * @remarks Only for asynchronous scan functions. * @remarks Called for each file or application which is not detected malware. * - * @param[in] user_data A pointer of a user data. It's provided by client - * when calling asyncronous scanning method. * @param[in] file_path A path of the file scanned. It would be package path if it's * in application. + * @param[in] user_data A pointer of a user data. It's provided by client + * when calling asyncronous scanning method. * * @see csr_cs_set_file_scanned_cb() * @see csr_cs_scan_files_async() * @see csr_cs_scan_dir_async() * @see csr_cs_scan_dirs_async() */ -typedef void (*csr_cs_file_scanned_cb)(void *user_data, const char *file_path); +typedef void (*csr_cs_file_scanned_cb)(const char *file_path, void *user_data); /** * @brief Called when each file scanning is done with malware. @@ -134,16 +134,16 @@ typedef void (*csr_cs_file_scanned_cb)(void *user_data, const char *file_path); * @remarks Only for asynchronous scan functions. * @remarks Called for each file or application which is detected malware. * + * @param[in] malware The detected malware handle. * @param[in] user_data A pointer of a user data. It's provided by client * when calling asyncronous scanning method. - * @param[in] malware The detected malware handle. * * @see csr_cs_set_detected_cb() * @see csr_cs_scan_files_async() * @see csr_cs_scan_dir_async() * @see csr_cs_scan_dirs_async() */ -typedef void (*csr_cs_detected_cb)(void *user_data, csr_cs_malware_h malware); +typedef void (*csr_cs_detected_cb)(csr_cs_malware_h malware, void *user_data); /** * @brief Called when scanning is finished successfully. @@ -185,21 +185,31 @@ typedef void (*csr_cs_cancelled_cb)(void *user_data); /** * @brief Called when scanning is stopped with an error. * + * @details The following error codes can be delivered.\n + * #CSR_ERROR_FILE_DO_NOT_EXIST,\n + * #CSR_ERROR_SOCKET,\n + * #CSR_ERROR_SERVER,\n + * #CSR_ERROR_ENGINE_NOT_EXIST,\n + * #CSR_ERROR_ENGINE_DISABLED,\n + * #CSR_ERROR_ENGINE_NOT_ACTIVATED,\n + * #CSR_ERROR_ENGINE_PERMISSION,\n + * #CSR_ERROR_ENGINE_INTERNAL + * * @since_tizen 3.0 * * @remarks Only for asynchronous scan functions. * @remarks Called only once at the end of scanning when failed with error. * + * @param[in] error_code Error code of #csr_error_e defined in csr-error.h * @param[in] user_data A pointer of a user data. It's provided by client * when calling asynchronous scanning method. - * @param[in] error_code Error code of #csr_error_e defined in csr-error.h * * @see csr_cs_set_error_cb() * @see csr_cs_scan_files_async() * @see csr_cs_scan_dir_async() * @see csr_cs_scan_dirs_async() */ -typedef void (*csr_cs_error_cb)(void *user_data, int error_code); +typedef void (*csr_cs_error_cb)(int error_code, void *user_data); /** * @} diff --git a/src/include/csr/csr-content-screening.h b/src/include/csr/csr-content-screening.h index 480c567..0b6f1b2 100644 --- a/src/include/csr/csr-content-screening.h +++ b/src/include/csr/csr-content-screening.h @@ -42,14 +42,14 @@ extern "C" { /** * @brief Initializes and returns a Content Screening API handle. * + * @details 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_tizen 3.0 * * @remarks The @a handle should be released using csr_cs_context_destroy(). * @remarks Multiple handles can be obtained. * - * @details A Content Screening API handle (or CSR CS handle) is obtained by this method. - * The handle is required for subsequent CSR CS API calls. - * * @param[out] handle A pointer of CSR CS context handle. * * @return #CSR_ERROR_NONE on success, otherwise a negative error value @@ -57,7 +57,7 @@ extern "C" { * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE @a handle may be null * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_cs_context_destroy() */ @@ -75,7 +75,7 @@ int csr_cs_context_create(csr_cs_context_h *handle); * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle * @retval #CSR_ERROR_SOCKET Socket error between client and server - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_cs_context_create() */ @@ -84,16 +84,16 @@ int csr_cs_context_destroy(csr_cs_context_h handle); /** * @brief Sets a popup option for malware detected. * - * @since_tizen 3.0 - * - * @remarks This option is disabled(#CSR_CS_NOT_ASK_USER) as a default. - * * @details If #CSR_CS_ASK_USER is set, a popup will be prompted to a user when a malware * is detected. If #CSR_CS_NOT_ASK_USER 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_tizen 3.0 + * + * @remarks This option is disabled(#CSR_CS_NOT_ASK_USER) as a default. + * * @param[in] handle CSR CS context handle returned by csr_cs_context_create(). * @param[in] ask_user Popup option to set or unset. * @@ -102,7 +102,7 @@ int csr_cs_context_destroy(csr_cs_context_h handle); * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle * @retval #CSR_ERROR_INVALID_PARAMETER @a ask_user is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_cs_context_create() * @see csr_cs_context_destroy() @@ -112,14 +112,14 @@ int csr_cs_set_ask_user(csr_cs_context_h handle, csr_cs_ask_user_e ask_user); /** * @brief Sets a popup message of a client in case that a malware is detected. * + * @details Default message is "Malware which may harm your device is detected.". + * * @since_tizen 3.0 * * @remarks Meaningful only when ask user option is set by csr_cs_set_ask_user(). * @remarks The message will be printed on popup for user. * @remarks Default popup message will be used if it isn't set. * - * @details Default message is "Malware which may harm your device is detected.". - * * @param[in] handle CSR CS context handle returned by csr_cs_context_create(). * @param[in] message A message to print on a popup. * @@ -129,7 +129,7 @@ int csr_cs_set_ask_user(csr_cs_context_h handle, csr_cs_ask_user_e ask_user); * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle * @retval #CSR_ERROR_INVALID_PARAMETER @a message is too long or empty. Max size * is 64 bytes. - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_cs_context_create() * @see csr_cs_context_destroy() @@ -151,7 +151,7 @@ int csr_cs_set_popup_message(csr_cs_context_h handle, const char *message); * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle * @retval #CSR_ERROR_INVALID_PARAMETER @a usage is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_cs_context_create() * @see csr_cs_context_destroy() @@ -172,7 +172,7 @@ int csr_cs_set_core_usage(csr_cs_context_h handle, csr_cs_core_usage_e usage); * * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_cs_context_create() * @see csr_cs_context_destroy() @@ -182,6 +182,10 @@ int csr_cs_set_scan_on_cloud(csr_cs_context_h handle); /** * @brief Scans a data buffer for malware. * + * @details @a malware result of this method is not available for being judged by + * csr_cs_judge_detected_malware() because it's data, not file, so cannot being + * removed or ignored. + * * @since_tizen 3.0 * @privlevel partner * @privilege %http://tizen.org/privilege/antivirus.scan @@ -190,10 +194,6 @@ int csr_cs_set_scan_on_cloud(csr_cs_context_h handle); * @remarks The @a malware will be released when @a handle is released using * csr_cs_context_destroy(). * - * @details @a malware result of this method is not available for being judged by - * csr_cs_judge_detected_malware() because it's data, not file, so cannot being - * removed or ignored. - * * @param[in] handle CSR CS context handle returned by csr_cs_context_create(). * @param[in] data A scan target data. * @param[in] length A size of a scan target data. @@ -214,7 +214,7 @@ int csr_cs_set_scan_on_cloud(csr_cs_context_h handle); * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_cs_context_create() * @see csr_cs_context_destroy() @@ -258,7 +258,7 @@ int csr_cs_scan_data(csr_cs_context_h handle, const unsigned char *data, size_t * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated * @retval #CSR_ERROR_ENGINE_PERMISSION Insufficient permission of engine * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_cs_context_create() * @see csr_cs_context_destroy() @@ -282,7 +282,7 @@ int csr_cs_scan_file(csr_cs_context_h handle, const char *file_path, * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_cs_scan_files_async() * @see csr_cs_scan_dir_async() @@ -306,7 +306,7 @@ int csr_cs_set_file_scanned_cb(csr_cs_context_h handle, csr_cs_file_scanned_cb c * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_cs_scan_files_async() * @see csr_cs_scan_dir_async() @@ -329,7 +329,7 @@ int csr_cs_set_detected_cb(csr_cs_context_h handle, csr_cs_detected_cb callback) * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_cs_scan_files_async() * @see csr_cs_scan_dir_async() @@ -353,7 +353,7 @@ int csr_cs_set_completed_cb(csr_cs_context_h handle, csr_cs_completed_cb callbac * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_cs_scan_files_async() * @see csr_cs_scan_dir_async() @@ -377,7 +377,7 @@ int csr_cs_set_cancelled_cb(csr_cs_context_h handle, csr_cs_cancelled_cb callbac * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle * @retval #CSR_ERROR_INVALID_PARAMETER @a callback is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_cs_scan_files_async() * @see csr_cs_scan_dir_async() @@ -388,15 +388,6 @@ int csr_cs_set_error_cb(csr_cs_context_h handle, csr_cs_error_cb callback); /** * @brief Scan files specified by an array of file paths for malware. * - * @since_tizen 3.0 - * @privlevel partner - * @privilege %http://tizen.org/privilege/antivirus.scan - * - * @remarks Asynchronous function. - * @remarks The caller should set callback functions before call this method. - * @remarks Detected malware which is provided to the callback will be released when - * @a handle is released using csr_cs_context_destroy(). - * * @details If scanning of the single file is done without detected malware, * csr_cs_file_scanned_cb() called and else if malware detected * csr_cs_detected_cb() called. If scanning is cancelled by @@ -406,6 +397,15 @@ int csr_cs_set_error_cb(csr_cs_context_h handle, csr_cs_error_cb callback); * setter methods to @a handle and if callback is not registered, it will just * skipped to be called. * + * @since_tizen 3.0 + * @privlevel partner + * @privilege %http://tizen.org/privilege/antivirus.scan + * + * @remarks Asynchronous function. + * @remarks The caller should set callback functions before call this method. + * @remarks Detected malware which is provided to the callback will be released when + * @a handle is released using csr_cs_context_destroy(). + * * @param[in] handle CSR CS context handle returned by csr_cs_context_create(). * @param[in] file_paths An array of scan target files. * @param[in] count A number of scan target files. @@ -430,7 +430,10 @@ int csr_cs_set_error_cb(csr_cs_context_h handle, csr_cs_error_cb callback); * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error + * + * @pre 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 csr_cs_set_file_scanned_cb() * @see csr_cs_set_detected_cb() @@ -445,15 +448,6 @@ int csr_cs_scan_files_async(csr_cs_context_h handle, const char *file_paths[], /** * @brief Scans a directory specified by directory path for malware. * - * @since_tizen 3.0 - * @privlevel partner - * @privilege %http://tizen.org/privilege/antivirus.scan - * - * @remarks Asynchronous function. - * @remarks The caller should set callback functions before calls this method. - * @remarks Detected malware which is provided to the callback will be released when - * @a handle is released using csr_cs_context_destroy(). - * * @details If scanning of the single file is done without detected malware, * csr_cs_file_scanned_cb() called and else if malware detected * csr_cs_detected_cb() called. If scanning is cancelled by @@ -463,6 +457,15 @@ int csr_cs_scan_files_async(csr_cs_context_h handle, const char *file_paths[], * setter methods to @a handle and if callback is not registered, it will just * skipped to be called. * + * @since_tizen 3.0 + * @privlevel partner + * @privilege %http://tizen.org/privilege/antivirus.scan + * + * @remarks Asynchronous function. + * @remarks The caller should set callback functions before calls this method. + * @remarks Detected malware which is provided to the callback will be released when + * @a handle is released using csr_cs_context_destroy(). + * * @param[in] handle CSR CS context handle returned by csr_cs_context_create(). * @param[in] dir_path A path of scan target directory. * @param[in] user_data The pointer of a user data. It can be null. It is used on @@ -486,7 +489,10 @@ int csr_cs_scan_files_async(csr_cs_context_h handle, const char *file_paths[], * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error + * + * @pre 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 csr_cs_set_file_scanned_cb() * @see csr_cs_set_detected_cb() @@ -500,15 +506,6 @@ int csr_cs_scan_dir_async(csr_cs_context_h handle, const char *dir_path, void *u /** * @brief Scan directories specified by an array of directory paths for malware. * - * @since_tizen 3.0 - * @privlevel partner - * @privilege %http://tizen.org/privilege/antivirus.scan - * - * @remarks Asynchronous function. - * @remarks The caller should set callback functions before calls this method. - * @remarks Detected malware which is provided to the callback will be released when - * @a handle is released using csr_cs_context_destroy(). - * * @details If scanning of the single file is done without detected malware, * csr_cs_file_scanned_cb() called and else if malware detected * csr_cs_detected_cb() called. If scanning is cancelled by @@ -518,6 +515,15 @@ int csr_cs_scan_dir_async(csr_cs_context_h handle, const char *dir_path, void *u * setter methods to @a handle and if callback is not registered, it will just * skipped to be called. * + * @since_tizen 3.0 + * @privlevel partner + * @privilege %http://tizen.org/privilege/antivirus.scan + * + * @remarks Asynchronous function. + * @remarks The caller should set callback functions before calls this method. + * @remarks Detected malware which is provided to the callback will be released when + * @a handle is released using csr_cs_context_destroy(). + * * @param[in] handle CSR CS context handle returned by csr_cs_context_create(). * @param[in] dir_paths An array of scan target directories. * @param[in] count A number of scan target directories. @@ -542,7 +548,10 @@ int csr_cs_scan_dir_async(csr_cs_context_h handle, const char *dir_path, void *u * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error + * + * @pre 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 csr_cs_set_file_scanned_cb() * @see csr_cs_set_detected_cb() @@ -556,7 +565,7 @@ int csr_cs_scan_dirs_async(csr_cs_context_h handle, const char *dir_paths[], siz /** - * @brief Cancels a running scanning task. + * @brief Cancels a running scanning task, asynchronously. * * @since_tizen 3.0 * @@ -569,7 +578,7 @@ int csr_cs_scan_dirs_async(csr_cs_context_h handle, const char *dir_paths[], siz * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle * @retval #CSR_ERROR_NO_TASK No task to cancel - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_cs_scan_files_async() * @see csr_cs_scan_dir_async() @@ -592,7 +601,7 @@ int csr_cs_cancel_scanning(csr_cs_context_h handle); * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle * @retval #CSR_ERROR_INVALID_PARAMETER @a severity is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error */ int csr_cs_malware_get_severity(csr_cs_malware_h malware, csr_cs_severity_level_e *severity); @@ -612,7 +621,7 @@ int csr_cs_malware_get_severity(csr_cs_malware_h malware, * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle * @retval #CSR_ERROR_INVALID_PARAMETER @a name is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error */ int csr_cs_malware_get_name(csr_cs_malware_h malware, char **name); @@ -634,7 +643,7 @@ int csr_cs_malware_get_name(csr_cs_malware_h malware, char **name); * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle * @retval #CSR_ERROR_INVALID_PARAMETER @a detailed_url is invalid. - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error */ int csr_cs_malware_get_detailed_url(csr_cs_malware_h malware, char **detailed_url); @@ -653,7 +662,7 @@ int csr_cs_malware_get_detailed_url(csr_cs_malware_h malware, char **detailed_ur * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle * @retval #CSR_ERROR_INVALID_PARAMETER @a timestamp is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error */ int csr_cs_malware_get_timestamp(csr_cs_malware_h malware, time_t *timestamp); @@ -674,7 +683,7 @@ int csr_cs_malware_get_timestamp(csr_cs_malware_h malware, time_t *timestamp); * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle * @retval #CSR_ERROR_INVALID_PARAMETER @a file_name is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error */ int csr_cs_malware_get_file_name(csr_cs_malware_h malware, char **file_name); @@ -691,7 +700,7 @@ int csr_cs_malware_get_file_name(csr_cs_malware_h malware, char **file_name); * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid result handle * @retval #CSR_ERROR_INVALID_PARAMETER @a response is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error */ int csr_cs_malware_get_user_response(csr_cs_malware_h malware, csr_cs_user_response_e *response); @@ -709,7 +718,7 @@ int csr_cs_malware_get_user_response(csr_cs_malware_h malware, * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid result handle * @retval #CSR_ERROR_INVALID_PARAMETER @a is_app is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error */ int csr_cs_malware_is_app(csr_cs_malware_h malware, bool *is_app); @@ -730,25 +739,25 @@ int csr_cs_malware_is_app(csr_cs_malware_h malware, bool *is_app); * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid detected malware handle * @retval #CSR_ERROR_INVALID_PARAMETER @a pkg_id is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error */ int csr_cs_malware_get_pkg_id(csr_cs_malware_h malware, char **pkg_id); /** * @brief Judges how a detected malware file is handled. * + * @details Detected malware will removed by #CSR_CS_ACTION_REMOVE action. File or + * application which contains malware will be removed. + * Detected malware will 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 called with #CSR_CS_ACTION_UNIGNORE action. + * * @since_tizen 3.0 * @privlevel platform * @privilege %http://tizen.org/privilege/antivirus.admin * * @remarks Detected malware can be removed or ignored. * - * @remarks Detected malware will removed by #CSR_CS_ACTION_REMOVE action. File or - * application which contains malware will be removed. - * Detected malware will 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 called with #CSR_CS_ACTION_UNIGNORE action. - * * @param[in] handle CSR CS context handle returned by csr_cs_context_create(). * @param[in] malware A handle of a detected malware. * @param[in] action An action to be taken. @@ -765,7 +774,7 @@ int csr_cs_malware_get_pkg_id(csr_cs_malware_h malware, char **pkg_id); * @retval #CSR_ERROR_SOCKET Socket error between client and server * @retval #CSR_ERROR_SERVER Server has been failed for some reason * @retval #CSR_ERROR_DB DB transaction error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #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); @@ -797,7 +806,7 @@ int csr_cs_judge_detected_malware(csr_cs_context_h handle, csr_cs_malware_h malw * @retval #CSR_ERROR_SOCKET Socket error between client and server * @retval #CSR_ERROR_SERVER Server has been failed for some reason * @retval #CSR_ERROR_DB DB transaction error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_cs_scan_data() * @see csr_cs_scan_file() @@ -834,7 +843,7 @@ int csr_cs_get_detected_malware(csr_cs_context_h handle, const char *file_path, * @retval #CSR_ERROR_SOCKET Socket error between client and server * @retval #CSR_ERROR_SERVER Server has been failed for some reason * @retval #CSR_ERROR_DB DB transaction error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #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, @@ -865,7 +874,7 @@ int csr_cs_get_detected_malwares(csr_cs_context_h handle, const char *dir_paths[ * @retval #CSR_ERROR_SOCKET Socket error between client and server * @retval #CSR_ERROR_SERVER Server has been failed for some reason * @retval #CSR_ERROR_DB DB transaction error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #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); @@ -898,7 +907,7 @@ int csr_cs_get_ignored_malware(csr_cs_context_h handle, const char *file_path, * @retval #CSR_ERROR_SOCKET Socket error between client and server * @retval #CSR_ERROR_SERVER Server has been failed for some reason * @retval #CSR_ERROR_DB DB transaction error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #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, @@ -921,7 +930,7 @@ int csr_cs_get_ignored_malwares(csr_cs_context_h handle, const char *dir_paths[] * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid list * @retval #CSR_ERROR_INVALID_PARAMETER @a index or @a malware is invalid. - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #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); diff --git a/src/include/csr/csr-engine-manager.h b/src/include/csr/csr-engine-manager.h index 85e1faa..fca211a 100644 --- a/src/include/csr/csr-engine-manager.h +++ b/src/include/csr/csr-engine-manager.h @@ -63,8 +63,8 @@ typedef enum { * @since_tizen 3.0 */ typedef enum { - CSR_ENABLE = 0x01, /**< Enable engine */ - CSR_DISABLE = 0x02 /**< Disable engine */ + CSR_STATE_ENABLE = 0x01, /**< Enable engine */ + CSR_STATE_DISABLE = 0x02 /**< Disable engine */ } csr_state_e; /** @@ -84,7 +84,7 @@ typedef enum { * @retval #CSR_ERROR_ENGINE_NOT_EXIST No engine exists * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_engine_destroy() */ @@ -109,7 +109,7 @@ int csr_get_current_engine(csr_engine_id_e id, csr_engine_h *engine); * @retval #CSR_ERROR_INVALID_PARAMETER @a vendor is invalid * @retval #CSR_ERROR_PERMISSION_DENIED Permission denied * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_get_current_engine() */ @@ -134,7 +134,7 @@ int csr_engine_get_vendor(csr_engine_h engine, char **vendor); * @retval #CSR_ERROR_INVALID_PARAMETER @a name is invalid * @retval #CSR_ERROR_PERMISSION_DENIED Permission denied * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_get_current_engine() */ @@ -159,7 +159,7 @@ int csr_engine_get_name(csr_engine_h engine, char **name); * @retval #CSR_ERROR_INVALID_PARAMETER @a version is invalid * @retval #CSR_ERROR_PERMISSION_DENIED Permission denied * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_get_current_engine() */ @@ -184,7 +184,7 @@ int csr_engine_get_version(csr_engine_h engine, char **version); * @retval #CSR_ERROR_INVALID_PARAMETER @a version is invalid * @retval #CSR_ERROR_PERMISSION_DENIED Permission denied * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_get_current_engine() */ @@ -207,7 +207,7 @@ int csr_engine_get_data_version(csr_engine_h engine, char **version); * @retval #CSR_ERROR_INVALID_PARAMETER @a time is invalid * @retval #CSR_ERROR_PERMISSION_DENIED Permission denied * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_get_current_engine() */ @@ -230,7 +230,7 @@ int csr_engine_get_latest_update_time(csr_engine_h engine, time_t *time); * @retval #CSR_ERROR_INVALID_PARAMETER @a activated is invalid * @retval #CSR_ERROR_PERMISSION_DENIED Permission denied * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_get_current_engine() */ @@ -256,7 +256,7 @@ int csr_engine_get_activated(csr_engine_h engine, csr_activated_e *activated); * @retval #CSR_ERROR_INVALID_PARAMETER @a state is invalid * @retval #CSR_ERROR_PERMISSION_DENIED Permission denied * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_get_current_engine() */ @@ -279,7 +279,7 @@ int csr_engine_set_state(csr_engine_h engine, csr_state_e state); * @retval #CSR_ERROR_INVALID_PARAMETER @a state is invalid * @retval #CSR_ERROR_PERMISSION_DENIED Permission denied * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_get_current_engine() */ diff --git a/src/include/csr/csr-error.h b/src/include/csr/csr-error.h index 7f5808f..4fc37ea 100644 --- a/src/include/csr/csr-error.h +++ b/src/include/csr/csr-error.h @@ -63,8 +63,8 @@ typedef enum { CSR_ERROR_ENGINE_NOT_EXIST = TIZEN_ERROR_CSR | 0x12, /**< No engine exists*/ CSR_ERROR_ENGINE_DISABLED = TIZEN_ERROR_CSR | 0x13, /**< Engine is in disabled state*/ CSR_ERROR_ENGINE_NOT_ACTIVATED = TIZEN_ERROR_CSR | 0x14, /**< Engine is not activated*/ - CSR_ERROR_ENGINE_INTERNAL = TIZEN_ERROR_CSR | 0x19, /**< Engine Internal error*/ - CSR_ERROR_UNKNOWN = TIZEN_ERROR_CSR | 0xFF, /**< The error with unknown reason */ + CSR_ERROR_ENGINE_INTERNAL = TIZEN_ERROR_CSR | 0x19, /**< Engine internal error*/ + CSR_ERROR_SYSTEM = TIZEN_ERROR_CSR | 0xFF, /**< System error*/ } csr_error_e; diff --git a/src/include/csr/csr-web-protection.h b/src/include/csr/csr-web-protection.h index 3d8cded..2f8e58d 100644 --- a/src/include/csr/csr-web-protection.h +++ b/src/include/csr/csr-web-protection.h @@ -38,14 +38,14 @@ extern "C" { /** * @brief Initializes and returns a CSR Web Protection API handle. * + * @details 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_tizen 3.0 * * @remarks The @a handle should be released using csr_wp_context_destroy(). * @remarks Multiple handles can be obtained. * - * @details A Web Protection API handle (or CSR WP handle) is obtained by this method. - * The handle is required for subsequent CSR WP API calls. - * * @param[out] handle A pointer of CSR WP context handle. * * @return #CSR_ERROR_NONE on success, otherwise a negative error value @@ -53,7 +53,7 @@ extern "C" { * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_OUT_OF_MEMORY Not enough memory * @retval #CSR_ERROR_INVALID_PARAMETER @a handle is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_wp_context_destroy() */ @@ -73,7 +73,7 @@ int csr_wp_context_create(csr_wp_context_h *handle); * @retval #CSR_ERROR_SOCKET Socket error between client and server * @retval #CSR_ERROR_SERVER Server has been failed for some reason * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_wp_context_create() */ @@ -82,14 +82,14 @@ int csr_wp_context_destroy(csr_wp_context_h handle); /** * @brief Sets a popup option for risky URL checked. * - * @since_tizen 3.0 - * - * @remarks This option is disabled(#CSR_WP_NOT_ASK_USER) as a default. - * * @details If #CSR_WP_ASK_USER is set, a popup will be prompted to a user when a URL * turns out risky. If #CSR_WP_NOT_ASK_USER is set, no popup will be prompted * even when a URL turns out risky. * + * @since_tizen 3.0 + * + * @remarks This option is disabled(#CSR_WP_NOT_ASK_USER) as a default. + * * @param[in] handle CSR WP context handle returned by csr_wp_context_create(). * @param[in] ask_user A popup option in case for a risky URL. * @@ -98,7 +98,7 @@ int csr_wp_context_destroy(csr_wp_context_h handle); * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle * @retval #CSR_ERROR_INVALID_PARAMETER @a ask_user is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_wp_context_create() */ @@ -107,14 +107,14 @@ int csr_wp_set_ask_user(csr_wp_context_h handle, csr_wp_ask_user_e ask_user); /** * @brief Sets a popup message of a client in case for a risky URL. * + * @details Default message is "Risky URL which may harm your device is detected". + * * @since_tizen 3.0 * * @remarks Meaningful only when ask user option is set by csr_wp_set_ask_user(). * @remarks The message will be printed on popup for user. * @remarks Default popup message will be used if it isn't set. * - * @details Default message is "Risky URL which may harm your device is detected". - * * @param[in] handle CSR WP context handle returned by csr_wp_context_create(). * @param[in] message A message to print on a popup. * @@ -124,7 +124,7 @@ int csr_wp_set_ask_user(csr_wp_context_h handle, csr_wp_ask_user_e ask_user); * @retval #CSR_ERROR_INVALID_HANDLE Invalid handle * @retval #CSR_ERROR_INVALID_PARAMETER @a message is too long or empty. Max size * is 64 bytes. - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_wp_context_create() */ @@ -133,6 +133,9 @@ int csr_wp_set_popup_message(csr_wp_context_h handle, const char *message); /** * @brief Checks URL reputation against the engine vendor's database. * + * @details Checks whether accessing the URL is risky or not and returns a result handle + * with the risk level for the URL. + * * @since_tizen 3.0 * @privlevel partner * @privilege %http://tizen.org/privilege/antivirus.webprotect @@ -140,9 +143,6 @@ int csr_wp_set_popup_message(csr_wp_context_h handle, const char *message); * @remarks The @a result will be released when @a handle is released using * csr_wp_context_destroy(). * - * @details Checks whether accessing the URL is risky or not and returns a result handle - * with the risk level for the URL. - * * @param[in] handle CSR WP context handle returned by csr_wp_context_create(). * @param[in] url URL to check. * @param[out] result A pointer of the result handle with the Risk level for the URL. @@ -161,7 +161,7 @@ int csr_wp_set_popup_message(csr_wp_context_h handle, const char *message); * @retval #CSR_ERROR_ENGINE_DISABLED Engine is in disabled state * @retval #CSR_ERROR_ENGINE_NOT_ACTIVATED Engine is not activated * @retval #CSR_ERROR_ENGINE_INTERNAL Engine Internal error - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_wp_context_create() * @see csr_wp_set_ask_user() @@ -184,7 +184,7 @@ int csr_wp_check_url(csr_wp_context_h handle, const char *url, * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid result handle * @retval #CSR_ERROR_INVALID_PARAMETER @a level is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_wp_check_url() */ @@ -209,7 +209,7 @@ int csr_wp_result_get_risk_level(csr_wp_check_result_h result, csr_wp_risk_level * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid result handle * @retval #CSR_ERROR_INVALID_PARAMETER @a detailed_url is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_wp_check_url() */ @@ -228,7 +228,7 @@ int csr_wp_result_get_detailed_url(csr_wp_check_result_h result, char **detailed * @retval #CSR_ERROR_NONE Successful * @retval #CSR_ERROR_INVALID_HANDLE Invalid result handle * @retval #CSR_ERROR_INVALID_PARAMETER @a response is invalid - * @retval #CSR_ERROR_UNKNOWN Error with unknown reason + * @retval #CSR_ERROR_SYSTEM System error * * @see csr_wp_check_url() * @see #csr_wp_user_response_e diff --git a/test/internals/test-db.cpp b/test/internals/test-db.cpp index 5bdce01..4f83ef1 100644 --- a/test/internals/test-db.cpp +++ b/test/internals/test-db.cpp @@ -66,14 +66,14 @@ BOOST_AUTO_TEST_CASE(engine_state) Db::Manager db(TEST_DB_FILE, TEST_DB_SCRIPTS); - db.setEngineState(CSR_ENGINE_CS, CSR_ENABLE); - db.setEngineState(CSR_ENGINE_WP, CSR_DISABLE); + db.setEngineState(CSR_ENGINE_CS, CSR_STATE_ENABLE); + db.setEngineState(CSR_ENGINE_WP, CSR_STATE_DISABLE); - ASSERT_IF(db.getEngineState(CSR_ENGINE_CS), CSR_ENABLE); - ASSERT_IF(db.getEngineState(CSR_ENGINE_WP), CSR_DISABLE); + ASSERT_IF(db.getEngineState(CSR_ENGINE_CS), CSR_STATE_ENABLE); + ASSERT_IF(db.getEngineState(CSR_ENGINE_WP), CSR_STATE_DISABLE); - db.setEngineState(CSR_ENGINE_CS, CSR_DISABLE); - ASSERT_IF(db.getEngineState(CSR_ENGINE_CS), CSR_DISABLE); + db.setEngineState(CSR_ENGINE_CS, CSR_STATE_DISABLE); + ASSERT_IF(db.getEngineState(CSR_ENGINE_CS), CSR_STATE_DISABLE); EXCEPTION_GUARD_END } diff --git a/test/test-api-content-screening-async.cpp b/test/test-api-content-screening-async.cpp index 3e7f86d..85fbc45 100644 --- a/test/test-api-content-screening-async.cpp +++ b/test/test-api-content-screening-async.cpp @@ -66,14 +66,14 @@ struct AsyncTestContext { errorCnt(0) {} }; -void on_scanned(void *userdata, const char *file) +void on_scanned(const char *file, void *userdata) { BOOST_MESSAGE("on_scanned. file[" << file << "] scanned!"); auto ctx = reinterpret_cast(userdata); ctx->scannedCnt++; } -void on_detected(void *userdata, csr_cs_malware_h detected) +void on_detected(csr_cs_malware_h detected, void *userdata) { Test::ScopedCstr file_name; ASSERT_IF(csr_cs_malware_get_file_name(detected, &file_name.ptr), CSR_ERROR_NONE); @@ -83,7 +83,7 @@ void on_detected(void *userdata, csr_cs_malware_h detected) ctx->detectedList.push_back(detected); } -void on_error(void *userdata, int ec) +void on_error(int ec, void *userdata) { BOOST_MESSAGE("on_error. async request done with error code[" << ec << "]"); auto ctx = reinterpret_cast(userdata); diff --git a/test/test-api-engine-manager.cpp b/test/test-api-engine-manager.cpp index 6a3b8a5..7a4c217 100644 --- a/test/test-api-engine-manager.cpp +++ b/test/test-api-engine-manager.cpp @@ -82,11 +82,11 @@ BOOST_AUTO_TEST_CASE(fields_getters) ASSERT_SUCCESS(csr_engine_get_activated(e.get(), &activated)); ASSERT_IF(activated, CSR_ACTIVATED); - csr_state_e state = CSR_ENABLE; + csr_state_e state = CSR_STATE_ENABLE; ASSERT_SUCCESS(csr_engine_set_state(e.get(), state)); ASSERT_SUCCESS(csr_engine_get_state(e.get(), &state)); - ASSERT_IF(state, CSR_ENABLE); + ASSERT_IF(state, CSR_STATE_ENABLE); EXCEPTION_GUARD_END } @@ -97,12 +97,12 @@ BOOST_AUTO_TEST_CASE(set_state) Engine e(CSR_ENGINE_CS); - csr_state_e state = CSR_ENABLE; + csr_state_e state = CSR_STATE_ENABLE; // enable - ASSERT_SUCCESS(csr_engine_set_state(e.get(), CSR_ENABLE)); + ASSERT_SUCCESS(csr_engine_set_state(e.get(), CSR_STATE_ENABLE)); ASSERT_SUCCESS(csr_engine_get_state(e.get(), &state)); - ASSERT_IF(state, CSR_ENABLE); + ASSERT_IF(state, CSR_STATE_ENABLE); // prepare data auto c = Test::Context(); @@ -115,9 +115,9 @@ BOOST_AUTO_TEST_CASE(set_state) ASSERT_SUCCESS(csr_cs_scan_data(context, data, sizeof(data), &detected)); // disable - ASSERT_SUCCESS(csr_engine_set_state(e.get(), CSR_DISABLE)); + ASSERT_SUCCESS(csr_engine_set_state(e.get(), CSR_STATE_DISABLE)); ASSERT_SUCCESS(csr_engine_get_state(e.get(), &state)); - ASSERT_IF(state, CSR_DISABLE); + ASSERT_IF(state, CSR_STATE_DISABLE); // test operation ASSERT_IF(csr_cs_scan_data(context, data, sizeof(data), &detected), @@ -126,9 +126,9 @@ BOOST_AUTO_TEST_CASE(set_state) CSR_ERROR_ENGINE_DISABLED); // enable - ASSERT_SUCCESS(csr_engine_set_state(e.get(), CSR_ENABLE)); + ASSERT_SUCCESS(csr_engine_set_state(e.get(), CSR_STATE_ENABLE)); ASSERT_SUCCESS(csr_engine_get_state(e.get(), &state)); - ASSERT_IF(state, CSR_ENABLE); + ASSERT_IF(state, CSR_STATE_ENABLE); // test operation ASSERT_SUCCESS(csr_cs_scan_data(context, data, sizeof(data), &detected)); @@ -167,11 +167,11 @@ BOOST_AUTO_TEST_CASE(fields_getters) ASSERT_SUCCESS(csr_engine_get_activated(e.get(), &activated)); ASSERT_IF(activated, CSR_ACTIVATED); - csr_state_e state = CSR_ENABLE; + csr_state_e state = CSR_STATE_ENABLE; ASSERT_SUCCESS(csr_engine_set_state(e.get(), state)); ASSERT_SUCCESS(csr_engine_get_state(e.get(), &state)); - ASSERT_IF(state, CSR_ENABLE); + ASSERT_IF(state, CSR_STATE_ENABLE); EXCEPTION_GUARD_END } @@ -182,12 +182,12 @@ BOOST_AUTO_TEST_CASE(set_state) Engine e(CSR_ENGINE_WP); - csr_state_e state = CSR_ENABLE; + csr_state_e state = CSR_STATE_ENABLE; // enable - ASSERT_SUCCESS(csr_engine_set_state(e.get(), CSR_ENABLE)); + ASSERT_SUCCESS(csr_engine_set_state(e.get(), CSR_STATE_ENABLE)); ASSERT_SUCCESS(csr_engine_get_state(e.get(), &state)); - ASSERT_IF(state, CSR_ENABLE); + ASSERT_IF(state, CSR_STATE_ENABLE); // prepare data auto c = Test::Context(); @@ -198,18 +198,18 @@ BOOST_AUTO_TEST_CASE(set_state) ASSERT_SUCCESS(csr_wp_check_url(context, RISK_HIGH_URL, &result)); // disable - ASSERT_SUCCESS(csr_engine_set_state(e.get(), CSR_DISABLE)); + ASSERT_SUCCESS(csr_engine_set_state(e.get(), CSR_STATE_DISABLE)); ASSERT_SUCCESS(csr_engine_get_state(e.get(), &state)); - ASSERT_IF(state, CSR_DISABLE); + ASSERT_IF(state, CSR_STATE_DISABLE); // test operation ASSERT_IF(csr_wp_check_url(context, RISK_HIGH_URL, &result), CSR_ERROR_ENGINE_DISABLED); // enable - ASSERT_SUCCESS(csr_engine_set_state(e.get(), CSR_ENABLE)); + ASSERT_SUCCESS(csr_engine_set_state(e.get(), CSR_STATE_ENABLE)); ASSERT_SUCCESS(csr_engine_get_state(e.get(), &state)); - ASSERT_IF(state, CSR_ENABLE); + ASSERT_IF(state, CSR_STATE_ENABLE); // test operation ASSERT_SUCCESS(csr_wp_check_url(context, RISK_HIGH_URL, &result)); diff --git a/test/test-common.cpp b/test/test-common.cpp index 4cca0ba..c46e7a1 100644 --- a/test/test-common.cpp +++ b/test/test-common.cpp @@ -121,7 +121,7 @@ std::string capi_ec_to_string(csr_error_e ec) ERRORDESCRIBE(CSR_ERROR_ENGINE_DISABLED); ERRORDESCRIBE(CSR_ERROR_ENGINE_NOT_ACTIVATED); ERRORDESCRIBE(CSR_ERROR_ENGINE_INTERNAL); - ERRORDESCRIBE(CSR_ERROR_UNKNOWN); + ERRORDESCRIBE(CSR_ERROR_SYSTEM); default: return std::string("Undefined capi error code: ") + std::to_string(static_cast(ec)); } diff --git a/test/test-main.cpp b/test/test-main.cpp index 75cd61c..d7da009 100644 --- a/test/test-main.cpp +++ b/test/test-main.cpp @@ -66,8 +66,8 @@ bool isEngineInitialized = false; struct Initializer { Initializer() { - m_oldCsState = setEngineState(CSR_ENGINE_CS, CSR_ENABLE); - m_oldWpState = setEngineState(CSR_ENGINE_WP, CSR_ENABLE); + m_oldCsState = setEngineState(CSR_ENGINE_CS, CSR_STATE_ENABLE); + m_oldWpState = setEngineState(CSR_ENGINE_WP, CSR_STATE_ENABLE); } ~Initializer() -- 2.7.4