bool HyperscanMpse::deserialize(const uint8_t* buf, size_t sz)
{
- if ( hs_deserialize_database((const char*)buf, sz, &hs_db) != HS_SUCCESS or !hs_db )
+ if ( hs_error_t err = hs_deserialize_database((const char*)buf, sz, &hs_db) )
+ {
+ ParseWarning(WARN_RULES, "can't deserialize hyperscan database (%d)", err);
return false;
+ }
if ( hs_error_t err = hs_alloc_scratch(hs_db, &s_scratch[get_instance_id()]) )
{
ids.emplace_back(id++);
}
+#ifdef REG_TEST
+ hs_platform_info_t info = { HS_TUNE_FAMILY_SNB, 0, 0, 0 };
+ auto pinfo = &info;
+#else
+ hs_platform_info_t* pinfo = nullptr;
+#endif
+
if ( hs_compile_multi(&pats[0], &flags[0], &ids[0], pvector.size(), HS_MODE_BLOCK,
- nullptr, &hs_db, &errptr) or !hs_db )
+ pinfo, &hs_db, &errptr) or !hs_db )
{
ParseError("can't compile hyperscan pattern database: %s (%d) - '%s'",
errptr->message, errptr->expression,
#include "framework/base_api.h"
#include "framework/mpse.h"
#include "framework/mpse_batch.h"
+#include "log/messages.h"
#include "main/snort_config.h"
#include "managers/mpse_manager.h"
#include "search_engines/pat_stats.h"
void LogValue(const char*, const char*, FILE*) { }
void LogMessage(const char*, ...) { }
+void ParseWarning(WarningGroup, const char*, ...) { }
+
[[noreturn]] void FatalError(const char*,...) { exit(1); }
+
void LogCount(char const*, uint64_t, FILE*) { }
void LogStat(const char*, double, FILE*) { }