22 #include "gossip_thread.h"
24 #include <plugins/gossip/gossip/gossip_group_manager.h>
30 #define CFG_PREFIX "/gossip/"
54 std::map<std::string, GossipGroupConfiguration> groups;
55 std::set<std::string> ignored_groups;
57 std::string prefix = CFG_PREFIX
"groups/";
59 std::shared_ptr<Configuration::ValueIterator> i(
config->
search(prefix.c_str()));
61 std::string cfg_name = std::string(i->
path()).substr(prefix.length());
62 cfg_name = cfg_name.substr(0, cfg_name.find(
"/"));
64 if ((groups.find(cfg_name) == groups.end())
65 && (ignored_groups.find(cfg_name) == ignored_groups.end())) {
66 std::string cfg_prefix = prefix + cfg_name +
"/";
76 std::string addr =
config->
get_string((cfg_prefix +
"broadcast-address").c_str());
78 if (
config->
exists((cfg_prefix +
"broadcast-send-port").c_str())
79 &&
config->
exists((cfg_prefix +
"broadcast-recv-port").c_str())) {
80 unsigned int send_port =
config->
get_uint((cfg_prefix +
"broadcast-send-port").c_str());
81 unsigned int recv_port =
config->
get_uint((cfg_prefix +
"broadcast-recv-port").c_str());
83 if (send_port > 0xFFFF) {
84 throw Exception(
"Port number too high: %u > %u", send_port, 0xFFFF);
86 if (recv_port > 0xFFFF) {
87 throw Exception(
"Port number too high: %u > %u", recv_port, 0xFFFF);
92 unsigned int port =
config->
get_uint((cfg_prefix +
"broadcast-port").c_str());
95 throw Exception(
"Port number too high: %u > %u", port, 0xFFFF);
102 groups[cfg_name].crypto_key =
105 groups[cfg_name].crypto_cipher =
109 groups[cfg_name].crypto_cipher =
"aes-128-ecb";
112 "Setup encryption of type %s for group '%s'",
113 groups[cfg_name].crypto_cipher.c_str(),
120 ignored_groups.insert(cfg_name);
128 group_mgr_ = std::shared_ptr<GossipGroupManager>(
130 gossip_aspect_inifin_.
set_manager(group_mgr_.get());