From 011b081d7ab97c42e1c8e3aae677056588856fc9 Mon Sep 17 00:00:00 2001 From: "vadim.zyarko" Date: Mon, 6 Nov 2023 17:42:21 -0800 Subject: [PATCH] update(userspace/libsinsp): add factory method for sinsp_evt from a given scap buffer Co-authored-by: Vadim Zyarko Signed-off-by: Jason Dellaluce --- userspace/libsinsp/event.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/userspace/libsinsp/event.h b/userspace/libsinsp/event.h index 4bd59a8634..b3d5069208 100644 --- a/userspace/libsinsp/event.h +++ b/userspace/libsinsp/event.h @@ -532,6 +532,17 @@ class SINSP_PUBLIC sinsp_evt : public gen_event m_info = ppm_event; m_errorcode = errorcode; } + + static std::unique_ptr from_scap_evt( + std::unique_ptr> scap_event) + { + auto ret = std::make_unique(); + auto evdata = scap_event.release(); + ret->init(evdata, 0); + ret->m_pevt_storage = (char*)evdata; + return ret; + } + inline void load_params() { uint32_t j;