mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Reformat the world
This commit is contained in:
parent
194cb24547
commit
b2f171ec69
714 changed files with 35149 additions and 35203 deletions
52
src/Event.h
52
src/Event.h
|
@ -5,30 +5,32 @@
|
|||
#include <tuple>
|
||||
#include <type_traits>
|
||||
|
||||
#include "zeek/Flare.h"
|
||||
#include "zeek/IntrusivePtr.h"
|
||||
#include "zeek/ZeekArgs.h"
|
||||
#include "zeek/ZeekList.h"
|
||||
#include "zeek/analyzer/Analyzer.h"
|
||||
#include "zeek/iosource/IOSource.h"
|
||||
#include "zeek/Flare.h"
|
||||
#include "zeek/ZeekArgs.h"
|
||||
#include "zeek/IntrusivePtr.h"
|
||||
|
||||
namespace zeek {
|
||||
namespace zeek
|
||||
{
|
||||
|
||||
class EventMgr;
|
||||
|
||||
class Event final : public Obj {
|
||||
class Event final : public Obj
|
||||
{
|
||||
public:
|
||||
Event(EventHandlerPtr handler, zeek::Args args,
|
||||
util::detail::SourceID src = util::detail::SOURCE_LOCAL, analyzer::ID aid = 0,
|
||||
Obj* obj = nullptr);
|
||||
|
||||
void SetNext(Event* n) { next_event = n; }
|
||||
Event* NextEvent() const { return next_event; }
|
||||
void SetNext(Event* n) { next_event = n; }
|
||||
Event* NextEvent() const { return next_event; }
|
||||
|
||||
util::detail::SourceID Source() const { return src; }
|
||||
analyzer::ID Analyzer() const { return aid; }
|
||||
EventHandlerPtr Handler() const { return handler; }
|
||||
const zeek::Args& Args() const { return args; }
|
||||
util::detail::SourceID Source() const { return src; }
|
||||
analyzer::ID Analyzer() const { return aid; }
|
||||
EventHandlerPtr Handler() const { return handler; }
|
||||
const zeek::Args& Args() const { return args; }
|
||||
|
||||
void Describe(ODesc* d) const override;
|
||||
|
||||
|
@ -45,9 +47,10 @@ protected:
|
|||
analyzer::ID aid;
|
||||
Obj* obj;
|
||||
Event* next_event;
|
||||
};
|
||||
};
|
||||
|
||||
class EventMgr final : public Obj, public iosource::IOSource {
|
||||
class EventMgr final : public Obj, public iosource::IOSource
|
||||
{
|
||||
public:
|
||||
EventMgr();
|
||||
~EventMgr() override;
|
||||
|
@ -72,28 +75,27 @@ public:
|
|||
* A version of Enqueue() taking a variable number of arguments.
|
||||
*/
|
||||
template <class... Args>
|
||||
std::enable_if_t<
|
||||
std::is_convertible_v<
|
||||
std::tuple_element_t<0, std::tuple<Args...>>, ValPtr>>
|
||||
std::enable_if_t<std::is_convertible_v<std::tuple_element_t<0, std::tuple<Args...>>, ValPtr>>
|
||||
Enqueue(const EventHandlerPtr& h, Args&&... args)
|
||||
{ return Enqueue(h, zeek::Args{std::forward<Args>(args)...}); }
|
||||
{
|
||||
return Enqueue(h, zeek::Args{std::forward<Args>(args)...});
|
||||
}
|
||||
|
||||
void Dispatch(Event* event, bool no_remote = false);
|
||||
|
||||
void Drain();
|
||||
bool IsDraining() const { return draining; }
|
||||
bool IsDraining() const { return draining; }
|
||||
|
||||
bool HasEvents() const { return head != nullptr; }
|
||||
bool HasEvents() const { return head != nullptr; }
|
||||
|
||||
// Returns the source ID of last raised event.
|
||||
util::detail::SourceID CurrentSource() const { return current_src; }
|
||||
util::detail::SourceID CurrentSource() const { return current_src; }
|
||||
|
||||
// Returns the ID of the analyzer which raised the last event, or 0 if
|
||||
// non-analyzer event.
|
||||
analyzer::ID CurrentAnalyzer() const { return current_aid; }
|
||||
analyzer::ID CurrentAnalyzer() const { return current_aid; }
|
||||
|
||||
int Size() const
|
||||
{ return num_events_queued - num_events_dispatched; }
|
||||
int Size() const { return num_events_queued - num_events_dispatched; }
|
||||
|
||||
void Describe(ODesc* d) const override;
|
||||
|
||||
|
@ -115,8 +117,8 @@ protected:
|
|||
RecordVal* src_val;
|
||||
bool draining;
|
||||
detail::Flare queue_flare;
|
||||
};
|
||||
};
|
||||
|
||||
extern EventMgr event_mgr;
|
||||
|
||||
} // namespace zeek
|
||||
} // namespace zeek
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue