MADARA
3.4.1
|
Multicast-based transport for knowledge. More...
#include <MulticastTransport.h>
Public Types | |
typedef std::vector< std::string > | HostsVector |
Used to define a vector of hosts to contact. More... | |
Public Member Functions | |
MulticastTransport (const std::string &id, madara::knowledge::ThreadSafeContext &context, TransportSettings &config, bool launch_transport) | |
Constructor. More... | |
int | check_transport (void) |
all subclasses should call this method at the beginning of send_data More... | |
void | close () override |
Closes this transport. More... | |
const std::vector< udp::endpoint > & | get_udp_endpoints (void) |
void | invalidate_transport (void) |
Invalidates a transport to indicate it is shutting down. More... | |
long | prep_send (const knowledge::KnowledgeMap &orig_updates, const char *print_prefix) |
Preps a message for sending. More... | |
long | receive_buffer (char *buf, size_t &bytes_read, udp::endpoint &remote) |
Receives a buffer from a remote host. More... | |
int | reliability (const int &setting) |
Sets the reliability setting. More... | |
int | reliability (void) const |
Accesses reliability setting. More... | |
long | send_buffer (const udp::endpoint &target, const char *buf, size_t size) |
Sends a buffer to a host endpoint. More... | |
long | send_data (const madara::knowledge::KnowledgeMap &updates) override |
Sends a list of knowledge updates to listeners. More... | |
TransportSettings & | settings (void) |
Getter for the transport settings. More... | |
int | setup () override |
all subclasses should call this method at the end of its setup More... | |
int | validate_transport (void) |
Validates a transport to indicate it is not shutting down. More... | |
Public Attributes | |
knowledge::containers::Integer | failed_sends |
failed sends More... | |
knowledge::containers::Integer | sent_data |
sent data More... | |
knowledge::containers::Integer | sent_data_max |
max data sent More... | |
knowledge::containers::Integer | sent_data_min |
min data sent More... | |
knowledge::containers::Integer | sent_packets |
sent packets More... | |
Static Public Attributes | |
static const double | default_read_hertz |
Protected Member Functions | |
bool | pre_send_buffer (size_t addr_index) override |
long | send_message (const char *buf, size_t size, uint64_t clock) |
int | setup_read_socket () override |
int | setup_read_thread (double hertz, const std::string &name) override |
virtual int | setup_read_threads () |
virtual int | setup_socket (udp::socket &socket) |
virtual int | setup_sockets () |
int | setup_write_socket () override |
Protected Attributes | |
std::vector< udp::endpoint > | addresses_ |
holds all multicast addresses we are sending to More... | |
madara::utility::ScopedArray< char > | buffer_ |
buffer for sending More... | |
madara::knowledge::ThreadSafeContext & | context_ |
utility::EpochEnforcer< utility::Clock > | enforcer_ |
enforces epochs when user specifies a max_send_hertz More... | |
HostsVector | hosts |
const std::string | id_ |
host:port identifier of this process More... | |
asio::io_service | io_service_ |
Boost::ASIO IO context. More... | |
volatile bool | is_valid_ |
knowledge::KnowledgeBase | knowledge_ |
knowledge base for threads to use More... | |
uint64_t | last_toi_sent_ = 0 |
Latest TOI the previous send operation included. More... | |
madara::expression::ExpressionTree | on_data_received_ |
data received rules, defined in Transport settings More... | |
PacketScheduler | packet_scheduler_ |
scheduler for dropping packets to simulate network issues More... | |
threads::Threader | read_threads_ |
threads for reading knowledge updates More... | |
BandwidthMonitor | receive_monitor_ |
monitor for receiving bandwidth usage More... | |
BandwidthMonitor | send_monitor_ |
monitor for sending bandwidth usage More... | |
QoSTransportSettings | settings_ |
volatile bool | shutting_down_ |
udp::socket | socket_ {io_service_} |
underlying socket More... | |
Multicast-based transport for knowledge.
This transport currently supports the following transport settings:
1) a single host:port pairing
2) the reduced message header
3) the normal message header
4) domain differentiation
5) on data received logic
6) multi-assignment of records
7) rebroadcasting
Definition at line 47 of file MulticastTransport.h.
|
inherited |
Used to define a vector of hosts to contact.
Definition at line 51 of file Transport.h.
madara::transport::MulticastTransport::MulticastTransport | ( | const std::string & | id, |
madara::knowledge::ThreadSafeContext & | context, | ||
TransportSettings & | config, | ||
bool | launch_transport | ||
) |
Constructor.
id | unique identifer - usually a combination of host:port |
context | knowledge context |
config | transport configuration settings |
launch_transport | whether or not to launch this transport |
Definition at line 21 of file MulticastTransport.cpp.
|
inlineinherited |
all subclasses should call this method at the beginning of send_data
Definition at line 17 of file Transport.inl.
|
overridevirtualinherited |
Closes this transport.
Reimplemented from madara::transport::Base.
Definition at line 38 of file BasicASIOTransport.cpp.
|
inlineinherited |
Definition at line 39 of file BasicASIOTransport.h.
|
inlineinherited |
Invalidates a transport to indicate it is shutting down.
Definition at line 31 of file Transport.inl.
|
inlineoverrideprotectedvirtual |
Reimplemented from madara::transport::UdpTransport.
Definition at line 66 of file MulticastTransport.h.
|
inherited |
Preps a message for sending.
orig_updates | updates before send filtering is applied |
print_prefix | prefix to include before every log message, e.g., "MyTransport::svc" |
filter the updates according to the filters specified by the user in QoSTransportSettings (if applicable)
size = buffer[0] (unsigned 64 bit) transport id = buffer[8] (8 byte) domain = buffer[16] (32 byte domain name) originator = buffer[48] (64 byte originator host:port) type = buffer[112] (unsigned 32 bit type of message–usually MULTIASSIGN) updates = buffer[116] (unsigned 32 bit number of updates) quality = buffer[120] (unsigned 32 bit quality of message) clock = buffer[124] (unsigned 64 bit clock for this message) ttl = buffer[132] (the new knowledge starts here) knowledge = buffer[133] (the new knowledge starts here)
Definition at line 860 of file Transport.cpp.
|
inherited |
Receives a buffer from a remote host.
buf | buffer to fill with data |
bytes_read | number of bytes read |
remote | remote endpoint that sent message |
Definition at line 101 of file UdpTransport.cpp.
|
inherited |
Sets the reliability setting.
Definition at line 42 of file UdpTransport.cpp.
|
inherited |
Accesses reliability setting.
Definition at line 37 of file UdpTransport.cpp.
|
inherited |
Sends a buffer to a host endpoint.
buf | buffer to send |
size | number of bytes to send |
target | remote endpoint to send to |
Definition at line 130 of file UdpTransport.cpp.
|
overridevirtualinherited |
Sends a list of knowledge updates to listeners.
updates | listing of all updates that must be sent |
Implements madara::transport::Base.
Definition at line 292 of file UdpTransport.cpp.
|
protectedinherited |
Definition at line 202 of file UdpTransport.cpp.
|
inlineinherited |
Getter for the transport settings.
Definition at line 40 of file Transport.inl.
|
overridevirtualinherited |
all subclasses should call this method at the end of its setup
Reimplemented from madara::transport::Base.
Reimplemented in madara::transport::UdpRegistryServer, and madara::transport::UdpRegistryClient.
Definition at line 49 of file BasicASIOTransport.cpp.
|
overrideprotectedvirtual |
Reimplemented from madara::transport::BasicASIOTransport.
Definition at line 37 of file MulticastTransport.cpp.
|
overrideprotectedvirtual |
Implements madara::transport::BasicASIOTransport.
Definition at line 30 of file MulticastTransport.cpp.
|
protectedvirtualinherited |
Definition at line 233 of file BasicASIOTransport.cpp.
|
protectedvirtualinherited |
Definition at line 134 of file BasicASIOTransport.cpp.
|
protectedvirtualinherited |
Definition at line 217 of file BasicASIOTransport.cpp.
|
overrideprotectedvirtual |
Reimplemented from madara::transport::BasicASIOTransport.
Definition at line 78 of file MulticastTransport.cpp.
|
inlineinherited |
Validates a transport to indicate it is not shutting down.
Definition at line 6 of file Transport.inl.
|
protectedinherited |
holds all multicast addresses we are sending to
Definition at line 63 of file BasicASIOTransport.h.
|
protectedinherited |
buffer for sending
Definition at line 153 of file Transport.h.
|
protectedinherited |
Definition at line 135 of file Transport.h.
|
staticinherited |
Definition at line 37 of file BasicASIOTransport.h.
|
protectedinherited |
enforces epochs when user specifies a max_send_hertz
Definition at line 112 of file UdpTransport.h.
|
inherited |
failed sends
Definition at line 69 of file UdpTransport.h.
|
protectedinherited |
Definition at line 127 of file Transport.h.
|
protectedinherited |
host:port identifier of this process
Definition at line 130 of file Transport.h.
|
protectedinherited |
Boost::ASIO IO context.
Definition at line 57 of file BasicASIOTransport.h.
|
protectedinherited |
Definition at line 125 of file Transport.h.
|
protectedinherited |
knowledge base for threads to use
Definition at line 54 of file BasicASIOTransport.h.
|
protectedinherited |
Latest TOI the previous send operation included.
Definition at line 156 of file Transport.h.
|
protectedinherited |
data received rules, defined in Transport settings
Definition at line 139 of file Transport.h.
|
protectedinherited |
scheduler for dropping packets to simulate network issues
Definition at line 150 of file Transport.h.
|
protectedinherited |
threads for reading knowledge updates
Definition at line 60 of file BasicASIOTransport.h.
|
protectedinherited |
monitor for receiving bandwidth usage
Definition at line 147 of file Transport.h.
|
protectedinherited |
monitor for sending bandwidth usage
Definition at line 144 of file Transport.h.
|
inherited |
sent data
Definition at line 72 of file UdpTransport.h.
|
inherited |
max data sent
Definition at line 75 of file UdpTransport.h.
|
inherited |
min data sent
Definition at line 78 of file UdpTransport.h.
|
inherited |
sent packets
Definition at line 66 of file UdpTransport.h.
|
protectedinherited |
Definition at line 132 of file Transport.h.
|
protectedinherited |
Definition at line 126 of file Transport.h.
|
protectedinherited |
underlying socket
Definition at line 66 of file BasicASIOTransport.h.