23 #include <plugins/gossip/gossip/gossip_group.h> 25 #include <netcomm/service_discovery/service.h> 26 #include <netcomm/service_discovery/service_publisher.h> 28 #include <protobuf_comm/peer.h> 30 #define GOSSIP_MDNSSD_SERVICE_NAME "_gossip._udp" 53 GossipGroup::GossipGroup(std::string &group_name, std::string &peer_name,
54 std::string &broadcast_address,
unsigned short broadcast_port,
55 ServicePublisher *service_publisher,
56 const std::string &crypto_key,
const std::string &crypto_cipher)
57 : name_(group_name), service_publisher_(service_publisher)
60 std::shared_ptr<protobuf_comm::ProtobufBroadcastPeer>(
62 crypto_key, crypto_cipher));
65 std::shared_ptr<NetworkService>(
new NetworkService(peer_name.c_str(),
66 GOSSIP_MDNSSD_SERVICE_NAME,
69 service_->add_txt(
"group=%s", group_name.c_str());
70 service_publisher_->publish_service(service_.get());
83 GossipGroup::GossipGroup(std::string &group_name, std::string &peer_name,
84 std::string &broadcast_address,
85 unsigned short send_port,
unsigned short recv_port,
86 ServicePublisher *service_publisher,
87 const std::string &crypto_key,
const std::string &crypto_cipher)
88 : name_(group_name), service_publisher_(service_publisher)
91 std::shared_ptr<protobuf_comm::ProtobufBroadcastPeer>(
93 crypto_key, crypto_cipher));
96 std::shared_ptr<NetworkService>(
new NetworkService(peer_name.c_str(),
97 GOSSIP_MDNSSD_SERVICE_NAME,
100 service_->add_txt(
"group=%s", group_name.c_str());
101 service_publisher_->publish_service(service_.get());
106 GossipGroup::~GossipGroup()
108 service_publisher_->unpublish_service(service_.get());
119 GossipGroup::send(std::string &peer,
120 google::protobuf::Message &m)
130 GossipGroup::broadcast(google::protobuf::Message &m)
Fawkes library namespace.
Communicate by broadcasting protobuf messages.