mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 02:58:20 +00:00
Add Broker::forward() function
This enables explicit forwarding of events matching a given topic prefix. Even if a receiving node has an event handler, it will not be raised if the event was sent along a topic that matches a previous call to Broker::forward().
This commit is contained in:
parent
850030822d
commit
1dcead93bf
10 changed files with 214 additions and 15 deletions
|
@ -224,10 +224,21 @@ public:
|
|||
*/
|
||||
bool Subscribe(const std::string& topic_prefix);
|
||||
|
||||
/**
|
||||
* Register interest in peer event messages that use a certain topic prefix,
|
||||
* but that should not be raised locally, just forwarded to any subscribing
|
||||
* peers.
|
||||
* @param topic_prefix a prefix to match against remote message topics.
|
||||
* e.g. an empty prefix will match everything and "a" will match "alice"
|
||||
* and "amy" but not "bob".
|
||||
* @return true if it's a new event forward/subscription and it is now registered.
|
||||
*/
|
||||
bool Forward(std::string topic_prefix);
|
||||
|
||||
/**
|
||||
* Unregister interest in peer event messages.
|
||||
* @param topic_prefix a prefix previously supplied to a successful call
|
||||
* to bro_broker::Manager::Subscribe().
|
||||
* to bro_broker::Manager::Subscribe() or bro_broker::Manager::Forward().
|
||||
* @return true if interest in topic prefix is no longer advertised.
|
||||
*/
|
||||
bool Unsubscribe(const std::string& topic_prefix);
|
||||
|
@ -311,9 +322,8 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
void DispatchMessage(broker::data msg);
|
||||
void ProcessEvent(std::string name, broker::vector args);
|
||||
void ProcessEvent(broker::bro::Event ev);
|
||||
void DispatchMessage(const broker::topic& topic, broker::data msg);
|
||||
void ProcessEvent(const broker::topic& topic, broker::bro::Event ev);
|
||||
bool ProcessLogCreate(broker::bro::LogCreate lc);
|
||||
bool ProcessLogWrite(broker::bro::LogWrite lw);
|
||||
bool ProcessIdentifierUpdate(broker::bro::IdentifierUpdate iu);
|
||||
|
@ -364,6 +374,7 @@ private:
|
|||
std::unordered_map<std::string, StoreHandleVal*> data_stores;
|
||||
std::unordered_map<query_id, StoreQueryCallback*,
|
||||
query_id_hasher> pending_queries;
|
||||
std::vector<std::string> forwarded_prefixes;
|
||||
|
||||
Stats statistics;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue