29 const boost::property_tree::ptree &cfg,
44 for (
auto &&itr :
config_.get_child(
"module_config"))
47 std::vector<std::string> auth_sources;
48 std::vector<std::string> connects;
49 std::vector<std::string> binds;
51 for (
auto &&srcs : itr.second.get_child(
"sources"))
54 auto name = srcs.second.get<std::string>(
"");
55 auth_sources.push_back(name);
58 if (itr.second.get_child_optional(
"connect"))
60 for (
auto &&srcs : itr.second.get_child(
"connect"))
62 xmlnne_(
"endpoint", srcs.first);
63 auto name = srcs.second.get<std::string>(
"");
64 connects.push_back(name);
68 if (itr.second.get_child_optional(
"bind"))
70 for (
auto &&srcs : itr.second.get_child(
"bind"))
72 xmlnne_(
"endpoint", srcs.first);
73 auto name = srcs.second.get<std::string>(
"");
74 binds.push_back(name);
78 if (!(connects.empty() || binds.empty()))
80 ERROR(
"Bind or connect. Not both !");
85 int protocol_id = extractor.
get<
int>(
"protocol");
90 ERROR(
"Cannot instanciate a protocol number " << protocol_id);
93 auto ni = std::make_unique<NotifierInstance>(
94 ctx_,
reactor_, auth_sources, connects, binds, std::move(protocol));
Tools::XmlNodeNameEnforcer xmlnne_
std::vector< NotifierInstanceUPtr > instances_
This is the header file for a generated source file, GitSHA1.cpp.
void process_config()
Process the configuration file.
TCPNotifierModule(zmqpp::context &ctx, zmqpp::socket *pipe, const boost::property_tree::ptree &cfg, CoreUtilsPtr utils)
All modules that provides features to Leosac shall be in this namespace.
Base class for module implementation.
zmqpp::context & ctx_
A reference to the ZeroMQ context in case you need it to create additional socket.
zmqpp::reactor reactor_
The reactor object we poll() on in the main loop.
std::shared_ptr< CoreUtils > CoreUtilsPtr
boost::property_tree::ptree config_
The configuration tree passed to the start_module function.
static ProtocolHandlerUPtr create(int protocol_id)
Create an instance of a protocol handler depending on the requested protocol id.