EXCEPTION_SAFE_START
if (phandle == nullptr)
- return CSR_ERROR_INVALID_PARAMETER;
+ return CSR_ERROR_INVALID_HANDLE;
*phandle = reinterpret_cast<csr_cs_context_h>(
new Client::HandleExt(SockId::CS, ContextShPtr(new CsContext())));
EXCEPTION_SAFE_START
if (handle == nullptr)
- return CSR_ERROR_INVALID_PARAMETER;
+ return CSR_ERROR_INVALID_HANDLE;
delete reinterpret_cast<Client::HandleExt *>(handle);
{
EXCEPTION_SAFE_START
- if (handle == nullptr || !_isValid(ask_user))
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (!_isValid(ask_user))
return CSR_ERROR_INVALID_PARAMETER;
reinterpret_cast<Client::HandleExt *>(handle)->getContext()->set(
{
EXCEPTION_SAFE_START
- if (handle == nullptr || message == nullptr || message[0] == '\0')
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (message == nullptr || message[0] == '\0')
return CSR_ERROR_INVALID_PARAMETER;
reinterpret_cast<Client::HandleExt *>(handle)->getContext()->set(
{
EXCEPTION_SAFE_START
- if (handle == nullptr || !_isValid(usage))
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (!_isValid(usage))
return CSR_ERROR_INVALID_PARAMETER;
reinterpret_cast<Client::HandleExt *>(handle)->getContext()->set(
EXCEPTION_SAFE_START
if (handle == nullptr)
- return CSR_ERROR_INVALID_PARAMETER;
+ return CSR_ERROR_INVALID_HANDLE;
reinterpret_cast<Client::HandleExt *>(handle)->getContext()->set(
static_cast<int>(CsContext::Key::ScanOnCloud), true);
{
EXCEPTION_SAFE_START
- if (handle == nullptr || pdetected == nullptr || data == nullptr)
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (pdetected == nullptr || data == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
{
EXCEPTION_SAFE_START
- if (handle == nullptr || pdetected == nullptr
- || file_path == nullptr || file_path[0] == '\0')
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (pdetected == nullptr || file_path == nullptr || file_path[0] == '\0')
return CSR_ERROR_INVALID_PARAMETER;
auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
{
EXCEPTION_SAFE_START
- auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
-
- if (hExt == nullptr || callback == nullptr)
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (callback == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
+ auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
+
hExt->m_cb.onScanned = callback;
return CSR_ERROR_NONE;
{
EXCEPTION_SAFE_START
- auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
-
- if (hExt == nullptr || callback == nullptr)
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (callback == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
+ auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
+
hExt->m_cb.onDetected = callback;
return CSR_ERROR_NONE;
{
EXCEPTION_SAFE_START
- auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
-
- if (hExt == nullptr || callback == nullptr)
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (callback == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
+ auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
+
hExt->m_cb.onCompleted = callback;
return CSR_ERROR_NONE;
{
EXCEPTION_SAFE_START
- auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
-
- if (hExt == nullptr || callback == nullptr)
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (callback == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
+ auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
+
hExt->m_cb.onCancelled = callback;
return CSR_ERROR_NONE;
{
EXCEPTION_SAFE_START
- auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
-
- if (hExt == nullptr || callback == nullptr)
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (callback == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
+ auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
+
hExt->m_cb.onError = callback;
return CSR_ERROR_NONE;
{
EXCEPTION_SAFE_START
- if (handle == nullptr || file_paths == nullptr || count == 0)
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (file_paths == nullptr || count == 0)
return CSR_ERROR_INVALID_PARAMETER;
auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
{
EXCEPTION_SAFE_START
- if (handle == nullptr || dir_path == nullptr || dir_path[0] == '\0')
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (dir_path == nullptr || dir_path[0] == '\0')
return CSR_ERROR_INVALID_PARAMETER;
auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
{
EXCEPTION_SAFE_START
- if (handle == nullptr || dir_paths == nullptr || count == 0)
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (dir_paths == nullptr || count == 0)
return CSR_ERROR_INVALID_PARAMETER;
auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
EXCEPTION_SAFE_START
if (handle == nullptr)
- return CSR_ERROR_INVALID_PARAMETER;
+ return CSR_ERROR_INVALID_HANDLE;
auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
{
EXCEPTION_SAFE_START
- if (detected == nullptr || pseverity == nullptr)
+ if (detected == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (pseverity == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
*pseverity = reinterpret_cast<CsDetected *>(detected)->severity;
{
EXCEPTION_SAFE_START
- if (detected == nullptr || pmalware_name == nullptr)
+ if (detected == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (pmalware_name == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
*pmalware_name = reinterpret_cast<CsDetected *>(detected)->malwareName.c_str();
{
EXCEPTION_SAFE_START
- if (detected == nullptr || pdetailed_url == nullptr)
+ if (detected == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (pdetailed_url == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
*pdetailed_url = reinterpret_cast<CsDetected *>(detected)->detailedUrl.c_str();
}
API
-int csr_cs_detected_get_timestamp(csr_cs_detected_h detected,
- time_t *ptimestamp)
+int csr_cs_detected_get_timestamp(csr_cs_detected_h detected, time_t *ptimestamp)
{
EXCEPTION_SAFE_START
- if (detected == nullptr || ptimestamp == nullptr)
+ if (detected == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (ptimestamp == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
*ptimestamp = reinterpret_cast<CsDetected *>(detected)->ts;
}
API
-int csr_cs_detected_get_file_name(csr_cs_detected_h detected,
- const char **pfile_name)
+int csr_cs_detected_get_file_name(csr_cs_detected_h detected, const char **pfile_name)
{
EXCEPTION_SAFE_START
- if (detected == nullptr || pfile_name == nullptr)
+ if (detected == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (pfile_name == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
*pfile_name = reinterpret_cast<CsDetected *>(detected)->targetName.c_str();
{
EXCEPTION_SAFE_START
- if (detected == nullptr || presponse == nullptr)
+ if (detected == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (presponse == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
*presponse = reinterpret_cast<CsDetected *>(detected)->response;
{
EXCEPTION_SAFE_START
- if (detected == nullptr || pis_app == nullptr)
+ if (detected == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (pis_app == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
*pis_app = reinterpret_cast<CsDetected *>(detected)->isApp;
{
EXCEPTION_SAFE_START
- if (detected == nullptr || ppkg_id == nullptr)
+ if (detected == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (ppkg_id == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
*ppkg_id = reinterpret_cast<CsDetected *>(detected)->pkgId.c_str();
{
EXCEPTION_SAFE_START
- if (handle == nullptr || detected == nullptr || !_isValid(action))
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (detected == nullptr || !_isValid(action))
return CSR_ERROR_INVALID_PARAMETER;
auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
{
EXCEPTION_SAFE_START
- if (handle == nullptr || file_path == nullptr || pdetected == nullptr)
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (file_path == nullptr || pdetected == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
{
EXCEPTION_SAFE_START
- if (handle == nullptr || dir_paths == nullptr || count == 0
- || plist == nullptr || pcount == nullptr)
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (dir_paths == nullptr || count == 0 || plist == nullptr || pcount == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
{
EXCEPTION_SAFE_START
- if (handle == nullptr || file_path == nullptr || pdetected == nullptr)
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (file_path == nullptr || pdetected == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
{
EXCEPTION_SAFE_START
- if (handle == nullptr || dir_paths == nullptr || count == 0
- || plist == nullptr || pcount == nullptr)
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (dir_paths == nullptr || count == 0 || plist == nullptr || pcount == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
auto hExt = reinterpret_cast<Client::HandleExt *>(handle);
{
EXCEPTION_SAFE_START
- if (list == nullptr || pdetected == nullptr)
+ if (list == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (pdetected == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
auto dListPtr = reinterpret_cast<ResultList *>(list);
EXCEPTION_SAFE_START
if (phandle == nullptr)
- return CSR_ERROR_INVALID_PARAMETER;
+ return CSR_ERROR_INVALID_HANDLE;
*phandle = reinterpret_cast<csr_wp_context_h>(
new Client::Handle(SockId::WP, std::make_shared<WpContext>()));
EXCEPTION_SAFE_START
if (handle == nullptr)
- return CSR_ERROR_INVALID_PARAMETER;
+ return CSR_ERROR_INVALID_HANDLE;
delete reinterpret_cast<Client::Handle *>(handle);
{
EXCEPTION_SAFE_START
- if (handle == nullptr
- || (ask_user != CSR_WP_NOT_ASK_USER && ask_user != CSR_WP_ASK_USER))
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (ask_user != CSR_WP_NOT_ASK_USER && ask_user != CSR_WP_ASK_USER)
return CSR_ERROR_INVALID_PARAMETER;
reinterpret_cast<Client::Handle *>(handle)->getContext()->set(
{
EXCEPTION_SAFE_START
- if (handle == nullptr || message == nullptr || message[0] == '\0')
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (message == nullptr || message[0] == '\0')
return CSR_ERROR_INVALID_PARAMETER;
reinterpret_cast<Client::Handle *>(handle)->getContext()->set(
{
EXCEPTION_SAFE_START
- if (handle == nullptr || presult == nullptr
- || url == nullptr || url[0] == '\0')
+ if (handle == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (presult == nullptr || url == nullptr || url[0] == '\0')
return CSR_ERROR_INVALID_PARAMETER;
auto h = reinterpret_cast<Client::Handle *>(handle);
{
EXCEPTION_SAFE_START
- if (result == nullptr || plevel == nullptr)
+ if (result == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (plevel == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
*plevel = reinterpret_cast<WpResult *>(result)->riskLevel;
{
EXCEPTION_SAFE_START
- if (result == nullptr || pdetailed_url == nullptr)
+ if (result == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (pdetailed_url == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
*pdetailed_url = reinterpret_cast<WpResult *>(result)->detailedUrl.c_str();
{
EXCEPTION_SAFE_START
- if (result == nullptr || presponse == nullptr)
+ if (result == nullptr)
+ return CSR_ERROR_INVALID_HANDLE;
+ else if (presponse == nullptr)
return CSR_ERROR_INVALID_PARAMETER;
*presponse = reinterpret_cast<WpResult *>(result)->response;