forked from zeek/zeek
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
broker: Add shim plugin adding a backend component
For broker, this isn't really functioning, but at least makes the CLUSTER_BACKEND_BROKER enum available.
- Loading branch information
Showing
4 changed files
with
51 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "zeek/broker/Plugin.h" | ||
|
||
#include <memory> | ||
|
||
#include "zeek/cluster/Backend.h" | ||
#include "zeek/cluster/Component.h" | ||
#include "zeek/cluster/Serializer.h" | ||
|
||
using namespace zeek::plugin::Zeek_Cluster_Backend_Broker; | ||
|
||
zeek::plugin::Configuration Plugin::Configure() { | ||
// For now, there's always the broker_mgr instance that's explicitly | ||
// instantiated in zeek-setup.cc. Don't even allow to instantiate | ||
// a second one via the plugin mechanism. In the future, this could | ||
// be changed so that broker is instantiated on demand only. | ||
auto fail_instantiate = [](std::unique_ptr<cluster::EventSerializer>, | ||
std::unique_ptr<cluster::LogSerializer>) -> std::unique_ptr<cluster::Backend> { | ||
zeek::reporter->FatalError("do not instantiate broker explicitly"); | ||
return nullptr; | ||
}; | ||
|
||
AddComponent(new cluster::BackendComponent("BROKER", fail_instantiate)); | ||
|
||
zeek::plugin::Configuration config; | ||
config.name = "Zeek::Cluster_Backend_Broker"; | ||
config.description = "Cluster backend using Broker"; | ||
return config; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// See the file "COPYING" in the main distribution directory for copyright. | ||
|
||
#pragma once | ||
|
||
#include "zeek/plugin/Plugin.h" | ||
|
||
namespace zeek::plugin::Zeek_Cluster_Backend_Broker { | ||
|
||
class Plugin : public zeek::plugin::Plugin { | ||
public: | ||
zeek::plugin::Configuration Configure() override; | ||
} plugin; | ||
|
||
} // namespace zeek::plugin::Zeek_Cluster_Backend_Broker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters