16 bool launch_transport)
44 "UdpRegistryClient::setup:"
45 " adding server %s:%d to registry lookup list\n",
60 const char* print_prefix =
"UdpRegistryClient::register";
89 " Sending register of size %d to %s:%d\n",
90 print_prefix, (
int)result, server.address().to_string().c_str(),
101 " Sent register of size %d to %s\n",
102 print_prefix, (
int)actual_sent,
103 server.address().to_string().c_str(), server.port());
113 " ERROR: no servers available for sending. Failed to register.\n");
124 std::vector<std::string>
hosts;
128 for (
auto& host :
hosts)
131 auto addr = ip::address::from_string(addr_parts.first);
132 addresses_.emplace_back(addr, addr_parts.second);
135 "UdpRegistryClient::send_data:"
137 addresses_.back().address().to_string().c_str(),
#define madara_logger_log(loggering, level,...)
Fast version of the madara::logger::log method.
This class stores variables and their values for use by any entity needing state information in a thr...
logger::Logger & get_logger(void) const
Gets the logger used for information printing.
uint64_t get_clock(void) const
Atomically gets the Lamport clock.
void set_name(const std::string &var_name, KnowledgeBase &knowledge, bool sync=true)
Sets the variable name that this refers to.
std::vector< std::string > sync_keys(void)
Syncs the keys from the knowledge base.
void keys(std::vector< std::string > &curkeys) const
Returns the keys within the map.
void add(uint64_t size)
Adds a message to the monitor.
int validate_transport(void)
Validates a transport to indicate it is not shutting down.
madara::utility::ScopedArray< char > buffer_
buffer for sending
QoSTransportSettings settings_
madara::knowledge::ThreadSafeContext & context_
BandwidthMonitor send_monitor_
monitor for sending bandwidth usage
std::vector< udp::endpoint > addresses_
holds all multicast addresses we are sending to
knowledge::KnowledgeBase knowledge_
knowledge base for threads to use
int setup() override
all subclasses should call this method at the end of its setup
Holds basic transport settings.
uint32_t queue_length
Length of the buffer used to store history of events.
std::string write_domain
All class members are accessible to users for easy setup.
bool no_sending
if true, never send over transport
int setup(void) override
all subclasses should call this method at the end of its setup
std::vector< udp::endpoint > servers_
registry servers
long send_data(const madara::knowledge::KnowledgeMap &updates) override
Sends a list of knowledge updates to listeners.
knowledge::containers::Map endpoints_
UdpRegistryClient(const std::string &id, madara::knowledge::ThreadSafeContext &context, TransportSettings &config, bool launch_transport)
Constructor.
void send_register(void)
Sends register messages to all servers.
UDP-based transport for knowledge.
long send_data(const madara::knowledge::KnowledgeMap &updates) override
Sends a list of knowledge updates to listeners.
long send_buffer(const udp::endpoint &target, const char *buf, size_t size)
Sends a buffer to a host endpoint.
T * get_ptr(void)
get the underlying pointer
::std::map< std::string, KnowledgeRecord > KnowledgeMap
MADARA_EXPORT void strncpy_safe(char *dst, const char *src, size_t dst_size)
Performs a strncpy in a way that will compile without warnings.
std::pair< std::string, uint16_t > parse_address(std::string addr)
Copyright(c) 2020 Galois.