mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 03:28:19 +00:00
Move EventMgr, EventHandler, and EventRegistry code to zeek namespace. Rename mgr to event_mgr.
This commit is contained in:
parent
1c17700c48
commit
45b5a98420
76 changed files with 328 additions and 300 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 462ac3bd3a7ae0d30378e36ca2fe771c53a0a23e
|
Subproject commit dd076490debfa2071861eaa24715432f14b9d801
|
|
@ -444,9 +444,9 @@ ipaddr32_t zeek::detail::anonymize_ip(ipaddr32_t ip, enum ip_addr_anonymization_
|
||||||
void zeek::detail::log_anonymization_mapping(ipaddr32_t input, ipaddr32_t output)
|
void zeek::detail::log_anonymization_mapping(ipaddr32_t input, ipaddr32_t output)
|
||||||
{
|
{
|
||||||
if ( anonymization_mapping )
|
if ( anonymization_mapping )
|
||||||
mgr.Enqueue(anonymization_mapping,
|
zeek::event_mgr.Enqueue(anonymization_mapping,
|
||||||
zeek::make_intrusive<zeek::AddrVal>(input),
|
zeek::make_intrusive<zeek::AddrVal>(input),
|
||||||
zeek::make_intrusive<AddrVal>(output)
|
zeek::make_intrusive<AddrVal>(output)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
src/Conn.cc
22
src/Conn.cc
|
@ -253,7 +253,7 @@ bool Connection::ScaledHistoryEntry(char code, uint32_t& counter,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::HistoryThresholdEvent(EventHandlerPtr e, bool is_orig,
|
void Connection::HistoryThresholdEvent(zeek::EventHandlerPtr e, bool is_orig,
|
||||||
uint32_t threshold)
|
uint32_t threshold)
|
||||||
{
|
{
|
||||||
if ( ! e )
|
if ( ! e )
|
||||||
|
@ -466,7 +466,7 @@ void Connection::RemovalEvent()
|
||||||
EnqueueEvent(successful_connection_remove, nullptr, ConnVal());
|
EnqueueEvent(successful_connection_remove, nullptr, ConnVal());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::Event(EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer, const char* name)
|
void Connection::Event(zeek::EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer, const char* name)
|
||||||
{
|
{
|
||||||
if ( ! f )
|
if ( ! f )
|
||||||
return;
|
return;
|
||||||
|
@ -477,7 +477,7 @@ void Connection::Event(EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer, co
|
||||||
EnqueueEvent(f, analyzer, ConnVal());
|
EnqueueEvent(f, analyzer, ConnVal());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::Event(EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer, zeek::Val* v1, zeek::Val* v2)
|
void Connection::Event(zeek::EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer, zeek::Val* v1, zeek::Val* v2)
|
||||||
{
|
{
|
||||||
if ( ! f )
|
if ( ! f )
|
||||||
{
|
{
|
||||||
|
@ -497,7 +497,7 @@ void Connection::Event(EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer, ze
|
||||||
zeek::IntrusivePtr{zeek::AdoptRef{}, v1});
|
zeek::IntrusivePtr{zeek::AdoptRef{}, v1});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::ConnectionEvent(EventHandlerPtr f, zeek::analyzer::Analyzer* a, val_list vl)
|
void Connection::ConnectionEvent(zeek::EventHandlerPtr f, zeek::analyzer::Analyzer* a, val_list vl)
|
||||||
{
|
{
|
||||||
auto args = zeek::val_list_to_args(vl);
|
auto args = zeek::val_list_to_args(vl);
|
||||||
|
|
||||||
|
@ -507,17 +507,17 @@ void Connection::ConnectionEvent(EventHandlerPtr f, zeek::analyzer::Analyzer* a,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// "this" is passed as a cookie for the event
|
// "this" is passed as a cookie for the event
|
||||||
mgr.Enqueue(f, std::move(args), SOURCE_LOCAL, a ? a->GetID() : 0, this);
|
zeek::event_mgr.Enqueue(f, std::move(args), SOURCE_LOCAL, a ? a->GetID() : 0, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::ConnectionEventFast(EventHandlerPtr f, zeek::analyzer::Analyzer* a, val_list vl)
|
void Connection::ConnectionEventFast(zeek::EventHandlerPtr f, zeek::analyzer::Analyzer* a, val_list vl)
|
||||||
{
|
{
|
||||||
// "this" is passed as a cookie for the event
|
// "this" is passed as a cookie for the event
|
||||||
mgr.Enqueue(f, zeek::val_list_to_args(vl), SOURCE_LOCAL,
|
zeek::event_mgr.Enqueue(f, zeek::val_list_to_args(vl), SOURCE_LOCAL,
|
||||||
a ? a->GetID() : 0, this);
|
a ? a->GetID() : 0, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::ConnectionEvent(EventHandlerPtr f, zeek::analyzer::Analyzer* a, val_list* vl)
|
void Connection::ConnectionEvent(zeek::EventHandlerPtr f, zeek::analyzer::Analyzer* a, val_list* vl)
|
||||||
{
|
{
|
||||||
auto args = zeek::val_list_to_args(*vl);
|
auto args = zeek::val_list_to_args(*vl);
|
||||||
delete vl;
|
delete vl;
|
||||||
|
@ -526,11 +526,11 @@ void Connection::ConnectionEvent(EventHandlerPtr f, zeek::analyzer::Analyzer* a,
|
||||||
EnqueueEvent(f, a, std::move(args));
|
EnqueueEvent(f, a, std::move(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::EnqueueEvent(EventHandlerPtr f, zeek::analyzer::Analyzer* a,
|
void Connection::EnqueueEvent(zeek::EventHandlerPtr f, zeek::analyzer::Analyzer* a,
|
||||||
zeek::Args args)
|
zeek::Args args)
|
||||||
{
|
{
|
||||||
// "this" is passed as a cookie for the event
|
// "this" is passed as a cookie for the event
|
||||||
mgr.Enqueue(f, std::move(args), SOURCE_LOCAL, a ? a->GetID() : 0, this);
|
zeek::event_mgr.Enqueue(f, std::move(args), SOURCE_LOCAL, a ? a->GetID() : 0, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::Weird(const char* name, const char* addl)
|
void Connection::Weird(const char* name, const char* addl)
|
||||||
|
|
16
src/Conn.h
16
src/Conn.h
|
@ -191,20 +191,20 @@ public:
|
||||||
// given that event's first argument will be it, and it's second will be
|
// given that event's first argument will be it, and it's second will be
|
||||||
// the connection value. If 'name' is null, then the event's first
|
// the connection value. If 'name' is null, then the event's first
|
||||||
// argument is the connection value.
|
// argument is the connection value.
|
||||||
void Event(EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer, const char* name = nullptr);
|
void Event(zeek::EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer, const char* name = nullptr);
|
||||||
|
|
||||||
// If a handler exists for 'f', an event will be generated. In any case,
|
// If a handler exists for 'f', an event will be generated. In any case,
|
||||||
// 'v1' and 'v2' reference counts get decremented. The event's first
|
// 'v1' and 'v2' reference counts get decremented. The event's first
|
||||||
// argument is the connection value, second argument is 'v1', and if 'v2'
|
// argument is the connection value, second argument is 'v1', and if 'v2'
|
||||||
// is given that will be it's third argument.
|
// is given that will be it's third argument.
|
||||||
[[deprecated("Remove in v4.1. Use EnqueueEvent() instead (note it doesn't automatically add the connection argument).")]]
|
[[deprecated("Remove in v4.1. Use EnqueueEvent() instead (note it doesn't automatically add the connection argument).")]]
|
||||||
void Event(EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer, zeek::Val* v1, zeek::Val* v2 = nullptr);
|
void Event(zeek::EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer, zeek::Val* v1, zeek::Val* v2 = nullptr);
|
||||||
|
|
||||||
// If a handler exists for 'f', an event will be generated. In any case,
|
// If a handler exists for 'f', an event will be generated. In any case,
|
||||||
// reference count for each element in the 'vl' list are decremented. The
|
// reference count for each element in the 'vl' list are decremented. The
|
||||||
// arguments used for the event are whatevever is provided in 'vl'.
|
// arguments used for the event are whatevever is provided in 'vl'.
|
||||||
[[deprecated("Remove in v4.1. Use EnqueueEvent() instead.")]]
|
[[deprecated("Remove in v4.1. Use EnqueueEvent() instead.")]]
|
||||||
void ConnectionEvent(EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer,
|
void ConnectionEvent(zeek::EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer,
|
||||||
val_list vl);
|
val_list vl);
|
||||||
|
|
||||||
// Same as ConnectionEvent, except taking the event's argument list via a
|
// Same as ConnectionEvent, except taking the event's argument list via a
|
||||||
|
@ -212,7 +212,7 @@ public:
|
||||||
// memory pointed to by 'vl' and also for decrementing the reference count
|
// memory pointed to by 'vl' and also for decrementing the reference count
|
||||||
// of each of its elements.
|
// of each of its elements.
|
||||||
[[deprecated("Remove in v4.1. Use EnqueueEvent() instead.")]]
|
[[deprecated("Remove in v4.1. Use EnqueueEvent() instead.")]]
|
||||||
void ConnectionEvent(EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer,
|
void ConnectionEvent(zeek::EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer,
|
||||||
val_list* vl);
|
val_list* vl);
|
||||||
|
|
||||||
// Queues an event without first checking if there's any available event
|
// Queues an event without first checking if there's any available event
|
||||||
|
@ -224,13 +224,13 @@ public:
|
||||||
// it would be a waste of effort to construct all the event arguments when
|
// it would be a waste of effort to construct all the event arguments when
|
||||||
// there's no handlers to consume them).
|
// there's no handlers to consume them).
|
||||||
[[deprecated("Remove in v4.1. Use EnqueueEvent() instead.")]]
|
[[deprecated("Remove in v4.1. Use EnqueueEvent() instead.")]]
|
||||||
void ConnectionEventFast(EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer,
|
void ConnectionEventFast(zeek::EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer,
|
||||||
val_list vl);
|
val_list vl);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueues an event associated with this connection and given analyzer.
|
* Enqueues an event associated with this connection and given analyzer.
|
||||||
*/
|
*/
|
||||||
void EnqueueEvent(EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer,
|
void EnqueueEvent(zeek::EventHandlerPtr f, zeek::analyzer::Analyzer* analyzer,
|
||||||
zeek::Args args);
|
zeek::Args args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,7 +240,7 @@ public:
|
||||||
std::enable_if_t<
|
std::enable_if_t<
|
||||||
std::is_convertible_v<
|
std::is_convertible_v<
|
||||||
std::tuple_element_t<0, std::tuple<Args...>>, zeek::ValPtr>>
|
std::tuple_element_t<0, std::tuple<Args...>>, zeek::ValPtr>>
|
||||||
EnqueueEvent(EventHandlerPtr h, zeek::analyzer::Analyzer* analyzer, Args&&... args)
|
EnqueueEvent(zeek::EventHandlerPtr h, zeek::analyzer::Analyzer* analyzer, Args&&... args)
|
||||||
{ return EnqueueEvent(h, analyzer, zeek::Args{std::forward<Args>(args)...}); }
|
{ return EnqueueEvent(h, analyzer, zeek::Args{std::forward<Args>(args)...}); }
|
||||||
|
|
||||||
void Weird(const char* name, const char* addl = "");
|
void Weird(const char* name, const char* addl = "");
|
||||||
|
@ -296,7 +296,7 @@ public:
|
||||||
uint32_t& scaling_threshold,
|
uint32_t& scaling_threshold,
|
||||||
uint32_t scaling_base = 10);
|
uint32_t scaling_base = 10);
|
||||||
|
|
||||||
void HistoryThresholdEvent(EventHandlerPtr e, bool is_orig,
|
void HistoryThresholdEvent(zeek::EventHandlerPtr e, bool is_orig,
|
||||||
uint32_t threshold);
|
uint32_t threshold);
|
||||||
|
|
||||||
void AddHistory(char code) { history += code; }
|
void AddHistory(char code) { history += code; }
|
||||||
|
|
|
@ -696,7 +696,7 @@ void DNS_Mgr::Event(EventHandlerPtr e, DNS_Mapping* dm)
|
||||||
if ( ! e )
|
if ( ! e )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mgr.Enqueue(e, BuildMappingVal(dm));
|
zeek::event_mgr.Enqueue(e, BuildMappingVal(dm));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DNS_Mgr::Event(EventHandlerPtr e, DNS_Mapping* dm,
|
void DNS_Mgr::Event(EventHandlerPtr e, DNS_Mapping* dm,
|
||||||
|
@ -705,7 +705,7 @@ void DNS_Mgr::Event(EventHandlerPtr e, DNS_Mapping* dm,
|
||||||
if ( ! e )
|
if ( ! e )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mgr.Enqueue(e, BuildMappingVal(dm), l1->ToSetVal(), l2->ToSetVal());
|
zeek::event_mgr.Enqueue(e, BuildMappingVal(dm), l1->ToSetVal(), l2->ToSetVal());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DNS_Mgr::Event(EventHandlerPtr e, DNS_Mapping* old_dm, DNS_Mapping* new_dm)
|
void DNS_Mgr::Event(EventHandlerPtr e, DNS_Mapping* old_dm, DNS_Mapping* new_dm)
|
||||||
|
@ -713,7 +713,7 @@ void DNS_Mgr::Event(EventHandlerPtr e, DNS_Mapping* old_dm, DNS_Mapping* new_dm)
|
||||||
if ( ! e )
|
if ( ! e )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mgr.Enqueue(e, BuildMappingVal(old_dm), BuildMappingVal(new_dm));
|
zeek::event_mgr.Enqueue(e, BuildMappingVal(old_dm), BuildMappingVal(new_dm));
|
||||||
}
|
}
|
||||||
|
|
||||||
zeek::ValPtr DNS_Mgr::BuildMappingVal(DNS_Mapping* dm)
|
zeek::ValPtr DNS_Mgr::BuildMappingVal(DNS_Mapping* dm)
|
||||||
|
|
|
@ -13,8 +13,7 @@
|
||||||
#include "IPAddr.h"
|
#include "IPAddr.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
class EventHandler;
|
ZEEK_FORWARD_DECLARE_NAMESPACED(EventHandler, zeek);
|
||||||
|
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(DNS_Mgr_Request, zeek::detail);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(DNS_Mgr_Request, zeek::detail);
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(RecordType, zeek);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(RecordType, zeek);
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(Val, zeek);
|
||||||
|
@ -106,10 +105,10 @@ protected:
|
||||||
friend class LookupCallback;
|
friend class LookupCallback;
|
||||||
friend class DNS_Mgr_Request;
|
friend class DNS_Mgr_Request;
|
||||||
|
|
||||||
void Event(EventHandlerPtr e, DNS_Mapping* dm);
|
void Event(zeek::EventHandlerPtr e, DNS_Mapping* dm);
|
||||||
void Event(EventHandlerPtr e, DNS_Mapping* dm,
|
void Event(zeek::EventHandlerPtr e, DNS_Mapping* dm,
|
||||||
zeek::ListValPtr l1, zeek::ListValPtr l2);
|
zeek::ListValPtr l1, zeek::ListValPtr l2);
|
||||||
void Event(EventHandlerPtr e, DNS_Mapping* old_dm, DNS_Mapping* new_dm);
|
void Event(zeek::EventHandlerPtr e, DNS_Mapping* old_dm, DNS_Mapping* new_dm);
|
||||||
|
|
||||||
zeek::ValPtr BuildMappingVal(DNS_Mapping* dm);
|
zeek::ValPtr BuildMappingVal(DNS_Mapping* dm);
|
||||||
|
|
||||||
|
|
12
src/Event.cc
12
src/Event.cc
|
@ -13,10 +13,10 @@
|
||||||
#include "iosource/PktSrc.h"
|
#include "iosource/PktSrc.h"
|
||||||
#include "Net.h"
|
#include "Net.h"
|
||||||
|
|
||||||
EventMgr mgr;
|
zeek::EventMgr zeek::event_mgr;
|
||||||
|
zeek::EventMgr& mgr = zeek::event_mgr;
|
||||||
|
|
||||||
uint64_t num_events_queued = 0;
|
namespace zeek {
|
||||||
uint64_t num_events_dispatched = 0;
|
|
||||||
|
|
||||||
Event::Event(EventHandlerPtr arg_handler, zeek::Args arg_args,
|
Event::Event(EventHandlerPtr arg_handler, zeek::Args arg_args,
|
||||||
SourceID arg_src, zeek::analyzer::ID arg_aid, Obj* arg_obj)
|
SourceID arg_src, zeek::analyzer::ID arg_aid, Obj* arg_obj)
|
||||||
|
@ -145,7 +145,7 @@ void EventMgr::QueueEvent(Event* event)
|
||||||
tail = event;
|
tail = event;
|
||||||
}
|
}
|
||||||
|
|
||||||
++num_events_queued;
|
++event_mgr.num_events_queued;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventMgr::Dispatch(Event* event, bool no_remote)
|
void EventMgr::Dispatch(Event* event, bool no_remote)
|
||||||
|
@ -188,7 +188,7 @@ void EventMgr::Drain()
|
||||||
current->Dispatch();
|
current->Dispatch();
|
||||||
Unref(current);
|
Unref(current);
|
||||||
|
|
||||||
++num_events_dispatched;
|
++event_mgr.num_events_dispatched;
|
||||||
current = next;
|
current = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,3 +244,5 @@ void EventMgr::InitPostScript()
|
||||||
if ( ! iosource_mgr->RegisterFd(queue_flare.FD(), this) )
|
if ( ! iosource_mgr->RegisterFd(queue_flare.FD(), this) )
|
||||||
zeek::reporter->FatalError("Failed to register event manager FD with iosource_mgr");
|
zeek::reporter->FatalError("Failed to register event manager FD with iosource_mgr");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace zeek
|
||||||
|
|
21
src/Event.h
21
src/Event.h
|
@ -12,7 +12,9 @@
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
class EventMgr;
|
ZEEK_FORWARD_DECLARE_NAMESPACED(EventMgr, zeek);
|
||||||
|
|
||||||
|
namespace zeek {
|
||||||
|
|
||||||
class Event final : public zeek::Obj {
|
class Event final : public zeek::Obj {
|
||||||
public:
|
public:
|
||||||
|
@ -45,9 +47,6 @@ protected:
|
||||||
Event* next_event;
|
Event* next_event;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern uint64_t num_events_queued;
|
|
||||||
extern uint64_t num_events_dispatched;
|
|
||||||
|
|
||||||
class EventMgr final : public zeek::Obj, public iosource::IOSource {
|
class EventMgr final : public zeek::Obj, public iosource::IOSource {
|
||||||
public:
|
public:
|
||||||
EventMgr();
|
EventMgr();
|
||||||
|
@ -136,6 +135,9 @@ public:
|
||||||
const char* Tag() override { return "EventManager"; }
|
const char* Tag() override { return "EventManager"; }
|
||||||
void InitPostScript();
|
void InitPostScript();
|
||||||
|
|
||||||
|
uint64_t num_events_queued = 0;
|
||||||
|
uint64_t num_events_dispatched = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void QueueEvent(Event* event);
|
void QueueEvent(Event* event);
|
||||||
|
|
||||||
|
@ -148,4 +150,13 @@ protected:
|
||||||
zeek::detail::Flare queue_flare;
|
zeek::detail::Flare queue_flare;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EventMgr mgr;
|
extern EventMgr event_mgr;
|
||||||
|
|
||||||
|
} // namespace zeek
|
||||||
|
|
||||||
|
using Event [[deprecated("Remove in v4.1. Use zeek::Event.")]] = zeek::Event;
|
||||||
|
using EventMgr [[deprecated("Remove in v4.1. Use zeek::EventMgr.")]] = zeek::EventMgr;
|
||||||
|
extern zeek::EventMgr& mgr [[deprecated("Remove in v4.1. Use zeek::event_mgr")]];
|
||||||
|
|
||||||
|
extern uint64_t& num_events_queued [[deprecated("Remove in v4.1. Use zeek::event_mgr.num_events_queued")]];
|
||||||
|
extern uint64_t& num_events_dispatched [[deprecated("Remove in v4.1. Use zeek::event_mgr.num_events_dispatched")]];
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include "broker/Manager.h"
|
#include "broker/Manager.h"
|
||||||
#include "broker/Data.h"
|
#include "broker/Data.h"
|
||||||
|
|
||||||
|
namespace zeek {
|
||||||
|
|
||||||
EventHandler::EventHandler(std::string arg_name)
|
EventHandler::EventHandler(std::string arg_name)
|
||||||
{
|
{
|
||||||
name = std::move(arg_name);
|
name = std::move(arg_name);
|
||||||
|
@ -118,9 +120,11 @@ void EventHandler::NewEvent(zeek::Args* vl)
|
||||||
|
|
||||||
auto vargs = zeek::MakeCallArgumentVector(*vl, GetType()->Params());
|
auto vargs = zeek::MakeCallArgumentVector(*vl, GetType()->Params());
|
||||||
|
|
||||||
Event* ev = new Event(new_event, {
|
auto ev = new zeek::Event(new_event, {
|
||||||
zeek::make_intrusive<zeek::StringVal>(name),
|
zeek::make_intrusive<zeek::StringVal>(name),
|
||||||
std::move(vargs),
|
std::move(vargs),
|
||||||
});
|
});
|
||||||
mgr.Dispatch(ev);
|
zeek::event_mgr.Dispatch(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace zeek
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek);
|
||||||
|
|
||||||
namespace zeek {
|
namespace zeek {
|
||||||
using FuncPtr = zeek::IntrusivePtr<zeek::Func>;
|
using FuncPtr = zeek::IntrusivePtr<zeek::Func>;
|
||||||
}
|
|
||||||
|
|
||||||
class EventHandler {
|
class EventHandler {
|
||||||
public:
|
public:
|
||||||
|
@ -104,3 +104,8 @@ public:
|
||||||
private:
|
private:
|
||||||
EventHandler* handler;
|
EventHandler* handler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace zeek
|
||||||
|
|
||||||
|
using EventHandler [[deprecated("Remove in v4.1. Use zeek::EventHandler.")]] = zeek::EventHandler;
|
||||||
|
using EventHandlerPtr [[deprecated("Remove in v4.1. Use zeek::EventHandlerPtr.")]] = zeek::EventHandlerPtr;
|
||||||
|
|
|
@ -4,14 +4,16 @@
|
||||||
#include "RE.h"
|
#include "RE.h"
|
||||||
#include "Reporter.h"
|
#include "Reporter.h"
|
||||||
|
|
||||||
|
namespace zeek {
|
||||||
|
|
||||||
EventRegistry::EventRegistry() = default;
|
EventRegistry::EventRegistry() = default;
|
||||||
EventRegistry::~EventRegistry() noexcept = default;
|
EventRegistry::~EventRegistry() noexcept = default;
|
||||||
|
|
||||||
EventHandlerPtr EventRegistry::Register(std::string_view name)
|
zeek::EventHandlerPtr EventRegistry::Register(std::string_view name)
|
||||||
{
|
{
|
||||||
// If there already is an entry in the registry, we have a
|
// If there already is an entry in the registry, we have a
|
||||||
// local handler on the script layer.
|
// local handler on the script layer.
|
||||||
EventHandler* h = event_registry->Lookup(name);
|
zeek::EventHandler* h = event_registry->Lookup(name);
|
||||||
|
|
||||||
if ( h )
|
if ( h )
|
||||||
{
|
{
|
||||||
|
@ -19,7 +21,7 @@ EventHandlerPtr EventRegistry::Register(std::string_view name)
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
h = new EventHandler(std::string(name));
|
h = new zeek::EventHandler(std::string(name));
|
||||||
event_registry->Register(h);
|
event_registry->Register(h);
|
||||||
|
|
||||||
h->SetUsed();
|
h->SetUsed();
|
||||||
|
@ -27,12 +29,12 @@ EventHandlerPtr EventRegistry::Register(std::string_view name)
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventRegistry::Register(EventHandlerPtr handler)
|
void EventRegistry::Register(zeek::EventHandlerPtr handler)
|
||||||
{
|
{
|
||||||
handlers[std::string(handler->Name())] = std::unique_ptr<EventHandler>(handler.Ptr());
|
handlers[std::string(handler->Name())] = std::unique_ptr<zeek::EventHandler>(handler.Ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHandler* EventRegistry::Lookup(std::string_view name)
|
zeek::EventHandler* EventRegistry::Lookup(std::string_view name)
|
||||||
{
|
{
|
||||||
auto it = handlers.find(name);
|
auto it = handlers.find(name);
|
||||||
if ( it != handlers.end() )
|
if ( it != handlers.end() )
|
||||||
|
@ -47,7 +49,7 @@ EventRegistry::string_list EventRegistry::Match(zeek::RE_Matcher* pattern)
|
||||||
|
|
||||||
for ( const auto& entry : handlers )
|
for ( const auto& entry : handlers )
|
||||||
{
|
{
|
||||||
EventHandler* v = entry.second.get();
|
zeek::EventHandler* v = entry.second.get();
|
||||||
if ( v->GetFunc() && pattern->MatchExactly(v->Name()) )
|
if ( v->GetFunc() && pattern->MatchExactly(v->Name()) )
|
||||||
names.push_back(entry.first);
|
names.push_back(entry.first);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +63,7 @@ EventRegistry::string_list EventRegistry::UnusedHandlers()
|
||||||
|
|
||||||
for ( const auto& entry : handlers )
|
for ( const auto& entry : handlers )
|
||||||
{
|
{
|
||||||
EventHandler* v = entry.second.get();
|
zeek::EventHandler* v = entry.second.get();
|
||||||
if ( v->GetFunc() && ! v->Used() )
|
if ( v->GetFunc() && ! v->Used() )
|
||||||
names.push_back(entry.first);
|
names.push_back(entry.first);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +77,7 @@ EventRegistry::string_list EventRegistry::UsedHandlers()
|
||||||
|
|
||||||
for ( const auto& entry : handlers )
|
for ( const auto& entry : handlers )
|
||||||
{
|
{
|
||||||
EventHandler* v = entry.second.get();
|
zeek::EventHandler* v = entry.second.get();
|
||||||
if ( v->GetFunc() && v->Used() )
|
if ( v->GetFunc() && v->Used() )
|
||||||
names.push_back(entry.first);
|
names.push_back(entry.first);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +101,7 @@ void EventRegistry::PrintDebug()
|
||||||
{
|
{
|
||||||
for ( const auto& entry : handlers )
|
for ( const auto& entry : handlers )
|
||||||
{
|
{
|
||||||
EventHandler* v = entry.second.get();
|
zeek::EventHandler* v = entry.second.get();
|
||||||
fprintf(stderr, "Registered event %s (%s handler / %s)\n", v->Name(),
|
fprintf(stderr, "Registered event %s (%s handler / %s)\n", v->Name(),
|
||||||
v->GetFunc() ? "local" : "no",
|
v->GetFunc() ? "local" : "no",
|
||||||
*v ? "active" : "not active"
|
*v ? "active" : "not active"
|
||||||
|
@ -109,7 +111,7 @@ void EventRegistry::PrintDebug()
|
||||||
|
|
||||||
void EventRegistry::SetErrorHandler(std::string_view name)
|
void EventRegistry::SetErrorHandler(std::string_view name)
|
||||||
{
|
{
|
||||||
EventHandler* eh = Lookup(name);
|
zeek::EventHandler* eh = Lookup(name);
|
||||||
|
|
||||||
if ( eh )
|
if ( eh )
|
||||||
{
|
{
|
||||||
|
@ -120,3 +122,5 @@ void EventRegistry::SetErrorHandler(std::string_view name)
|
||||||
zeek::reporter->InternalWarning("unknown event handler '%s' in SetErrorHandler()",
|
zeek::reporter->InternalWarning("unknown event handler '%s' in SetErrorHandler()",
|
||||||
std::string(name).c_str());
|
std::string(name).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace zeek
|
||||||
|
|
|
@ -10,10 +10,12 @@
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class EventHandler;
|
ZEEK_FORWARD_DECLARE_NAMESPACED(EventHandler, zeek);
|
||||||
class EventHandlerPtr;
|
ZEEK_FORWARD_DECLARE_NAMESPACED(EventHandlerPtr, zeek);
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(RE_Matcher, zeek);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(RE_Matcher, zeek);
|
||||||
|
|
||||||
|
namespace zeek {
|
||||||
|
|
||||||
// The registry keeps track of all events that we provide or handle.
|
// The registry keeps track of all events that we provide or handle.
|
||||||
class EventRegistry {
|
class EventRegistry {
|
||||||
public:
|
public:
|
||||||
|
@ -26,12 +28,12 @@ public:
|
||||||
* @param name The name of the event handler to lookup/register.
|
* @param name The name of the event handler to lookup/register.
|
||||||
* @return The event handler.
|
* @return The event handler.
|
||||||
*/
|
*/
|
||||||
EventHandlerPtr Register(std::string_view name);
|
zeek::EventHandlerPtr Register(std::string_view name);
|
||||||
|
|
||||||
void Register(EventHandlerPtr handler);
|
void Register(zeek::EventHandlerPtr handler);
|
||||||
|
|
||||||
// Return nil if unknown.
|
// Return nil if unknown.
|
||||||
EventHandler* Lookup(std::string_view name);
|
zeek::EventHandler* Lookup(std::string_view name);
|
||||||
|
|
||||||
// Returns a list of all local handlers that match the given pattern.
|
// Returns a list of all local handlers that match the given pattern.
|
||||||
// Passes ownership of list.
|
// Passes ownership of list.
|
||||||
|
@ -50,7 +52,12 @@ public:
|
||||||
void PrintDebug();
|
void PrintDebug();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<std::string, std::unique_ptr<EventHandler>, std::less<>> handlers;
|
std::map<std::string, std::unique_ptr<zeek::EventHandler>, std::less<>> handlers;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EventRegistry* event_registry;
|
extern EventRegistry* event_registry;
|
||||||
|
|
||||||
|
} // namespace zeek
|
||||||
|
|
||||||
|
using EventRegistry [[deprecated("Remove in v4.1. Use zeek::EventRegistry.")]] = zeek::EventRegistry;
|
||||||
|
extern zeek::EventRegistry*& event_registry;
|
||||||
|
|
10
src/Expr.cc
10
src/Expr.cc
|
@ -273,7 +273,7 @@ NameExpr::NameExpr(zeek::detail::IDPtr arg_id, bool const_init)
|
||||||
else
|
else
|
||||||
SetType(id->GetType());
|
SetType(id->GetType());
|
||||||
|
|
||||||
EventHandler* h = event_registry->Lookup(id->Name());
|
EventHandler* h = zeek::event_registry->Lookup(id->Name());
|
||||||
if ( h )
|
if ( h )
|
||||||
h->SetUsed();
|
h->SetUsed();
|
||||||
}
|
}
|
||||||
|
@ -3839,7 +3839,7 @@ ScheduleTimer::~ScheduleTimer()
|
||||||
void ScheduleTimer::Dispatch(double /* t */, bool /* is_expire */)
|
void ScheduleTimer::Dispatch(double /* t */, bool /* is_expire */)
|
||||||
{
|
{
|
||||||
if ( event )
|
if ( event )
|
||||||
mgr.Enqueue(event, std::move(args));
|
zeek::event_mgr.Enqueue(event, std::move(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
ScheduleExpr::ScheduleExpr(ExprPtr arg_when, EventExprPtr arg_event)
|
ScheduleExpr::ScheduleExpr(ExprPtr arg_when, EventExprPtr arg_event)
|
||||||
|
@ -4310,12 +4310,12 @@ TraversalCode LambdaExpr::Traverse(TraversalCallback* cb) const
|
||||||
EventExpr::EventExpr(const char* arg_name, ListExprPtr arg_args)
|
EventExpr::EventExpr(const char* arg_name, ListExprPtr arg_args)
|
||||||
: Expr(EXPR_EVENT), name(arg_name), args(std::move(arg_args))
|
: Expr(EXPR_EVENT), name(arg_name), args(std::move(arg_args))
|
||||||
{
|
{
|
||||||
EventHandler* h = event_registry->Lookup(name);
|
EventHandler* h = zeek::event_registry->Lookup(name);
|
||||||
|
|
||||||
if ( ! h )
|
if ( ! h )
|
||||||
{
|
{
|
||||||
h = new EventHandler(name.c_str());
|
h = new EventHandler(name.c_str());
|
||||||
event_registry->Register(h);
|
zeek::event_registry->Register(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
h->SetUsed();
|
h->SetUsed();
|
||||||
|
@ -4357,7 +4357,7 @@ ValPtr EventExpr::Eval(Frame* f) const
|
||||||
auto v = eval_list(f, args.get());
|
auto v = eval_list(f, args.get());
|
||||||
|
|
||||||
if ( handler )
|
if ( handler )
|
||||||
mgr.Enqueue(handler, std::move(*v));
|
zeek::event_mgr.Enqueue(handler, std::move(*v));
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,8 +331,8 @@ void File::RaiseOpenEvent()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FilePtr bf{zeek::NewRef{}, this};
|
FilePtr bf{zeek::NewRef{}, this};
|
||||||
Event* event = new ::Event(::file_opened, {zeek::make_intrusive<zeek::Val>(std::move(bf))});
|
auto* event = new zeek::Event(::file_opened, {zeek::make_intrusive<zeek::Val>(std::move(bf))});
|
||||||
mgr.Dispatch(event, true);
|
zeek::event_mgr.Dispatch(event, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
double File::Size()
|
double File::Size()
|
||||||
|
|
|
@ -159,12 +159,12 @@ void ID::SetVal(zeek::ValPtr v)
|
||||||
type->Tag() == TYPE_FUNC &&
|
type->Tag() == TYPE_FUNC &&
|
||||||
type->AsFuncType()->Flavor() == FUNC_FLAVOR_EVENT )
|
type->AsFuncType()->Flavor() == FUNC_FLAVOR_EVENT )
|
||||||
{
|
{
|
||||||
EventHandler* handler = event_registry->Lookup(name);
|
EventHandler* handler = zeek::event_registry->Lookup(name);
|
||||||
if ( ! handler )
|
if ( ! handler )
|
||||||
{
|
{
|
||||||
handler = new EventHandler(name);
|
handler = new EventHandler(name);
|
||||||
handler->SetFunc(val->AsFuncPtr());
|
handler->SetFunc(val->AsFuncPtr());
|
||||||
event_registry->Register(handler);
|
zeek::event_registry->Register(handler);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -250,7 +250,7 @@ void ID::UpdateValAttrs()
|
||||||
const auto& attr = attrs->Find(ATTR_ERROR_HANDLER);
|
const auto& attr = attrs->Find(ATTR_ERROR_HANDLER);
|
||||||
|
|
||||||
if ( attr )
|
if ( attr )
|
||||||
event_registry->SetErrorHandler(Name());
|
zeek::event_registry->SetErrorHandler(Name());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( GetType()->Tag() == TYPE_RECORD )
|
if ( GetType()->Tag() == TYPE_RECORD )
|
||||||
|
|
10
src/Net.cc
10
src/Net.cc
|
@ -227,7 +227,7 @@ void net_packet_dispatch(double t, const Packet* pkt, iosource::PktSrc* src_ps)
|
||||||
bro_start_network_time = t;
|
bro_start_network_time = t;
|
||||||
|
|
||||||
if ( network_time_init )
|
if ( network_time_init )
|
||||||
mgr.Enqueue(network_time_init, zeek::Args{});
|
zeek::event_mgr.Enqueue(network_time_init, zeek::Args{});
|
||||||
}
|
}
|
||||||
|
|
||||||
// network_time never goes back.
|
// network_time never goes back.
|
||||||
|
@ -252,7 +252,7 @@ void net_packet_dispatch(double t, const Packet* pkt, iosource::PktSrc* src_ps)
|
||||||
{
|
{
|
||||||
// Drain the queued timer events so they're not
|
// Drain the queued timer events so they're not
|
||||||
// charged against this sample.
|
// charged against this sample.
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
|
|
||||||
sample_logger = new SampleLogger();
|
sample_logger = new SampleLogger();
|
||||||
sp = new SegmentProfiler(sample_logger, "load-samp");
|
sp = new SegmentProfiler(sample_logger, "load-samp");
|
||||||
|
@ -260,7 +260,7 @@ void net_packet_dispatch(double t, const Packet* pkt, iosource::PktSrc* src_ps)
|
||||||
}
|
}
|
||||||
|
|
||||||
sessions->NextPacket(t, pkt);
|
sessions->NextPacket(t, pkt);
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
|
|
||||||
if ( sp )
|
if ( sp )
|
||||||
{
|
{
|
||||||
|
@ -325,7 +325,7 @@ void net_run()
|
||||||
expire_timers();
|
expire_timers();
|
||||||
}
|
}
|
||||||
|
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
|
|
||||||
processing_start_time = 0.0; // = "we're not processing now"
|
processing_start_time = 0.0; // = "we're not processing now"
|
||||||
current_dispatched = 0;
|
current_dispatched = 0;
|
||||||
|
@ -387,7 +387,7 @@ void net_finish(int drain_events)
|
||||||
if ( sessions )
|
if ( sessions )
|
||||||
sessions->Drain();
|
sessions->Drain();
|
||||||
|
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
|
|
||||||
if ( sessions )
|
if ( sessions )
|
||||||
sessions->Done();
|
sessions->Done();
|
||||||
|
|
|
@ -579,7 +579,7 @@ void Reporter::DoLog(const char* prefix, EventHandlerPtr event, FILE* out,
|
||||||
if ( conn )
|
if ( conn )
|
||||||
conn->EnqueueEvent(event, nullptr, std::move(vl));
|
conn->EnqueueEvent(event, nullptr, std::move(vl));
|
||||||
else
|
else
|
||||||
mgr.Enqueue(event, std::move(vl));
|
zeek::event_mgr.Enqueue(event, std::move(vl));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(Analyzer, zeek, analyzer);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(Analyzer, zeek, analyzer);
|
||||||
namespace file_analysis { class File; }
|
namespace file_analysis { class File; }
|
||||||
class Connection;
|
class Connection;
|
||||||
class EventHandlerPtr;
|
ZEEK_FORWARD_DECLARE_NAMESPACED(EventHandlerPtr, zeek);
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek);
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(StringVal, zeek);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(StringVal, zeek);
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(Location, zeek::detail);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(Location, zeek::detail);
|
||||||
|
@ -259,13 +259,13 @@ public:
|
||||||
{ after_zeek_init = true; }
|
{ after_zeek_init = true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DoLog(const char* prefix, EventHandlerPtr event, FILE* out,
|
void DoLog(const char* prefix, zeek::EventHandlerPtr event, FILE* out,
|
||||||
Connection* conn, val_list* addl, bool location, bool time,
|
Connection* conn, val_list* addl, bool location, bool time,
|
||||||
const char* postfix, const char* fmt, va_list ap) __attribute__((format(printf, 10, 0)));
|
const char* postfix, const char* fmt, va_list ap) __attribute__((format(printf, 10, 0)));
|
||||||
|
|
||||||
// WeirdHelper doesn't really have to be variadic, but it calls DoLog
|
// WeirdHelper doesn't really have to be variadic, but it calls DoLog
|
||||||
// and that takes va_list anyway.
|
// and that takes va_list anyway.
|
||||||
void WeirdHelper(EventHandlerPtr event, val_list vl, const char* fmt_name, ...) __attribute__((format(printf, 4, 5)));;
|
void WeirdHelper(zeek::EventHandlerPtr event, val_list vl, const char* fmt_name, ...) __attribute__((format(printf, 4, 5)));;
|
||||||
void UpdateWeirdStats(const char* name);
|
void UpdateWeirdStats(const char* name);
|
||||||
inline bool WeirdOnSamplingWhiteList(const char* name)
|
inline bool WeirdOnSamplingWhiteList(const char* name)
|
||||||
{ return weird_sampling_whitelist.find(name) != weird_sampling_whitelist.end(); }
|
{ return weird_sampling_whitelist.find(name) != weird_sampling_whitelist.end(); }
|
||||||
|
|
|
@ -23,10 +23,11 @@ void RuleActionEvent::DoAction(const Rule* parent, RuleEndpointState* state,
|
||||||
const u_char* data, int len)
|
const u_char* data, int len)
|
||||||
{
|
{
|
||||||
if ( signature_match )
|
if ( signature_match )
|
||||||
mgr.Enqueue(signature_match,
|
zeek::event_mgr.Enqueue(
|
||||||
zeek::IntrusivePtr{zeek::AdoptRef{}, rule_matcher->BuildRuleStateValue(parent, state)},
|
signature_match,
|
||||||
zeek::make_intrusive<zeek::StringVal>(msg),
|
zeek::IntrusivePtr{zeek::AdoptRef{}, rule_matcher->BuildRuleStateValue(parent, state)},
|
||||||
data ? zeek::make_intrusive<zeek::StringVal>(len, (const char*)data) : zeek::val_mgr->EmptyString()
|
zeek::make_intrusive<zeek::StringVal>(msg),
|
||||||
|
data ? zeek::make_intrusive<zeek::StringVal>(len, (const char*)data) : zeek::val_mgr->EmptyString()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ void NetSessions::NextPacket(double t, const Packet* pkt)
|
||||||
SegmentProfiler prof(segment_logger, "dispatching-packet");
|
SegmentProfiler prof(segment_logger, "dispatching-packet");
|
||||||
|
|
||||||
if ( raw_packet )
|
if ( raw_packet )
|
||||||
mgr.Enqueue(raw_packet, pkt->ToRawPktHdrVal());
|
zeek::event_mgr.Enqueue(raw_packet, pkt->ToRawPktHdrVal());
|
||||||
|
|
||||||
if ( pkt_profiler )
|
if ( pkt_profiler )
|
||||||
pkt_profiler->ProfilePkt(t, pkt->cap_len);
|
pkt_profiler->ProfilePkt(t, pkt->cap_len);
|
||||||
|
@ -328,7 +328,7 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const zeek::IP_Hdr*
|
||||||
{
|
{
|
||||||
dump_this_packet = true;
|
dump_this_packet = true;
|
||||||
if ( esp_packet )
|
if ( esp_packet )
|
||||||
mgr.Enqueue(esp_packet, ip_hdr->ToPktHdrVal());
|
zeek::event_mgr.Enqueue(esp_packet, ip_hdr->ToPktHdrVal());
|
||||||
|
|
||||||
// Can't do more since upper-layer payloads are going to be encrypted.
|
// Can't do more since upper-layer payloads are going to be encrypted.
|
||||||
return;
|
return;
|
||||||
|
@ -348,7 +348,7 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const zeek::IP_Hdr*
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mobile_ipv6_message )
|
if ( mobile_ipv6_message )
|
||||||
mgr.Enqueue(mobile_ipv6_message, ip_hdr->ToPktHdrVal());
|
zeek::event_mgr.Enqueue(mobile_ipv6_message, ip_hdr->ToPktHdrVal());
|
||||||
|
|
||||||
if ( ip_hdr->NextProto() != IPPROTO_NONE )
|
if ( ip_hdr->NextProto() != IPPROTO_NONE )
|
||||||
Weird("mobility_piggyback", pkt, encapsulation);
|
Weird("mobility_piggyback", pkt, encapsulation);
|
||||||
|
|
10
src/Stats.cc
10
src/Stats.cc
|
@ -312,7 +312,7 @@ void ProfileLogger::Log()
|
||||||
// (and for consistency we dispatch it *now*)
|
// (and for consistency we dispatch it *now*)
|
||||||
if ( profiling_update )
|
if ( profiling_update )
|
||||||
{
|
{
|
||||||
mgr.Dispatch(new Event(profiling_update, {
|
zeek::event_mgr.Dispatch(new zeek::Event(profiling_update, {
|
||||||
zeek::make_intrusive<zeek::Val>(zeek::IntrusivePtr{zeek::NewRef{}, file}),
|
zeek::make_intrusive<zeek::Val>(zeek::IntrusivePtr{zeek::NewRef{}, file}),
|
||||||
zeek::val_mgr->Bool(expensive),
|
zeek::val_mgr->Bool(expensive),
|
||||||
}));
|
}));
|
||||||
|
@ -369,10 +369,10 @@ void SampleLogger::SegmentProfile(const char* /* name */,
|
||||||
double dtime, int dmem)
|
double dtime, int dmem)
|
||||||
{
|
{
|
||||||
if ( load_sample )
|
if ( load_sample )
|
||||||
mgr.Enqueue(load_sample,
|
zeek::event_mgr.Enqueue(load_sample,
|
||||||
zeek::IntrusivePtr{zeek::NewRef{}, load_samples},
|
zeek::IntrusivePtr{zeek::NewRef{}, load_samples},
|
||||||
zeek::make_intrusive<zeek::IntervalVal>(dtime, Seconds),
|
zeek::make_intrusive<zeek::IntervalVal>(dtime, Seconds),
|
||||||
zeek::val_mgr->Int(dmem)
|
zeek::val_mgr->Int(dmem)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -982,7 +982,7 @@ ValPtr EventStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
||||||
auto h = event_expr->Handler();
|
auto h = event_expr->Handler();
|
||||||
|
|
||||||
if ( args && h )
|
if ( args && h )
|
||||||
mgr.Enqueue(h, std::move(*args));
|
zeek::event_mgr.Enqueue(h, std::move(*args));
|
||||||
|
|
||||||
flow = FLOW_NEXT;
|
flow = FLOW_NEXT;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -857,7 +857,7 @@ zeek::Func* internal_func(const char* name)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHandlerPtr internal_handler(const char* name)
|
zeek::EventHandlerPtr internal_handler(const char* name)
|
||||||
{
|
{
|
||||||
return event_registry->Register(name);
|
return zeek::event_registry->Register(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,7 @@
|
||||||
#include "ID.h"
|
#include "ID.h"
|
||||||
#include "Type.h"
|
#include "Type.h"
|
||||||
|
|
||||||
class EventHandlerPtr;
|
ZEEK_FORWARD_DECLARE_NAMESPACED(EventHandlerPtr, zeek);
|
||||||
|
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(StringVal, zeek);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(StringVal, zeek);
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(TableVal, zeek);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(TableVal, zeek);
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(ListVal, zeek);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(ListVal, zeek);
|
||||||
|
@ -88,5 +87,5 @@ extern zeek::Type* internal_type(const char* name);
|
||||||
[[deprecated("Remove in v4.1. Use zeek::id::find_func().")]]
|
[[deprecated("Remove in v4.1. Use zeek::id::find_func().")]]
|
||||||
extern zeek::Func* internal_func(const char* name);
|
extern zeek::Func* internal_func(const char* name);
|
||||||
|
|
||||||
[[deprecated("Remove in v4.1. Use event_registry->Register().")]]
|
[[deprecated("Remove in v4.1. Use zeek::event_registry->Register().")]]
|
||||||
extern EventHandlerPtr internal_handler(const char* name);
|
extern zeek::EventHandlerPtr internal_handler(const char* name);
|
||||||
|
|
|
@ -702,7 +702,7 @@ void Analyzer::ProtocolConfirmation(Tag arg_tag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto& tval = arg_tag ? arg_tag.AsVal() : tag.AsVal();
|
const auto& tval = arg_tag ? arg_tag.AsVal() : tag.AsVal();
|
||||||
mgr.Enqueue(protocol_confirmation, ConnVal(), tval, zeek::val_mgr->Count(id));
|
zeek::event_mgr.Enqueue(protocol_confirmation, ConnVal(), tval, zeek::val_mgr->Count(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Analyzer::ProtocolViolation(const char* reason, const char* data, int len)
|
void Analyzer::ProtocolViolation(const char* reason, const char* data, int len)
|
||||||
|
@ -724,7 +724,7 @@ void Analyzer::ProtocolViolation(const char* reason, const char* data, int len)
|
||||||
r = zeek::make_intrusive<zeek::StringVal>(reason);
|
r = zeek::make_intrusive<zeek::StringVal>(reason);
|
||||||
|
|
||||||
const auto& tval = tag.AsVal();
|
const auto& tval = tag.AsVal();
|
||||||
mgr.Enqueue(protocol_violation, ConnVal(), tval, zeek::val_mgr->Count(id), std::move(r));
|
zeek::event_mgr.Enqueue(protocol_violation, ConnVal(), tval, zeek::val_mgr->Count(id), std::move(r));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Analyzer::AddTimer(analyzer_timer_func timer, double t,
|
void Analyzer::AddTimer(analyzer_timer_func timer, double t,
|
||||||
|
|
|
@ -191,13 +191,12 @@ void ARP_Analyzer::BadARP(const struct arp_pkthdr* hdr, const char* msg)
|
||||||
if ( ! bad_arp )
|
if ( ! bad_arp )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mgr.Enqueue(bad_arp,
|
zeek::event_mgr.Enqueue(bad_arp,
|
||||||
ToAddrVal(ar_spa(hdr)),
|
ToAddrVal(ar_spa(hdr)),
|
||||||
ToEthAddrStr((const u_char*) ar_sha(hdr)),
|
ToEthAddrStr((const u_char*) ar_sha(hdr)),
|
||||||
ToAddrVal(ar_tpa(hdr)),
|
ToAddrVal(ar_tpa(hdr)),
|
||||||
ToEthAddrStr((const u_char*) ar_tha(hdr)),
|
ToEthAddrStr((const u_char*) ar_tha(hdr)),
|
||||||
zeek::make_intrusive<zeek::StringVal>(msg)
|
zeek::make_intrusive<zeek::StringVal>(msg));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARP_Analyzer::Corrupted(const char* msg)
|
void ARP_Analyzer::Corrupted(const char* msg)
|
||||||
|
@ -205,22 +204,21 @@ void ARP_Analyzer::Corrupted(const char* msg)
|
||||||
zeek::reporter->Weird(msg);
|
zeek::reporter->Weird(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARP_Analyzer::RREvent(EventHandlerPtr e,
|
void ARP_Analyzer::RREvent(zeek::EventHandlerPtr e,
|
||||||
const u_char* src, const u_char *dst,
|
const u_char* src, const u_char *dst,
|
||||||
const char* spa, const char* sha,
|
const char* spa, const char* sha,
|
||||||
const char* tpa, const char* tha)
|
const char* tpa, const char* tha)
|
||||||
{
|
{
|
||||||
if ( ! e )
|
if ( ! e )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mgr.Enqueue(e,
|
zeek::event_mgr.Enqueue(e,
|
||||||
ToEthAddrStr(src),
|
ToEthAddrStr(src),
|
||||||
ToEthAddrStr(dst),
|
ToEthAddrStr(dst),
|
||||||
ToAddrVal(spa),
|
ToAddrVal(spa),
|
||||||
ToEthAddrStr((const u_char*) sha),
|
ToEthAddrStr((const u_char*) sha),
|
||||||
ToAddrVal(tpa),
|
ToAddrVal(tpa),
|
||||||
ToEthAddrStr((const u_char*) tha)
|
ToEthAddrStr((const u_char*) tha));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zeek::AddrVal* ARP_Analyzer::ConstructAddrVal(const void* addr)
|
zeek::AddrVal* ARP_Analyzer::ConstructAddrVal(const void* addr)
|
||||||
|
|
|
@ -40,9 +40,9 @@ public:
|
||||||
void NextPacket(double t, const Packet* pkt);
|
void NextPacket(double t, const Packet* pkt);
|
||||||
|
|
||||||
void Describe(ODesc* d) const override;
|
void Describe(ODesc* d) const override;
|
||||||
void RREvent(EventHandlerPtr e, const u_char* src, const u_char* dst,
|
void RREvent(zeek::EventHandlerPtr e, const u_char* src, const u_char* dst,
|
||||||
const char* spa, const char* sha,
|
const char* spa, const char* sha,
|
||||||
const char* tpa, const char* tha);
|
const char* tpa, const char* tha);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ void ConnSize_Analyzer::Done()
|
||||||
Analyzer::Done();
|
Analyzer::Done();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnSize_Analyzer::ThresholdEvent(EventHandlerPtr f, uint64_t threshold, bool is_orig)
|
void ConnSize_Analyzer::ThresholdEvent(zeek::EventHandlerPtr f, uint64_t threshold, bool is_orig)
|
||||||
{
|
{
|
||||||
if ( ! f )
|
if ( ! f )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -34,7 +34,7 @@ protected:
|
||||||
uint64_t seq, const zeek::IP_Hdr* ip, int caplen) override;
|
uint64_t seq, const zeek::IP_Hdr* ip, int caplen) override;
|
||||||
void CheckThresholds(bool is_orig);
|
void CheckThresholds(bool is_orig);
|
||||||
|
|
||||||
void ThresholdEvent(EventHandlerPtr f, uint64_t threshold, bool is_orig);
|
void ThresholdEvent(zeek::EventHandlerPtr f, uint64_t threshold, bool is_orig);
|
||||||
|
|
||||||
uint64_t orig_bytes;
|
uint64_t orig_bytes;
|
||||||
uint64_t resp_bytes;
|
uint64_t resp_bytes;
|
||||||
|
|
|
@ -181,7 +181,7 @@ bool DNS_Interpreter::ParseQuestion(DNS_MsgInfo* msg,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHandlerPtr dns_event = nullptr;
|
zeek::EventHandlerPtr dns_event = nullptr;
|
||||||
|
|
||||||
if ( msg->QR == 0 )
|
if ( msg->QR == 0 )
|
||||||
dns_event = dns_request;
|
dns_event = dns_request;
|
||||||
|
@ -536,7 +536,7 @@ bool DNS_Interpreter::ParseRR_Name(DNS_MsgInfo* msg,
|
||||||
analyzer->Weird("DNS_RR_length_mismatch");
|
analyzer->Weird("DNS_RR_length_mismatch");
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHandlerPtr reply_event;
|
zeek::EventHandlerPtr reply_event;
|
||||||
switch ( msg->atype ) {
|
switch ( msg->atype ) {
|
||||||
case TYPE_NS:
|
case TYPE_NS:
|
||||||
reply_event = dns_NS_reply;
|
reply_event = dns_NS_reply;
|
||||||
|
@ -1298,7 +1298,7 @@ bool DNS_Interpreter::ParseRR_AAAA(DNS_MsgInfo* msg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHandlerPtr event;
|
zeek::EventHandlerPtr event;
|
||||||
if ( msg->atype == TYPE_AAAA )
|
if ( msg->atype == TYPE_AAAA )
|
||||||
event = dns_AAAA_reply;
|
event = dns_AAAA_reply;
|
||||||
else
|
else
|
||||||
|
@ -1467,10 +1467,10 @@ bool DNS_Interpreter::ParseRR_CAA(DNS_MsgInfo* msg,
|
||||||
|
|
||||||
|
|
||||||
void DNS_Interpreter::SendReplyOrRejectEvent(DNS_MsgInfo* msg,
|
void DNS_Interpreter::SendReplyOrRejectEvent(DNS_MsgInfo* msg,
|
||||||
EventHandlerPtr event,
|
zeek::EventHandlerPtr event,
|
||||||
const u_char*& data, int& len,
|
const u_char*& data, int& len,
|
||||||
zeek::String* question_name,
|
zeek::String* question_name,
|
||||||
zeek::String* original_name)
|
zeek::String* original_name)
|
||||||
{
|
{
|
||||||
RR_Type qtype = RR_Type(ExtractShort(data, len));
|
RR_Type qtype = RR_Type(ExtractShort(data, len));
|
||||||
int qclass = ExtractShort(data, len);
|
int qclass = ExtractShort(data, len);
|
||||||
|
|
|
@ -338,10 +338,10 @@ protected:
|
||||||
bool ParseRR_DS(DNS_MsgInfo* msg,
|
bool ParseRR_DS(DNS_MsgInfo* msg,
|
||||||
const u_char*& data, int& len, int rdlength,
|
const u_char*& data, int& len, int rdlength,
|
||||||
const u_char* msg_start);
|
const u_char* msg_start);
|
||||||
void SendReplyOrRejectEvent(DNS_MsgInfo* msg, EventHandlerPtr event,
|
void SendReplyOrRejectEvent(DNS_MsgInfo* msg, zeek::EventHandlerPtr event,
|
||||||
const u_char*& data, int& len,
|
const u_char*& data, int& len,
|
||||||
zeek::String* question_name,
|
zeek::String* question_name,
|
||||||
zeek::String* original_name);
|
zeek::String* original_name);
|
||||||
|
|
||||||
zeek::analyzer::Analyzer* analyzer;
|
zeek::analyzer::Analyzer* analyzer;
|
||||||
bool first_message;
|
bool first_message;
|
||||||
|
|
|
@ -77,7 +77,7 @@ void FTP_Analyzer::DeliverStream(int length, const u_char* data, bool orig)
|
||||||
|
|
||||||
zeek::Args vl;
|
zeek::Args vl;
|
||||||
|
|
||||||
EventHandlerPtr f;
|
zeek::EventHandlerPtr f;
|
||||||
if ( orig )
|
if ( orig )
|
||||||
{
|
{
|
||||||
int cmd_len;
|
int cmd_len;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
## .. zeek:see:: skip_smtp_data
|
## .. zeek:see:: skip_smtp_data
|
||||||
function skip_http_entity_data%(c: connection, is_orig: bool%): any
|
function skip_http_entity_data%(c: connection, is_orig: bool%): any
|
||||||
%{
|
%{
|
||||||
analyzer::ID id = mgr.CurrentAnalyzer();
|
analyzer::ID id = zeek::event_mgr.CurrentAnalyzer();
|
||||||
if ( id )
|
if ( id )
|
||||||
{
|
{
|
||||||
zeek::analyzer::Analyzer* ha = c->FindAnalyzer(id);
|
zeek::analyzer::Analyzer* ha = c->FindAnalyzer(id);
|
||||||
|
|
|
@ -515,7 +515,7 @@ void ICMP_Analyzer::Echo(double t, const struct icmp* icmpp, int len,
|
||||||
int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
||||||
{
|
{
|
||||||
// For handling all Echo related ICMP messages
|
// For handling all Echo related ICMP messages
|
||||||
EventHandlerPtr f = nullptr;
|
zeek::EventHandlerPtr f = nullptr;
|
||||||
|
|
||||||
if ( ip_hdr->NextProto() == IPPROTO_ICMPV6 )
|
if ( ip_hdr->NextProto() == IPPROTO_ICMPV6 )
|
||||||
f = (icmpp->icmp_type == ICMP6_ECHO_REQUEST)
|
f = (icmpp->icmp_type == ICMP6_ECHO_REQUEST)
|
||||||
|
@ -546,7 +546,7 @@ void ICMP_Analyzer::Echo(double t, const struct icmp* icmpp, int len,
|
||||||
void ICMP_Analyzer::RouterAdvert(double t, const struct icmp* icmpp, int len,
|
void ICMP_Analyzer::RouterAdvert(double t, const struct icmp* icmpp, int len,
|
||||||
int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
||||||
{
|
{
|
||||||
EventHandlerPtr f = icmp_router_advertisement;
|
zeek::EventHandlerPtr f = icmp_router_advertisement;
|
||||||
|
|
||||||
if ( ! f )
|
if ( ! f )
|
||||||
return;
|
return;
|
||||||
|
@ -583,7 +583,7 @@ void ICMP_Analyzer::RouterAdvert(double t, const struct icmp* icmpp, int len,
|
||||||
void ICMP_Analyzer::NeighborAdvert(double t, const struct icmp* icmpp, int len,
|
void ICMP_Analyzer::NeighborAdvert(double t, const struct icmp* icmpp, int len,
|
||||||
int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
||||||
{
|
{
|
||||||
EventHandlerPtr f = icmp_neighbor_advertisement;
|
zeek::EventHandlerPtr f = icmp_neighbor_advertisement;
|
||||||
|
|
||||||
if ( ! f )
|
if ( ! f )
|
||||||
return;
|
return;
|
||||||
|
@ -611,7 +611,7 @@ void ICMP_Analyzer::NeighborAdvert(double t, const struct icmp* icmpp, int len,
|
||||||
void ICMP_Analyzer::NeighborSolicit(double t, const struct icmp* icmpp, int len,
|
void ICMP_Analyzer::NeighborSolicit(double t, const struct icmp* icmpp, int len,
|
||||||
int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
||||||
{
|
{
|
||||||
EventHandlerPtr f = icmp_neighbor_solicitation;
|
zeek::EventHandlerPtr f = icmp_neighbor_solicitation;
|
||||||
|
|
||||||
if ( ! f )
|
if ( ! f )
|
||||||
return;
|
return;
|
||||||
|
@ -636,7 +636,7 @@ void ICMP_Analyzer::NeighborSolicit(double t, const struct icmp* icmpp, int len,
|
||||||
void ICMP_Analyzer::Redirect(double t, const struct icmp* icmpp, int len,
|
void ICMP_Analyzer::Redirect(double t, const struct icmp* icmpp, int len,
|
||||||
int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
||||||
{
|
{
|
||||||
EventHandlerPtr f = icmp_redirect;
|
zeek::EventHandlerPtr f = icmp_redirect;
|
||||||
|
|
||||||
if ( ! f )
|
if ( ! f )
|
||||||
return;
|
return;
|
||||||
|
@ -665,7 +665,7 @@ void ICMP_Analyzer::Redirect(double t, const struct icmp* icmpp, int len,
|
||||||
void ICMP_Analyzer::RouterSolicit(double t, const struct icmp* icmpp, int len,
|
void ICMP_Analyzer::RouterSolicit(double t, const struct icmp* icmpp, int len,
|
||||||
int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
||||||
{
|
{
|
||||||
EventHandlerPtr f = icmp_router_solicitation;
|
zeek::EventHandlerPtr f = icmp_router_solicitation;
|
||||||
|
|
||||||
if ( ! f )
|
if ( ! f )
|
||||||
return;
|
return;
|
||||||
|
@ -682,7 +682,7 @@ void ICMP_Analyzer::RouterSolicit(double t, const struct icmp* icmpp, int len,
|
||||||
void ICMP_Analyzer::Context4(double t, const struct icmp* icmpp,
|
void ICMP_Analyzer::Context4(double t, const struct icmp* icmpp,
|
||||||
int len, int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
int len, int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
||||||
{
|
{
|
||||||
EventHandlerPtr f = nullptr;
|
zeek::EventHandlerPtr f = nullptr;
|
||||||
|
|
||||||
switch ( icmpp->icmp_type )
|
switch ( icmpp->icmp_type )
|
||||||
{
|
{
|
||||||
|
@ -709,7 +709,7 @@ void ICMP_Analyzer::Context4(double t, const struct icmp* icmpp,
|
||||||
void ICMP_Analyzer::Context6(double t, const struct icmp* icmpp,
|
void ICMP_Analyzer::Context6(double t, const struct icmp* icmpp,
|
||||||
int len, int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
int len, int caplen, const u_char*& data, const zeek::IP_Hdr* ip_hdr)
|
||||||
{
|
{
|
||||||
EventHandlerPtr f = nullptr;
|
zeek::EventHandlerPtr f = nullptr;
|
||||||
|
|
||||||
switch ( icmpp->icmp_type )
|
switch ( icmpp->icmp_type )
|
||||||
{
|
{
|
||||||
|
|
|
@ -373,7 +373,7 @@ void Login_Analyzer::EndpointEOF(bool orig)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Login_Analyzer::LoginEvent(EventHandlerPtr f, const char* line,
|
void Login_Analyzer::LoginEvent(zeek::EventHandlerPtr f, const char* line,
|
||||||
bool no_user_okay)
|
bool no_user_okay)
|
||||||
{
|
{
|
||||||
if ( ! f )
|
if ( ! f )
|
||||||
|
@ -446,7 +446,7 @@ const char* Login_Analyzer::GetUsername(const char* line) const
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Login_Analyzer::LineEvent(EventHandlerPtr f, const char* line)
|
void Login_Analyzer::LineEvent(zeek::EventHandlerPtr f, const char* line)
|
||||||
{
|
{
|
||||||
if ( ! f )
|
if ( ! f )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -38,9 +38,9 @@ protected:
|
||||||
void NewLine(bool orig, char* line);
|
void NewLine(bool orig, char* line);
|
||||||
void AuthenticationDialog(bool orig, char* line);
|
void AuthenticationDialog(bool orig, char* line);
|
||||||
|
|
||||||
void LoginEvent(EventHandlerPtr f, const char* line, bool no_user_okay=false);
|
void LoginEvent(zeek::EventHandlerPtr f, const char* line, bool no_user_okay=false);
|
||||||
const char* GetUsername(const char* line) const;
|
const char* GetUsername(const char* line) const;
|
||||||
void LineEvent(EventHandlerPtr f, const char* line);
|
void LineEvent(zeek::EventHandlerPtr f, const char* line);
|
||||||
void Confused(const char* msg, const char* addl);
|
void Confused(const char* msg, const char* addl);
|
||||||
void ConfusionText(const char* line);
|
void ConfusionText(const char* line);
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ void NCP_Session::DeliverFrame(const binpac::NCP::ncp_frame* frame)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHandlerPtr f = frame->is_orig() ? ncp_request : ncp_reply;
|
zeek::EventHandlerPtr f = frame->is_orig() ? ncp_request : ncp_reply;
|
||||||
if ( f )
|
if ( f )
|
||||||
{
|
{
|
||||||
if ( frame->is_orig() )
|
if ( frame->is_orig() )
|
||||||
|
|
|
@ -314,8 +314,8 @@ void NetbiosSSN_Interpreter::ParseKeepAlive(const u_char* data, int len,
|
||||||
Event(netbios_session_keepalive, data, len);
|
Event(netbios_session_keepalive, data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetbiosSSN_Interpreter::Event(EventHandlerPtr event, const u_char* data,
|
void NetbiosSSN_Interpreter::Event(zeek::EventHandlerPtr event, const u_char* data,
|
||||||
int len, int is_orig)
|
int len, int is_orig)
|
||||||
{
|
{
|
||||||
if ( ! event )
|
if ( ! event )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -88,8 +88,8 @@ protected:
|
||||||
|
|
||||||
void ParseSambaMsg(const u_char* data, int len, bool is_query);
|
void ParseSambaMsg(const u_char* data, int len, bool is_query);
|
||||||
|
|
||||||
void Event(EventHandlerPtr event, const u_char* data, int len,
|
void Event(zeek::EventHandlerPtr event, const u_char* data, int len,
|
||||||
int is_orig = -1);
|
int is_orig = -1);
|
||||||
|
|
||||||
// Pass in name/length, returns in xname/xlen the converted
|
// Pass in name/length, returns in xname/xlen the converted
|
||||||
// name/length. Returns 0 on failure; xname may still be
|
// name/length. Returns 0 on failure; xname may still be
|
||||||
|
|
|
@ -160,7 +160,7 @@ void PIA_UDP::ActivateAnalyzer(zeek::analyzer::Tag tag, const zeek::detail::Rule
|
||||||
tag = GetAnalyzerTag();
|
tag = GetAnalyzerTag();
|
||||||
|
|
||||||
const auto& tval = tag.AsVal();
|
const auto& tval = tag.AsVal();
|
||||||
mgr.Enqueue(protocol_late_match, ConnVal(), tval);
|
zeek::event_mgr.Enqueue(protocol_late_match, ConnVal(), tval);
|
||||||
}
|
}
|
||||||
|
|
||||||
pkt_buffer.state = dpd_late_match_stop ? SKIPPING : MATCHING_ONLY;
|
pkt_buffer.state = dpd_late_match_stop ? SKIPPING : MATCHING_ONLY;
|
||||||
|
@ -307,7 +307,7 @@ void PIA_TCP::ActivateAnalyzer(zeek::analyzer::Tag tag, const zeek::detail::Rule
|
||||||
tag = GetAnalyzerTag();
|
tag = GetAnalyzerTag();
|
||||||
|
|
||||||
const auto& tval = tag.AsVal();
|
const auto& tval = tag.AsVal();
|
||||||
mgr.Enqueue(protocol_late_match, ConnVal(), tval);
|
zeek::event_mgr.Enqueue(protocol_late_match, ConnVal(), tval);
|
||||||
}
|
}
|
||||||
|
|
||||||
stream_buffer.state = dpd_late_match_stop ? SKIPPING : MATCHING_ONLY;
|
stream_buffer.state = dpd_late_match_stop ? SKIPPING : MATCHING_ONLY;
|
||||||
|
|
|
@ -910,8 +910,8 @@ std::vector<std::string> POP3_Analyzer::TokenizeLine(const std::string& input, c
|
||||||
return tokens;
|
return tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
void POP3_Analyzer::POP3Event(EventHandlerPtr event, bool is_orig,
|
void POP3_Analyzer::POP3Event(zeek::EventHandlerPtr event, bool is_orig,
|
||||||
const char* arg1, const char* arg2)
|
const char* arg1, const char* arg2)
|
||||||
{
|
{
|
||||||
if ( ! event )
|
if ( ! event )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -102,8 +102,8 @@ protected:
|
||||||
std::vector<std::string> TokenizeLine(const std::string& input, char split);
|
std::vector<std::string> TokenizeLine(const std::string& input, char split);
|
||||||
int ParseCmd(std::string cmd);
|
int ParseCmd(std::string cmd);
|
||||||
void AuthSuccessfull();
|
void AuthSuccessfull();
|
||||||
void POP3Event(EventHandlerPtr event, bool is_orig,
|
void POP3Event(zeek::EventHandlerPtr event, bool is_orig,
|
||||||
const char* arg1 = nullptr, const char* arg2 = nullptr);
|
const char* arg1 = nullptr, const char* arg2 = nullptr);
|
||||||
|
|
||||||
mime::MIME_Mail* mail;
|
mime::MIME_Mail* mail;
|
||||||
std::list<std::string> cmds;
|
std::list<std::string> cmds;
|
||||||
|
|
|
@ -68,7 +68,7 @@ bool MOUNT_Interp::RPC_BuildReply(RPC_CallInfo* c, BifEnum::rpc_status rpc_statu
|
||||||
const u_char*& buf, int& n, double start_time,
|
const u_char*& buf, int& n, double start_time,
|
||||||
double last_time, int reply_len)
|
double last_time, int reply_len)
|
||||||
{
|
{
|
||||||
EventHandlerPtr event = nullptr;
|
zeek::EventHandlerPtr event = nullptr;
|
||||||
zeek::ValPtr reply;
|
zeek::ValPtr reply;
|
||||||
BifEnum::MOUNT3::status_t mount_status = BifEnum::MOUNT3::MNT3_OK;
|
BifEnum::MOUNT3::status_t mount_status = BifEnum::MOUNT3::MNT3_OK;
|
||||||
bool rpc_success = ( rpc_status == BifEnum::RPC_SUCCESS );
|
bool rpc_success = ( rpc_status == BifEnum::RPC_SUCCESS );
|
||||||
|
|
|
@ -123,7 +123,7 @@ bool NFS_Interp::RPC_BuildReply(RPC_CallInfo* c, BifEnum::rpc_status rpc_status,
|
||||||
const u_char*& buf, int& n, double start_time,
|
const u_char*& buf, int& n, double start_time,
|
||||||
double last_time, int reply_len)
|
double last_time, int reply_len)
|
||||||
{
|
{
|
||||||
EventHandlerPtr event = nullptr;
|
zeek::EventHandlerPtr event = nullptr;
|
||||||
zeek::ValPtr reply;
|
zeek::ValPtr reply;
|
||||||
BifEnum::NFS3::status_t nfs_status = BifEnum::NFS3::NFS3ERR_OK;
|
BifEnum::NFS3::status_t nfs_status = BifEnum::NFS3::NFS3ERR_OK;
|
||||||
bool rpc_success = ( rpc_status == BifEnum::RPC_SUCCESS );
|
bool rpc_success = ( rpc_status == BifEnum::RPC_SUCCESS );
|
||||||
|
|
|
@ -78,7 +78,7 @@ bool PortmapperInterp::RPC_BuildReply(RPC_CallInfo* c, BifEnum::rpc_status statu
|
||||||
double start_time, double last_time,
|
double start_time, double last_time,
|
||||||
int reply_len)
|
int reply_len)
|
||||||
{
|
{
|
||||||
EventHandlerPtr event;
|
zeek::EventHandlerPtr event;
|
||||||
zeek::ValPtr reply;
|
zeek::ValPtr reply;
|
||||||
int success = (status == BifEnum::RPC_SUCCESS);
|
int success = (status == BifEnum::RPC_SUCCESS);
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ uint32_t PortmapperInterp::CheckPort(uint32_t port)
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PortmapperInterp::Event(EventHandlerPtr f, zeek::ValPtr request, BifEnum::rpc_status status, zeek::ValPtr reply)
|
void PortmapperInterp::Event(zeek::EventHandlerPtr f, zeek::ValPtr request, BifEnum::rpc_status status, zeek::ValPtr reply)
|
||||||
{
|
{
|
||||||
if ( ! f )
|
if ( ! f )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -17,7 +17,7 @@ protected:
|
||||||
double last_time, int reply_len) override;
|
double last_time, int reply_len) override;
|
||||||
uint32_t CheckPort(uint32_t port);
|
uint32_t CheckPort(uint32_t port);
|
||||||
|
|
||||||
void Event(EventHandlerPtr f, zeek::ValPtr request, BifEnum::rpc_status status, zeek::ValPtr reply);
|
void Event(zeek::EventHandlerPtr f, zeek::ValPtr request, BifEnum::rpc_status status, zeek::ValPtr reply);
|
||||||
|
|
||||||
zeek::ValPtr ExtractMapping(const u_char*& buf, int& len);
|
zeek::ValPtr ExtractMapping(const u_char*& buf, int& len);
|
||||||
zeek::ValPtr ExtractPortRequest(const u_char*& buf, int& len);
|
zeek::ValPtr ExtractPortRequest(const u_char*& buf, int& len);
|
||||||
|
|
|
@ -129,7 +129,7 @@ bool SteppingStoneEndpoint::DataSent(double t, uint64_t seq, int len, int caplen
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SteppingStoneEndpoint::Event(EventHandlerPtr f, int id1, int id2)
|
void SteppingStoneEndpoint::Event(zeek::EventHandlerPtr f, int id1, int id2)
|
||||||
{
|
{
|
||||||
if ( ! f )
|
if ( ! f )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
const zeek::IP_Hdr* ip, const struct tcphdr* tp);
|
const zeek::IP_Hdr* ip, const struct tcphdr* tp);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Event(EventHandlerPtr f, int id1, int id2 = -1);
|
void Event(zeek::EventHandlerPtr f, int id1, int id2 = -1);
|
||||||
void CreateEndpEvent(bool is_orig);
|
void CreateEndpEvent(bool is_orig);
|
||||||
|
|
||||||
tcp::TCP_Endpoint* endp;
|
tcp::TCP_Endpoint* endp;
|
||||||
|
|
|
@ -703,7 +703,7 @@ bool Manager::AutoPublishEvent(string topic, zeek::Val* event)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto handler = event_registry->Lookup(event_val->Name());
|
auto handler = zeek::event_registry->Lookup(event_val->Name());
|
||||||
if ( ! handler )
|
if ( ! handler )
|
||||||
{
|
{
|
||||||
Error("Broker::auto_publish failed to lookup event '%s'",
|
Error("Broker::auto_publish failed to lookup event '%s'",
|
||||||
|
@ -733,7 +733,7 @@ bool Manager::AutoUnpublishEvent(const string& topic, zeek::Val* event)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto handler = event_registry->Lookup(event_val->Name());
|
auto handler = zeek::event_registry->Lookup(event_val->Name());
|
||||||
|
|
||||||
if ( ! handler )
|
if ( ! handler )
|
||||||
{
|
{
|
||||||
|
@ -1153,7 +1153,7 @@ void Manager::ProcessEvent(const broker::topic& topic, broker::zeek::Event ev)
|
||||||
DBG_LOG(DBG_BROKER, "Process event: %s %s",
|
DBG_LOG(DBG_BROKER, "Process event: %s %s",
|
||||||
name.data(), RenderMessage(args).data());
|
name.data(), RenderMessage(args).data());
|
||||||
++statistics.num_events_incoming;
|
++statistics.num_events_incoming;
|
||||||
auto handler = event_registry->Lookup(name);
|
auto handler = zeek::event_registry->Lookup(name);
|
||||||
|
|
||||||
if ( ! handler )
|
if ( ! handler )
|
||||||
return;
|
return;
|
||||||
|
@ -1216,7 +1216,7 @@ void Manager::ProcessEvent(const broker::topic& topic, broker::zeek::Event ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( vl.size() == args.size() )
|
if ( vl.size() == args.size() )
|
||||||
mgr.Enqueue(handler, std::move(vl), SOURCE_BROKER);
|
zeek::event_mgr.Enqueue(handler, std::move(vl), SOURCE_BROKER);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bro_broker::Manager::ProcessLogCreate(broker::zeek::LogCreate lc)
|
bool bro_broker::Manager::ProcessLogCreate(broker::zeek::LogCreate lc)
|
||||||
|
@ -1410,7 +1410,7 @@ void Manager::ProcessStatus(broker::status stat)
|
||||||
|
|
||||||
auto ctx = stat.context<broker::endpoint_info>();
|
auto ctx = stat.context<broker::endpoint_info>();
|
||||||
|
|
||||||
EventHandlerPtr event;
|
zeek::EventHandlerPtr event;
|
||||||
switch (stat.code()) {
|
switch (stat.code()) {
|
||||||
case broker::sc::unspecified:
|
case broker::sc::unspecified:
|
||||||
event = Broker::status;
|
event = Broker::status;
|
||||||
|
@ -1469,7 +1469,7 @@ void Manager::ProcessStatus(broker::status stat)
|
||||||
auto str = stat.message();
|
auto str = stat.message();
|
||||||
auto msg = zeek::make_intrusive<zeek::StringVal>(str ? *str : "");
|
auto msg = zeek::make_intrusive<zeek::StringVal>(str ? *str : "");
|
||||||
|
|
||||||
mgr.Enqueue(event, std::move(endpoint_info), std::move(msg));
|
zeek::event_mgr.Enqueue(event, std::move(endpoint_info), std::move(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::ProcessError(broker::error err)
|
void Manager::ProcessError(broker::error err)
|
||||||
|
@ -1502,10 +1502,9 @@ void Manager::ProcessError(broker::error err)
|
||||||
msg = fmt("[%s] %s", caf::to_string(err.category()).c_str(), caf::to_string(err.context()).c_str());
|
msg = fmt("[%s] %s", caf::to_string(err.category()).c_str(), caf::to_string(err.context()).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
mgr.Enqueue(Broker::error,
|
zeek::event_mgr.Enqueue(Broker::error,
|
||||||
zeek::BifType::Enum::Broker::ErrorCode->GetEnumVal(ec),
|
zeek::BifType::Enum::Broker::ErrorCode->GetEnumVal(ec),
|
||||||
zeek::make_intrusive<zeek::StringVal>(msg)
|
zeek::make_intrusive<zeek::StringVal>(msg));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::ProcessStoreResponse(StoreHandleVal* s, broker::store::response response)
|
void Manager::ProcessStoreResponse(StoreHandleVal* s, broker::store::response response)
|
||||||
|
|
|
@ -612,12 +612,12 @@ void File::Gap(uint64_t offset, uint64_t len)
|
||||||
IncrementByteCount(len, missing_bytes_idx);
|
IncrementByteCount(len, missing_bytes_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool File::FileEventAvailable(EventHandlerPtr h)
|
bool File::FileEventAvailable(zeek::EventHandlerPtr h)
|
||||||
{
|
{
|
||||||
return h && ! file_mgr->IsIgnored(id);
|
return h && ! file_mgr->IsIgnored(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void File::FileEvent(EventHandlerPtr h)
|
void File::FileEvent(zeek::EventHandlerPtr h)
|
||||||
{
|
{
|
||||||
if ( ! FileEventAvailable(h) )
|
if ( ! FileEventAvailable(h) )
|
||||||
return;
|
return;
|
||||||
|
@ -625,27 +625,27 @@ void File::FileEvent(EventHandlerPtr h)
|
||||||
FileEvent(h, zeek::Args{val});
|
FileEvent(h, zeek::Args{val});
|
||||||
}
|
}
|
||||||
|
|
||||||
void File::FileEvent(EventHandlerPtr h, val_list* vl)
|
void File::FileEvent(zeek::EventHandlerPtr h, val_list* vl)
|
||||||
{
|
{
|
||||||
FileEvent(h, zeek::val_list_to_args(*vl));
|
FileEvent(h, zeek::val_list_to_args(*vl));
|
||||||
delete vl;
|
delete vl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void File::FileEvent(EventHandlerPtr h, val_list vl)
|
void File::FileEvent(zeek::EventHandlerPtr h, val_list vl)
|
||||||
{
|
{
|
||||||
FileEvent(h, zeek::val_list_to_args(vl));
|
FileEvent(h, zeek::val_list_to_args(vl));
|
||||||
}
|
}
|
||||||
|
|
||||||
void File::FileEvent(EventHandlerPtr h, zeek::Args args)
|
void File::FileEvent(zeek::EventHandlerPtr h, zeek::Args args)
|
||||||
{
|
{
|
||||||
mgr.Enqueue(h, std::move(args));
|
zeek::event_mgr.Enqueue(h, std::move(args));
|
||||||
|
|
||||||
if ( h == file_new || h == file_over_new_connection ||
|
if ( h == file_new || h == file_over_new_connection ||
|
||||||
h == file_sniff ||
|
h == file_sniff ||
|
||||||
h == file_timeout || h == file_extraction_limit )
|
h == file_timeout || h == file_extraction_limit )
|
||||||
{
|
{
|
||||||
// immediate feedback is required for these events.
|
// immediate feedback is required for these events.
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
analyzers.DrainModifications();
|
analyzers.DrainModifications();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
#include "WeirdState.h"
|
#include "WeirdState.h"
|
||||||
|
|
||||||
class Connection;
|
class Connection;
|
||||||
class EventHandlerPtr;
|
|
||||||
|
|
||||||
|
ZEEK_FORWARD_DECLARE_NAMESPACED(EventHandlerPtr, zeek);
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(RecordVal, zeek);
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(RecordType, zeek);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(RecordType, zeek);
|
||||||
namespace zeek {
|
namespace zeek {
|
||||||
|
@ -179,14 +179,14 @@ public:
|
||||||
* @param h pointer to an event handler.
|
* @param h pointer to an event handler.
|
||||||
* @return true if event has a handler and the file isn't ignored.
|
* @return true if event has a handler and the file isn't ignored.
|
||||||
*/
|
*/
|
||||||
bool FileEventAvailable(EventHandlerPtr h);
|
bool FileEventAvailable(zeek::EventHandlerPtr h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raises an event related to the file's life-cycle, the only parameter
|
* Raises an event related to the file's life-cycle, the only parameter
|
||||||
* to that event is the \c fa_file record..
|
* to that event is the \c fa_file record..
|
||||||
* @param h pointer to an event handler.
|
* @param h pointer to an event handler.
|
||||||
*/
|
*/
|
||||||
void FileEvent(EventHandlerPtr h);
|
void FileEvent(zeek::EventHandlerPtr h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raises an event related to the file's life-cycle.
|
* Raises an event related to the file's life-cycle.
|
||||||
|
@ -194,7 +194,7 @@ public:
|
||||||
* @param vl list of argument values to pass to event call.
|
* @param vl list of argument values to pass to event call.
|
||||||
*/
|
*/
|
||||||
[[deprecated("Remove in v4.1. Use zeek::Args overload instead.")]]
|
[[deprecated("Remove in v4.1. Use zeek::Args overload instead.")]]
|
||||||
void FileEvent(EventHandlerPtr h, val_list* vl);
|
void FileEvent(zeek::EventHandlerPtr h, val_list* vl);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raises an event related to the file's life-cycle.
|
* Raises an event related to the file's life-cycle.
|
||||||
|
@ -202,14 +202,14 @@ public:
|
||||||
* @param vl list of argument values to pass to event call.
|
* @param vl list of argument values to pass to event call.
|
||||||
*/
|
*/
|
||||||
[[deprecated("Remove in v4.1. Use zeek::Args overload instead.")]]
|
[[deprecated("Remove in v4.1. Use zeek::Args overload instead.")]]
|
||||||
void FileEvent(EventHandlerPtr h, val_list vl);
|
void FileEvent(zeek::EventHandlerPtr h, val_list vl);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raises an event related to the file's life-cycle.
|
* Raises an event related to the file's life-cycle.
|
||||||
* @param h pointer to an event handler.
|
* @param h pointer to an event handler.
|
||||||
* @param args list of argument values to pass to event call.
|
* @param args list of argument values to pass to event call.
|
||||||
*/
|
*/
|
||||||
void FileEvent(EventHandlerPtr h, zeek::Args args);
|
void FileEvent(zeek::EventHandlerPtr h, zeek::Args args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the MIME type for a file to a specific value.
|
* Sets the MIME type for a file to a specific value.
|
||||||
|
|
|
@ -61,7 +61,7 @@ void Manager::Terminate()
|
||||||
for ( const string& key : keys )
|
for ( const string& key : keys )
|
||||||
Timeout(key, true);
|
Timeout(key, true);
|
||||||
|
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
}
|
}
|
||||||
|
|
||||||
string Manager::HashHandle(const string& handle) const
|
string Manager::HashHandle(const string& handle) const
|
||||||
|
@ -435,8 +435,8 @@ string Manager::GetFileID(const zeek::analyzer::Tag& tag, Connection* c, bool is
|
||||||
|
|
||||||
const auto& tagval = tag.AsVal();
|
const auto& tagval = tag.AsVal();
|
||||||
|
|
||||||
mgr.Enqueue(get_file_handle, tagval, c->ConnVal(), zeek::val_mgr->Bool(is_orig));
|
zeek::event_mgr.Enqueue(get_file_handle, tagval, c->ConnVal(), zeek::val_mgr->Bool(is_orig));
|
||||||
mgr.Drain(); // need file handle immediately so we don't have to buffer data
|
zeek::event_mgr.Drain(); // need file handle immediately so we don't have to buffer data
|
||||||
return current_file_id;
|
return current_file_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
using namespace file_analysis;
|
using namespace file_analysis;
|
||||||
|
|
||||||
DataEvent::DataEvent(zeek::RecordValPtr args, File* file,
|
DataEvent::DataEvent(zeek::RecordValPtr args, File* file,
|
||||||
EventHandlerPtr ce, EventHandlerPtr se)
|
zeek::EventHandlerPtr ce, zeek::EventHandlerPtr se)
|
||||||
: file_analysis::Analyzer(file_mgr->GetComponentTag("DATA_EVENT"),
|
: file_analysis::Analyzer(file_mgr->GetComponentTag("DATA_EVENT"),
|
||||||
std::move(args), file),
|
std::move(args), file),
|
||||||
chunk_event(ce), stream_event(se)
|
chunk_event(ce), stream_event(se)
|
||||||
|
@ -27,14 +27,14 @@ file_analysis::Analyzer* DataEvent::Instantiate(zeek::RecordValPtr args,
|
||||||
|
|
||||||
if ( ! chunk_val && ! stream_val ) return nullptr;
|
if ( ! chunk_val && ! stream_val ) return nullptr;
|
||||||
|
|
||||||
EventHandlerPtr chunk;
|
zeek::EventHandlerPtr chunk;
|
||||||
EventHandlerPtr stream;
|
zeek::EventHandlerPtr stream;
|
||||||
|
|
||||||
if ( chunk_val )
|
if ( chunk_val )
|
||||||
chunk = event_registry->Lookup(chunk_val->AsFunc()->Name());
|
chunk = zeek::event_registry->Lookup(chunk_val->AsFunc()->Name());
|
||||||
|
|
||||||
if ( stream_val )
|
if ( stream_val )
|
||||||
stream = event_registry->Lookup(stream_val->AsFunc()->Name());
|
stream = zeek::event_registry->Lookup(stream_val->AsFunc()->Name());
|
||||||
|
|
||||||
return new DataEvent(std::move(args), file, chunk, stream);
|
return new DataEvent(std::move(args), file, chunk, stream);
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,10 @@ bool DataEvent::DeliverChunk(const u_char* data, uint64_t len, uint64_t offset)
|
||||||
{
|
{
|
||||||
if ( ! chunk_event ) return true;
|
if ( ! chunk_event ) return true;
|
||||||
|
|
||||||
mgr.Enqueue(chunk_event,
|
zeek::event_mgr.Enqueue(chunk_event,
|
||||||
GetFile()->ToVal(),
|
GetFile()->ToVal(),
|
||||||
zeek::make_intrusive<zeek::StringVal>(new zeek::String(data, len, false)),
|
zeek::make_intrusive<zeek::StringVal>(new zeek::String(data, len, false)),
|
||||||
zeek::val_mgr->Count(offset)
|
zeek::val_mgr->Count(offset)
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -56,9 +56,9 @@ bool DataEvent::DeliverStream(const u_char* data, uint64_t len)
|
||||||
{
|
{
|
||||||
if ( ! stream_event ) return true;
|
if ( ! stream_event ) return true;
|
||||||
|
|
||||||
mgr.Enqueue(stream_event,
|
zeek::event_mgr.Enqueue(stream_event,
|
||||||
GetFile()->ToVal(),
|
GetFile()->ToVal(),
|
||||||
zeek::make_intrusive<zeek::StringVal>(new zeek::String(data, len, false))
|
zeek::make_intrusive<zeek::StringVal>(new zeek::String(data, len, false))
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -58,11 +58,11 @@ protected:
|
||||||
* sequential file data.
|
* sequential file data.
|
||||||
*/
|
*/
|
||||||
DataEvent(zeek::RecordValPtr args, File* file,
|
DataEvent(zeek::RecordValPtr args, File* file,
|
||||||
EventHandlerPtr ce, EventHandlerPtr se);
|
zeek::EventHandlerPtr ce, zeek::EventHandlerPtr se);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EventHandlerPtr chunk_event;
|
zeek::EventHandlerPtr chunk_event;
|
||||||
EventHandlerPtr stream_event;
|
zeek::EventHandlerPtr stream_event;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace file_analysis
|
} // namespace file_analysis
|
||||||
|
|
|
@ -70,8 +70,8 @@ void Entropy::Finalize()
|
||||||
ent_result->Assign<zeek::DoubleVal>(3, montepi);
|
ent_result->Assign<zeek::DoubleVal>(3, montepi);
|
||||||
ent_result->Assign<zeek::DoubleVal>(4, scc);
|
ent_result->Assign<zeek::DoubleVal>(4, scc);
|
||||||
|
|
||||||
mgr.Enqueue(file_entropy,
|
zeek::event_mgr.Enqueue(file_entropy,
|
||||||
GetFile()->ToVal(),
|
GetFile()->ToVal(),
|
||||||
std::move(ent_result)
|
std::move(ent_result)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,9 @@ void Hash::Finalize()
|
||||||
if ( ! file_hash )
|
if ( ! file_hash )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mgr.Enqueue(file_hash,
|
zeek::event_mgr.Enqueue(file_hash,
|
||||||
GetFile()->ToVal(),
|
GetFile()->ToVal(),
|
||||||
zeek::make_intrusive<zeek::StringVal>(kind),
|
zeek::make_intrusive<zeek::StringVal>(kind),
|
||||||
hash->Get()
|
hash->Get()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ refine flow File += {
|
||||||
dh->Assign(15, zeek::val_mgr->Count(${h.OEMinfo}));
|
dh->Assign(15, zeek::val_mgr->Count(${h.OEMinfo}));
|
||||||
dh->Assign(16, zeek::val_mgr->Count(${h.AddressOfNewExeHeader}));
|
dh->Assign(16, zeek::val_mgr->Count(${h.AddressOfNewExeHeader}));
|
||||||
|
|
||||||
mgr.Enqueue(pe_dos_header,
|
zeek::event_mgr.Enqueue(pe_dos_header,
|
||||||
connection()->bro_analyzer()->GetFile()->ToVal(),
|
connection()->bro_analyzer()->GetFile()->ToVal(),
|
||||||
std::move(dh));
|
std::move(dh));
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ refine flow File += {
|
||||||
function proc_dos_code(code: bytestring): bool
|
function proc_dos_code(code: bytestring): bool
|
||||||
%{
|
%{
|
||||||
if ( pe_dos_code )
|
if ( pe_dos_code )
|
||||||
mgr.Enqueue(pe_dos_code,
|
zeek::event_mgr.Enqueue(pe_dos_code,
|
||||||
connection()->bro_analyzer()->GetFile()->ToVal(),
|
connection()->bro_analyzer()->GetFile()->ToVal(),
|
||||||
zeek::make_intrusive<zeek::StringVal>(code.length(), (const char*) code.data())
|
zeek::make_intrusive<zeek::StringVal>(code.length(), (const char*) code.data())
|
||||||
);
|
);
|
||||||
|
@ -104,7 +104,7 @@ refine flow File += {
|
||||||
fh->Assign(4, zeek::val_mgr->Count(${h.SizeOfOptionalHeader}));
|
fh->Assign(4, zeek::val_mgr->Count(${h.SizeOfOptionalHeader}));
|
||||||
fh->Assign(5, characteristics_to_bro(${h.Characteristics}, 16));
|
fh->Assign(5, characteristics_to_bro(${h.Characteristics}, 16));
|
||||||
|
|
||||||
mgr.Enqueue(pe_file_header,
|
zeek::event_mgr.Enqueue(pe_file_header,
|
||||||
connection()->bro_analyzer()->GetFile()->ToVal(),
|
connection()->bro_analyzer()->GetFile()->ToVal(),
|
||||||
std::move(fh));
|
std::move(fh));
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ refine flow File += {
|
||||||
|
|
||||||
oh->Assign(23, process_rvas(${h.rvas}));
|
oh->Assign(23, process_rvas(${h.rvas}));
|
||||||
|
|
||||||
mgr.Enqueue(pe_optional_header,
|
zeek::event_mgr.Enqueue(pe_optional_header,
|
||||||
connection()->bro_analyzer()->GetFile()->ToVal(),
|
connection()->bro_analyzer()->GetFile()->ToVal(),
|
||||||
std::move(oh));
|
std::move(oh));
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ refine flow File += {
|
||||||
section_header->Assign(8, zeek::val_mgr->Count(${h.non_used_num_of_line_nums}));
|
section_header->Assign(8, zeek::val_mgr->Count(${h.non_used_num_of_line_nums}));
|
||||||
section_header->Assign(9, characteristics_to_bro(${h.characteristics}, 32));
|
section_header->Assign(9, characteristics_to_bro(${h.characteristics}, 32));
|
||||||
|
|
||||||
mgr.Enqueue(pe_section_header,
|
zeek::event_mgr.Enqueue(pe_section_header,
|
||||||
connection()->bro_analyzer()->GetFile()->ToVal(),
|
connection()->bro_analyzer()->GetFile()->ToVal(),
|
||||||
std::move(section_header)
|
std::move(section_header)
|
||||||
);
|
);
|
||||||
|
|
|
@ -86,7 +86,7 @@ refine flow Flow += {
|
||||||
ids_event->Assign(11, to_port(${ev.dst_p}, ${ev.protocol}));
|
ids_event->Assign(11, to_port(${ev.dst_p}, ${ev.protocol}));
|
||||||
ids_event->Assign(17, zeek::val_mgr->Count(${ev.packet_action}));
|
ids_event->Assign(17, zeek::val_mgr->Count(${ev.packet_action}));
|
||||||
|
|
||||||
mgr.Enqueue(::unified2_event,
|
zeek::event_mgr.Enqueue(::unified2_event,
|
||||||
connection()->bro_analyzer()->GetFile()->ToVal(),
|
connection()->bro_analyzer()->GetFile()->ToVal(),
|
||||||
std::move(ids_event));
|
std::move(ids_event));
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ refine flow Flow += {
|
||||||
ids_event->Assign(15, zeek::val_mgr->Count(${ev.mpls_label}));
|
ids_event->Assign(15, zeek::val_mgr->Count(${ev.mpls_label}));
|
||||||
ids_event->Assign(16, zeek::val_mgr->Count(${ev.vlan_id}));
|
ids_event->Assign(16, zeek::val_mgr->Count(${ev.vlan_id}));
|
||||||
|
|
||||||
mgr.Enqueue(::unified2_event,
|
zeek::event_mgr.Enqueue(::unified2_event,
|
||||||
connection()->bro_analyzer()->GetFile()->ToVal(),
|
connection()->bro_analyzer()->GetFile()->ToVal(),
|
||||||
std::move(ids_event));
|
std::move(ids_event));
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ refine flow Flow += {
|
||||||
packet->Assign(4, zeek::val_mgr->Count(${pkt.link_type}));
|
packet->Assign(4, zeek::val_mgr->Count(${pkt.link_type}));
|
||||||
packet->Assign(5, to_stringval(${pkt.packet_data}));
|
packet->Assign(5, to_stringval(${pkt.packet_data}));
|
||||||
|
|
||||||
mgr.Enqueue(::unified2_packet,
|
zeek::event_mgr.Enqueue(::unified2_packet,
|
||||||
connection()->bro_analyzer()->GetFile()->ToVal(),
|
connection()->bro_analyzer()->GetFile()->ToVal(),
|
||||||
std::move(packet));
|
std::move(packet));
|
||||||
}
|
}
|
||||||
|
|
|
@ -415,9 +415,9 @@ void file_analysis::OCSP::ParseRequest(OCSP_REQUEST* req)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( ocsp_request )
|
if ( ocsp_request )
|
||||||
mgr.Enqueue(ocsp_request,
|
zeek::event_mgr.Enqueue(ocsp_request,
|
||||||
GetFile()->ToVal(),
|
GetFile()->ToVal(),
|
||||||
zeek::val_mgr->Count(version)
|
zeek::val_mgr->Count(version)
|
||||||
);
|
);
|
||||||
|
|
||||||
BIO *bio = BIO_new(BIO_s_mem());
|
BIO *bio = BIO_new(BIO_s_mem());
|
||||||
|
@ -435,7 +435,7 @@ void file_analysis::OCSP::ParseRequest(OCSP_REQUEST* req)
|
||||||
ocsp_add_cert_id(cert_id, &rvl, bio);
|
ocsp_add_cert_id(cert_id, &rvl, bio);
|
||||||
|
|
||||||
if ( ocsp_request_certificate )
|
if ( ocsp_request_certificate )
|
||||||
mgr.Enqueue(ocsp_request_certificate, std::move(rvl));
|
zeek::event_mgr.Enqueue(ocsp_request_certificate, std::move(rvl));
|
||||||
}
|
}
|
||||||
|
|
||||||
BIO_free(bio);
|
BIO_free(bio);
|
||||||
|
@ -461,7 +461,7 @@ void file_analysis::OCSP::ParseResponse(OCSP_RESPONSE *resp)
|
||||||
auto status_val = zeek::make_intrusive<zeek::StringVal>(strlen(status_str), status_str);
|
auto status_val = zeek::make_intrusive<zeek::StringVal>(strlen(status_str), status_str);
|
||||||
|
|
||||||
if ( ocsp_response_status )
|
if ( ocsp_response_status )
|
||||||
mgr.Enqueue(ocsp_response_status, GetFile()->ToVal(), status_val);
|
zeek::event_mgr.Enqueue(ocsp_response_status, GetFile()->ToVal(), status_val);
|
||||||
|
|
||||||
//if (!resp_bytes)
|
//if (!resp_bytes)
|
||||||
// {
|
// {
|
||||||
|
@ -592,7 +592,7 @@ void file_analysis::OCSP::ParseResponse(OCSP_RESPONSE *resp)
|
||||||
rvl.emplace_back(zeek::make_intrusive<zeek::TimeVal>(0.0));
|
rvl.emplace_back(zeek::make_intrusive<zeek::TimeVal>(0.0));
|
||||||
|
|
||||||
if ( ocsp_response_certificate )
|
if ( ocsp_response_certificate )
|
||||||
mgr.Enqueue(ocsp_response_certificate, std::move(rvl));
|
zeek::event_mgr.Enqueue(ocsp_response_certificate, std::move(rvl));
|
||||||
|
|
||||||
num_ext = OCSP_SINGLERESP_get_ext_count(single_resp);
|
num_ext = OCSP_SINGLERESP_get_ext_count(single_resp);
|
||||||
for ( int k = 0; k < num_ext; ++k )
|
for ( int k = 0; k < num_ext; ++k )
|
||||||
|
@ -643,7 +643,7 @@ void file_analysis::OCSP::ParseResponse(OCSP_RESPONSE *resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ocsp_response_bytes )
|
if ( ocsp_response_bytes )
|
||||||
mgr.Enqueue(ocsp_response_bytes, std::move(vl));
|
zeek::event_mgr.Enqueue(ocsp_response_bytes, std::move(vl));
|
||||||
|
|
||||||
// ok, now that we are done with the actual certificate - let's parse extensions :)
|
// ok, now that we are done with the actual certificate - let's parse extensions :)
|
||||||
num_ext = OCSP_BASICRESP_get_ext_count(basic_resp);
|
num_ext = OCSP_BASICRESP_get_ext_count(basic_resp);
|
||||||
|
|
|
@ -86,10 +86,10 @@ bool file_analysis::X509::EndOfFile()
|
||||||
|
|
||||||
// and send the record on to scriptland
|
// and send the record on to scriptland
|
||||||
if ( x509_certificate )
|
if ( x509_certificate )
|
||||||
mgr.Enqueue(x509_certificate,
|
zeek::event_mgr.Enqueue(x509_certificate,
|
||||||
GetFile()->ToVal(),
|
GetFile()->ToVal(),
|
||||||
zeek::IntrusivePtr{zeek::NewRef{}, cert_val},
|
zeek::IntrusivePtr{zeek::NewRef{}, cert_val},
|
||||||
cert_record);
|
cert_record);
|
||||||
|
|
||||||
// after parsing the certificate - parse the extensions...
|
// after parsing the certificate - parse the extensions...
|
||||||
|
|
||||||
|
@ -296,9 +296,9 @@ void file_analysis::X509::ParseBasicConstraints(X509_EXTENSION* ex)
|
||||||
if ( constr->pathlen )
|
if ( constr->pathlen )
|
||||||
pBasicConstraint->Assign(1, zeek::val_mgr->Count((int32_t) ASN1_INTEGER_get(constr->pathlen)));
|
pBasicConstraint->Assign(1, zeek::val_mgr->Count((int32_t) ASN1_INTEGER_get(constr->pathlen)));
|
||||||
|
|
||||||
mgr.Enqueue(x509_ext_basic_constraints,
|
zeek::event_mgr.Enqueue(x509_ext_basic_constraints,
|
||||||
GetFile()->ToVal(),
|
GetFile()->ToVal(),
|
||||||
std::move(pBasicConstraint)
|
std::move(pBasicConstraint)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,9 +437,9 @@ void file_analysis::X509::ParseSAN(X509_EXTENSION* ext)
|
||||||
|
|
||||||
sanExt->Assign(4, zeek::val_mgr->Bool(otherfields));
|
sanExt->Assign(4, zeek::val_mgr->Bool(otherfields));
|
||||||
|
|
||||||
mgr.Enqueue(x509_ext_subject_alternative_name,
|
zeek::event_mgr.Enqueue(x509_ext_subject_alternative_name,
|
||||||
GetFile()->ToVal(),
|
GetFile()->ToVal(),
|
||||||
std::move(sanExt));
|
std::move(sanExt));
|
||||||
GENERAL_NAMES_free(altname);
|
GENERAL_NAMES_free(altname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -231,7 +231,7 @@ void file_analysis::X509Common::ParseSignedCertificateTimestamps(X509_EXTENSION*
|
||||||
delete conn;
|
delete conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void file_analysis::X509Common::ParseExtension(X509_EXTENSION* ex, const EventHandlerPtr& h, bool global)
|
void file_analysis::X509Common::ParseExtension(X509_EXTENSION* ex, const zeek::EventHandlerPtr& h, bool global)
|
||||||
{
|
{
|
||||||
char name[256];
|
char name[256];
|
||||||
char oid[256];
|
char oid[256];
|
||||||
|
@ -288,11 +288,11 @@ void file_analysis::X509Common::ParseExtension(X509_EXTENSION* ex, const EventHa
|
||||||
// but I am not sure if there is a better way to do it...
|
// but I am not sure if there is a better way to do it...
|
||||||
|
|
||||||
if ( h == ocsp_extension )
|
if ( h == ocsp_extension )
|
||||||
mgr.Enqueue(h, GetFile()->ToVal(),
|
zeek::event_mgr.Enqueue(h, GetFile()->ToVal(),
|
||||||
std::move(pX509Ext),
|
std::move(pX509Ext),
|
||||||
zeek::val_mgr->Bool(global));
|
zeek::val_mgr->Bool(global));
|
||||||
else
|
else
|
||||||
mgr.Enqueue(h, GetFile()->ToVal(), std::move(pX509Ext));
|
zeek::event_mgr.Enqueue(h, GetFile()->ToVal(), std::move(pX509Ext));
|
||||||
|
|
||||||
// let individual analyzers parse more.
|
// let individual analyzers parse more.
|
||||||
ParseExtensionsSpecific(ex, global, ext_asn, oid);
|
ParseExtensionsSpecific(ex, global, ext_asn, oid);
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/asn1.h>
|
#include <openssl/asn1.h>
|
||||||
|
|
||||||
class EventHandlerPtr;
|
ZEEK_FORWARD_DECLARE_NAMESPACED(EventHandlerPtr, zeek);
|
||||||
|
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(Reporter, zeek);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(Reporter, zeek);
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(StringVal, zeek);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(StringVal, zeek);
|
||||||
|
|
||||||
|
@ -48,7 +47,7 @@ protected:
|
||||||
X509Common(const file_analysis::Tag& arg_tag,
|
X509Common(const file_analysis::Tag& arg_tag,
|
||||||
zeek::RecordValPtr arg_args, File* arg_file);
|
zeek::RecordValPtr arg_args, File* arg_file);
|
||||||
|
|
||||||
void ParseExtension(X509_EXTENSION* ex, const EventHandlerPtr& h, bool global);
|
void ParseExtension(X509_EXTENSION* ex, const zeek::EventHandlerPtr& h, bool global);
|
||||||
void ParseSignedCertificateTimestamps(X509_EXTENSION* ext);
|
void ParseSignedCertificateTimestamps(X509_EXTENSION* ext);
|
||||||
virtual void ParseExtensionsSpecific(X509_EXTENSION* ex, bool, ASN1_OBJECT*, const char*) = 0;
|
virtual void ParseExtensionsSpecific(X509_EXTENSION* ex, bool, ASN1_OBJECT*, const char*) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,7 +38,7 @@ refine connection MockConnection += {
|
||||||
if ( ! x509_ocsp_ext_signed_certificate_timestamp )
|
if ( ! x509_ocsp_ext_signed_certificate_timestamp )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
mgr.Enqueue(x509_ocsp_ext_signed_certificate_timestamp,
|
zeek::event_mgr.Enqueue(x509_ocsp_ext_signed_certificate_timestamp,
|
||||||
bro_analyzer()->GetFile()->ToVal(),
|
bro_analyzer()->GetFile()->ToVal(),
|
||||||
zeek::val_mgr->Count(version),
|
zeek::val_mgr->Count(version),
|
||||||
zeek::make_intrusive<zeek::StringVal>(logid.length(), reinterpret_cast<const char*>(logid.begin())),
|
zeek::make_intrusive<zeek::StringVal>(logid.length(), reinterpret_cast<const char*>(logid.begin())),
|
||||||
|
|
|
@ -54,9 +54,9 @@ void fuzzer_cleanup_one_input()
|
||||||
file_mgr->Terminate();
|
file_mgr->Terminate();
|
||||||
timer_mgr->Expire();
|
timer_mgr->Expire();
|
||||||
|
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
sessions->Drain();
|
sessions->Drain();
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
sessions->Clear();
|
sessions->Clear();
|
||||||
terminating = false;
|
terminating = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||||
}
|
}
|
||||||
|
|
||||||
chunk = {};
|
chunk = {};
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
}
|
}
|
||||||
|
|
||||||
zeek::detail::fuzzer_cleanup_one_input();
|
zeek::detail::fuzzer_cleanup_one_input();
|
||||||
|
|
|
@ -69,7 +69,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||||
}
|
}
|
||||||
|
|
||||||
chunk = {};
|
chunk = {};
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
}
|
}
|
||||||
|
|
||||||
zeek::detail::fuzzer_cleanup_one_input();
|
zeek::detail::fuzzer_cleanup_one_input();
|
||||||
|
|
|
@ -64,7 +64,7 @@ public:
|
||||||
zeek::EnumVal* type;
|
zeek::EnumVal* type;
|
||||||
ReaderFrontend* reader;
|
ReaderFrontend* reader;
|
||||||
zeek::TableVal* config;
|
zeek::TableVal* config;
|
||||||
EventHandlerPtr error_event;
|
zeek::EventHandlerPtr error_event;
|
||||||
|
|
||||||
zeek::RecordVal* description;
|
zeek::RecordVal* description;
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ public:
|
||||||
|
|
||||||
zeek::Func* pred;
|
zeek::Func* pred;
|
||||||
|
|
||||||
EventHandlerPtr event;
|
zeek::EventHandlerPtr event;
|
||||||
|
|
||||||
TableStream();
|
TableStream();
|
||||||
~TableStream() override;
|
~TableStream() override;
|
||||||
|
@ -112,7 +112,7 @@ public:
|
||||||
|
|
||||||
class Manager::EventStream final : public Manager::Stream {
|
class Manager::EventStream final : public Manager::Stream {
|
||||||
public:
|
public:
|
||||||
EventHandlerPtr event;
|
zeek::EventHandlerPtr event;
|
||||||
|
|
||||||
zeek::RecordType* fields;
|
zeek::RecordType* fields;
|
||||||
unsigned int num_fields;
|
unsigned int num_fields;
|
||||||
|
@ -185,7 +185,7 @@ Manager::AnalysisStream::~AnalysisStream()
|
||||||
Manager::Manager()
|
Manager::Manager()
|
||||||
: plugin::ComponentManager<input::Tag, input::Component>("Input", "Reader")
|
: plugin::ComponentManager<input::Tag, input::Component>("Input", "Reader")
|
||||||
{
|
{
|
||||||
end_of_data = event_registry->Register("Input::end_of_data");
|
end_of_data = zeek::event_registry->Register("Input::end_of_data");
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager::~Manager()
|
Manager::~Manager()
|
||||||
|
@ -441,8 +441,8 @@ bool Manager::CreateEventStream(zeek::RecordVal* fval)
|
||||||
|
|
||||||
stream->num_fields = fieldsV.size();
|
stream->num_fields = fieldsV.size();
|
||||||
stream->fields = fields->Ref()->AsRecordType();
|
stream->fields = fields->Ref()->AsRecordType();
|
||||||
stream->event = event_registry->Lookup(event->Name());
|
stream->event = zeek::event_registry->Lookup(event->Name());
|
||||||
stream->error_event = error_event ? event_registry->Lookup(error_event->Name()) : nullptr;
|
stream->error_event = error_event ? zeek::event_registry->Lookup(error_event->Name()) : nullptr;
|
||||||
stream->want_record = ( want_record->InternalInt() == 1 );
|
stream->want_record = ( want_record->InternalInt() == 1 );
|
||||||
|
|
||||||
assert(stream->reader);
|
assert(stream->reader);
|
||||||
|
@ -694,8 +694,8 @@ bool Manager::CreateTableStream(zeek::RecordVal* fval)
|
||||||
stream->tab = dst.release()->AsTableVal();
|
stream->tab = dst.release()->AsTableVal();
|
||||||
stream->rtype = val.release();
|
stream->rtype = val.release();
|
||||||
stream->itype = idx->Ref()->AsRecordType();
|
stream->itype = idx->Ref()->AsRecordType();
|
||||||
stream->event = event ? event_registry->Lookup(event->Name()) : nullptr;
|
stream->event = event ? zeek::event_registry->Lookup(event->Name()) : nullptr;
|
||||||
stream->error_event = error_event ? event_registry->Lookup(error_event->Name()) : nullptr;
|
stream->error_event = error_event ? zeek::event_registry->Lookup(error_event->Name()) : nullptr;
|
||||||
stream->currDict = new zeek::PDict<InputHash>;
|
stream->currDict = new zeek::PDict<InputHash>;
|
||||||
stream->currDict->SetDeleteFunc(input_hash_delete_func);
|
stream->currDict->SetDeleteFunc(input_hash_delete_func);
|
||||||
stream->lastDict = new zeek::PDict<InputHash>;
|
stream->lastDict = new zeek::PDict<InputHash>;
|
||||||
|
@ -1810,7 +1810,7 @@ bool Manager::CallPred(zeek::Func* pred_func, const int numvals, ...) const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::SendEvent(EventHandlerPtr ev, const int numvals, ...) const
|
void Manager::SendEvent(zeek::EventHandlerPtr ev, const int numvals, ...) const
|
||||||
{
|
{
|
||||||
zeek::Args vl;
|
zeek::Args vl;
|
||||||
vl.reserve(numvals);
|
vl.reserve(numvals);
|
||||||
|
@ -1828,10 +1828,10 @@ void Manager::SendEvent(EventHandlerPtr ev, const int numvals, ...) const
|
||||||
va_end(lP);
|
va_end(lP);
|
||||||
|
|
||||||
if ( ev )
|
if ( ev )
|
||||||
mgr.Enqueue(ev, std::move(vl), SOURCE_LOCAL);
|
zeek::event_mgr.Enqueue(ev, std::move(vl), SOURCE_LOCAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::SendEvent(EventHandlerPtr ev, list<zeek::Val*> events) const
|
void Manager::SendEvent(zeek::EventHandlerPtr ev, list<zeek::Val*> events) const
|
||||||
{
|
{
|
||||||
zeek::Args vl;
|
zeek::Args vl;
|
||||||
vl.reserve(events.size());
|
vl.reserve(events.size());
|
||||||
|
@ -1845,7 +1845,7 @@ void Manager::SendEvent(EventHandlerPtr ev, list<zeek::Val*> events) const
|
||||||
vl.emplace_back(zeek::AdoptRef{}, *i);
|
vl.emplace_back(zeek::AdoptRef{}, *i);
|
||||||
|
|
||||||
if ( ev )
|
if ( ev )
|
||||||
mgr.Enqueue(ev, std::move(vl), SOURCE_LOCAL);
|
zeek::event_mgr.Enqueue(ev, std::move(vl), SOURCE_LOCAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert a bro list value to a bro record value.
|
// Convert a bro list value to a bro record value.
|
||||||
|
|
|
@ -202,8 +202,8 @@ private:
|
||||||
bool UnrollRecordType(std::vector<threading::Field*> *fields, const zeek::RecordType *rec, const std::string& nameprepend, bool allow_file_func) const;
|
bool UnrollRecordType(std::vector<threading::Field*> *fields, const zeek::RecordType *rec, const std::string& nameprepend, bool allow_file_func) const;
|
||||||
|
|
||||||
// Send events
|
// Send events
|
||||||
void SendEvent(EventHandlerPtr ev, const int numvals, ...) const;
|
void SendEvent(zeek::EventHandlerPtr ev, const int numvals, ...) const;
|
||||||
void SendEvent(EventHandlerPtr ev, std::list<zeek::Val*> events) const;
|
void SendEvent(zeek::EventHandlerPtr ev, std::list<zeek::Val*> events) const;
|
||||||
|
|
||||||
// Implementation of SendEndOfData (send end_of_data event).
|
// Implementation of SendEndOfData (send end_of_data event).
|
||||||
void SendEndOfData(const Stream *i);
|
void SendEndOfData(const Stream *i);
|
||||||
|
@ -253,7 +253,7 @@ private:
|
||||||
|
|
||||||
std::map<ReaderFrontend*, Stream*> readers;
|
std::map<ReaderFrontend*, Stream*> readers;
|
||||||
|
|
||||||
EventHandlerPtr end_of_data;
|
zeek::EventHandlerPtr end_of_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ void PcapSource::Close()
|
||||||
Closed();
|
Closed();
|
||||||
|
|
||||||
if ( Pcap::file_done )
|
if ( Pcap::file_done )
|
||||||
mgr.Enqueue(Pcap::file_done, zeek::make_intrusive<zeek::StringVal>(props.path));
|
zeek::event_mgr.Enqueue(Pcap::file_done, zeek::make_intrusive<zeek::StringVal>(props.path));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PcapSource::OpenLive()
|
void PcapSource::OpenLive()
|
||||||
|
|
|
@ -79,7 +79,7 @@ struct Manager::Stream {
|
||||||
bool enabled;
|
bool enabled;
|
||||||
string name;
|
string name;
|
||||||
zeek::RecordType* columns;
|
zeek::RecordType* columns;
|
||||||
EventHandlerPtr event;
|
zeek::EventHandlerPtr event;
|
||||||
list<Filter*> filters;
|
list<Filter*> filters;
|
||||||
|
|
||||||
typedef pair<int, string> WriterPathPair;
|
typedef pair<int, string> WriterPathPair;
|
||||||
|
@ -314,7 +314,7 @@ bool Manager::CreateStream(zeek::EnumVal* id, zeek::RecordVal* sval)
|
||||||
streams[idx]->id = id->Ref()->AsEnumVal();
|
streams[idx]->id = id->Ref()->AsEnumVal();
|
||||||
streams[idx]->enabled = true;
|
streams[idx]->enabled = true;
|
||||||
streams[idx]->name = id->GetType()->AsEnumType()->Lookup(idx);
|
streams[idx]->name = id->GetType()->AsEnumType()->Lookup(idx);
|
||||||
streams[idx]->event = event ? event_registry->Lookup(event->Name()) : nullptr;
|
streams[idx]->event = event ? zeek::event_registry->Lookup(event->Name()) : nullptr;
|
||||||
streams[idx]->columns = columns->Ref()->AsRecordType();
|
streams[idx]->columns = columns->Ref()->AsRecordType();
|
||||||
|
|
||||||
streams[idx]->enable_remote = zeek::id::find_val("Log::enable_remote_logging")->AsBool();
|
streams[idx]->enable_remote = zeek::id::find_val("Log::enable_remote_logging")->AsBool();
|
||||||
|
@ -711,7 +711,7 @@ bool Manager::Write(zeek::EnumVal* id, zeek::RecordVal* columns_arg)
|
||||||
|
|
||||||
// Raise the log event.
|
// Raise the log event.
|
||||||
if ( stream->event )
|
if ( stream->event )
|
||||||
mgr.Enqueue(stream->event, columns);
|
zeek::event_mgr.Enqueue(stream->event, columns);
|
||||||
|
|
||||||
// Send to each of our filters.
|
// Send to each of our filters.
|
||||||
for ( list<Filter*>::iterator i = stream->filters.begin();
|
for ( list<Filter*>::iterator i = stream->filters.begin();
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
#define BRO_PLUGIN_BRO_VERSION BRO_VERSION_FUNCTION
|
#define BRO_PLUGIN_BRO_VERSION BRO_VERSION_FUNCTION
|
||||||
|
|
||||||
class ODesc;
|
class ODesc;
|
||||||
class Event;
|
|
||||||
|
|
||||||
|
ZEEK_FORWARD_DECLARE_NAMESPACED(Event, zeek);
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(Func, zeek);
|
||||||
ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail);
|
ZEEK_FORWARD_DECLARE_NAMESPACED(Frame, zeek::detail);
|
||||||
|
|
||||||
|
|
|
@ -193,8 +193,8 @@ function get_event_stats%(%): EventStats
|
||||||
auto r = zeek::make_intrusive<zeek::RecordVal>(EventStats);
|
auto r = zeek::make_intrusive<zeek::RecordVal>(EventStats);
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
r->Assign(n++, zeek::val_mgr->Count(num_events_queued));
|
r->Assign(n++, zeek::val_mgr->Count(event_mgr.num_events_queued));
|
||||||
r->Assign(n++, zeek::val_mgr->Count(num_events_dispatched));
|
r->Assign(n++, zeek::val_mgr->Count(event_mgr.num_events_dispatched));
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
%}
|
%}
|
||||||
|
|
|
@ -135,7 +135,7 @@ void Manager::StartHeartbeatTimer()
|
||||||
// one reporter message.
|
// one reporter message.
|
||||||
bool Manager::SendEvent(MsgThread* thread, const std::string& name, const int num_vals, Value* *vals) const
|
bool Manager::SendEvent(MsgThread* thread, const std::string& name, const int num_vals, Value* *vals) const
|
||||||
{
|
{
|
||||||
EventHandler* handler = event_registry->Lookup(name);
|
zeek::EventHandler* handler = zeek::event_registry->Lookup(name);
|
||||||
if ( handler == nullptr )
|
if ( handler == nullptr )
|
||||||
{
|
{
|
||||||
zeek::reporter->Warning("Thread %s: Event %s not found", thread->Name(), name.c_str());
|
zeek::reporter->Warning("Thread %s: Event %s not found", thread->Name(), name.c_str());
|
||||||
|
@ -179,7 +179,7 @@ bool Manager::SendEvent(MsgThread* thread, const std::string& name, const int nu
|
||||||
if ( convert_error )
|
if ( convert_error )
|
||||||
return false;
|
return false;
|
||||||
else if ( handler )
|
else if ( handler )
|
||||||
mgr.Enqueue(handler, std::move(vl), SOURCE_LOCAL);
|
zeek::event_mgr.Enqueue(handler, std::move(vl), SOURCE_LOCAL);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,8 @@ zeek::detail::trigger::Manager* trigger_mgr = nullptr;
|
||||||
|
|
||||||
std::vector<std::string> zeek_script_prefixes;
|
std::vector<std::string> zeek_script_prefixes;
|
||||||
zeek::detail::Stmt* stmts;
|
zeek::detail::Stmt* stmts;
|
||||||
EventRegistry* event_registry = nullptr;
|
zeek::EventRegistry* zeek::event_registry = nullptr;
|
||||||
|
zeek::EventRegistry*& event_registry = zeek::event_registry;
|
||||||
ProfileLogger* profiling_logger = nullptr;
|
ProfileLogger* profiling_logger = nullptr;
|
||||||
ProfileLogger* segment_logger = nullptr;
|
ProfileLogger* segment_logger = nullptr;
|
||||||
SampleLogger* sample_logger = nullptr;
|
SampleLogger* sample_logger = nullptr;
|
||||||
|
@ -228,11 +229,11 @@ void done_with_network()
|
||||||
|
|
||||||
if ( net_done )
|
if ( net_done )
|
||||||
{
|
{
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
// Don't propagate this event to remote clients.
|
// Don't propagate this event to remote clients.
|
||||||
mgr.Dispatch(new Event(net_done,
|
zeek::event_mgr.Dispatch(
|
||||||
{zeek::make_intrusive<zeek::TimeVal>(zeek::detail::timer_mgr->Time())}),
|
new zeek::Event(net_done, {zeek::make_intrusive<zeek::TimeVal>(zeek::detail::timer_mgr->Time())}),
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( profiling_logger )
|
if ( profiling_logger )
|
||||||
|
@ -243,8 +244,8 @@ void done_with_network()
|
||||||
zeek::analyzer_mgr->Done();
|
zeek::analyzer_mgr->Done();
|
||||||
zeek::detail::timer_mgr->Expire();
|
zeek::detail::timer_mgr->Expire();
|
||||||
zeek::detail::dns_mgr->Flush();
|
zeek::detail::dns_mgr->Flush();
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
|
|
||||||
net_finish(1);
|
net_finish(1);
|
||||||
|
|
||||||
|
@ -281,10 +282,10 @@ void terminate_bro()
|
||||||
zeek::detail::brofiler.WriteStats();
|
zeek::detail::brofiler.WriteStats();
|
||||||
|
|
||||||
if ( zeek_done )
|
if ( zeek_done )
|
||||||
mgr.Enqueue(zeek_done, zeek::Args{});
|
zeek::event_mgr.Enqueue(zeek_done, zeek::Args{});
|
||||||
|
|
||||||
zeek::detail::timer_mgr->Expire();
|
zeek::detail::timer_mgr->Expire();
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
|
|
||||||
if ( profiling_logger )
|
if ( profiling_logger )
|
||||||
{
|
{
|
||||||
|
@ -296,7 +297,7 @@ void terminate_bro()
|
||||||
delete profiling_logger;
|
delete profiling_logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
|
|
||||||
notifier::registry.Terminate();
|
notifier::registry.Terminate();
|
||||||
log_mgr->Terminate();
|
log_mgr->Terminate();
|
||||||
|
@ -305,7 +306,7 @@ void terminate_bro()
|
||||||
broker_mgr->Terminate();
|
broker_mgr->Terminate();
|
||||||
zeek::detail::dns_mgr->Terminate();
|
zeek::detail::dns_mgr->Terminate();
|
||||||
|
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
|
|
||||||
zeek::plugin_mgr->FinishPlugins();
|
zeek::plugin_mgr->FinishPlugins();
|
||||||
|
|
||||||
|
@ -314,7 +315,7 @@ void terminate_bro()
|
||||||
delete file_mgr;
|
delete file_mgr;
|
||||||
// broker_mgr, timer_mgr, and supervisor are deleted via iosource_mgr
|
// broker_mgr, timer_mgr, and supervisor are deleted via iosource_mgr
|
||||||
delete iosource_mgr;
|
delete iosource_mgr;
|
||||||
delete event_registry;
|
delete zeek::event_registry;
|
||||||
delete log_mgr;
|
delete log_mgr;
|
||||||
delete zeek::reporter;
|
delete zeek::reporter;
|
||||||
delete zeek::plugin_mgr;
|
delete zeek::plugin_mgr;
|
||||||
|
@ -658,7 +659,7 @@ zeek::detail::SetupResult zeek::detail::setup(int argc, char** argv,
|
||||||
zeekygen_mgr->InitPostScript();
|
zeekygen_mgr->InitPostScript();
|
||||||
broker_mgr->InitPostScript();
|
broker_mgr->InitPostScript();
|
||||||
zeek::detail::timer_mgr->InitPostScript();
|
zeek::detail::timer_mgr->InitPostScript();
|
||||||
mgr.InitPostScript();
|
zeek::event_mgr.InitPostScript();
|
||||||
|
|
||||||
if ( zeek::supervisor_mgr )
|
if ( zeek::supervisor_mgr )
|
||||||
zeek::supervisor_mgr->InitPostScript();
|
zeek::supervisor_mgr->InitPostScript();
|
||||||
|
@ -769,7 +770,7 @@ zeek::detail::SetupResult zeek::detail::setup(int argc, char** argv,
|
||||||
if ( ! zeek::detail::dns_mgr->Save() )
|
if ( ! zeek::detail::dns_mgr->Save() )
|
||||||
zeek::reporter->FatalError("can't update DNS cache");
|
zeek::reporter->FatalError("can't update DNS cache");
|
||||||
|
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
delete zeek::detail::dns_mgr;
|
delete zeek::detail::dns_mgr;
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
@ -806,7 +807,7 @@ zeek::detail::SetupResult zeek::detail::setup(int argc, char** argv,
|
||||||
net_update_time(current_time());
|
net_update_time(current_time());
|
||||||
|
|
||||||
if ( zeek_init )
|
if ( zeek_init )
|
||||||
mgr.Enqueue(zeek_init, zeek::Args{});
|
zeek::event_mgr.Enqueue(zeek_init, zeek::Args{});
|
||||||
|
|
||||||
EventRegistry::string_list dead_handlers =
|
EventRegistry::string_list dead_handlers =
|
||||||
event_registry->UnusedHandlers();
|
event_registry->UnusedHandlers();
|
||||||
|
@ -853,16 +854,16 @@ zeek::detail::SetupResult zeek::detail::setup(int argc, char** argv,
|
||||||
if ( i->skipped )
|
if ( i->skipped )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mgr.Enqueue(zeek_script_loaded,
|
zeek::event_mgr.Enqueue(zeek_script_loaded,
|
||||||
zeek::make_intrusive<zeek::StringVal>(i->name.c_str()),
|
zeek::make_intrusive<zeek::StringVal>(i->name.c_str()),
|
||||||
zeek::val_mgr->Count(i->include_level));
|
zeek::val_mgr->Count(i->include_level));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
zeek::reporter->ReportViaEvents(true);
|
zeek::reporter->ReportViaEvents(true);
|
||||||
|
|
||||||
// Drain the event queue here to support the protocols framework configuring DPM
|
// Drain the event queue here to support the protocols framework configuring DPM
|
||||||
mgr.Drain();
|
zeek::event_mgr.Drain();
|
||||||
|
|
||||||
if ( zeek::reporter->Errors() > 0 && ! zeekenv("ZEEK_ALLOW_INIT_ERRORS") )
|
if ( zeek::reporter->Errors() > 0 && ! zeekenv("ZEEK_ALLOW_INIT_ERRORS") )
|
||||||
zeek::reporter->FatalError("errors occurred while initializing");
|
zeek::reporter->FatalError("errors occurred while initializing");
|
||||||
|
|
|
@ -1792,7 +1792,7 @@ function log10%(d: double%): double
|
||||||
## none.
|
## none.
|
||||||
function current_analyzer%(%) : count
|
function current_analyzer%(%) : count
|
||||||
%{
|
%{
|
||||||
return zeek::val_mgr->Count(mgr.CurrentAnalyzer());
|
return zeek::val_mgr->Count(zeek::event_mgr.CurrentAnalyzer());
|
||||||
%}
|
%}
|
||||||
|
|
||||||
## Returns Zeek's process ID.
|
## Returns Zeek's process ID.
|
||||||
|
@ -4997,7 +4997,7 @@ function uninstall_dst_net_filter%(snet: subnet%) : bool
|
||||||
## Returns: True if the last raised event came from a remote peer.
|
## Returns: True if the last raised event came from a remote peer.
|
||||||
function is_remote_event%(%) : bool
|
function is_remote_event%(%) : bool
|
||||||
%{
|
%{
|
||||||
return zeek::val_mgr->Bool(mgr.CurrentSource() != SOURCE_LOCAL);
|
return zeek::val_mgr->Bool(zeek::event_mgr.CurrentSource() != SOURCE_LOCAL);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
## Stops Zeek's packet processing. This function is used to synchronize
|
## Stops Zeek's packet processing. This function is used to synchronize
|
||||||
|
|
|
@ -25,4 +25,3 @@ bool Foo::DeliverStream(const u_char* data, uint64 len)
|
||||||
mgr.QueueEvent(foo_piece, args);
|
mgr.QueueEvent(foo_piece, args);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue