MADARA
3.1.8
|
Base class from which all transports must be derived. More...
#include <Transport.h>
Public Types | |
typedef std::vector< std::string > | HostsVector |
Used to define a vector of hosts to contact. More... | |
Public Member Functions | |
Base (const std::string &id, TransportSettings &new_settings, knowledge::ThreadSafeContext &context) | |
Constructor. More... | |
virtual | ~Base () |
Destructor. More... | |
int | check_transport (void) |
all subclasses should call this method at the beginning of send_data More... | |
virtual void | close (void) |
Closes this transport. More... | |
void | invalidate_transport (void) |
Invalidates a transport to indicate it is shutting down. More... | |
long | prep_send (const madara::knowledge::KnowledgeRecords &orig_updates, const char *print_prefix) |
Preps a message for sending. More... | |
virtual long | send_data (const madara::knowledge::KnowledgeRecords &)=0 |
Sends a list of updates to the domain. More... | |
TransportSettings & | settings (void) |
Getter for the transport settings. More... | |
virtual int | setup (void) |
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... | |
Protected Attributes | |
madara::utility::ScopedArray< char > | buffer_ |
buffer for sending More... | |
madara::knowledge::ThreadSafeContext & | context_ |
HostsVector | hosts |
const std::string | id_ |
host:port identifier of this process More... | |
volatile bool | is_valid_ |
ACE_Thread_Mutex | mutex_ |
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... | |
BandwidthMonitor | receive_monitor_ |
monitor for receiving bandwidth usage More... | |
BandwidthMonitor | send_monitor_ |
monitor for sending bandwidth usage More... | |
QoSTransportSettings | settings_ |
volatile bool | shutting_down_ |
Condition | valid_setup_ |
Base class from which all transports must be derived.
To support knowledge updates, only the send_multiassignment method is currently required to be extended as the set, evaluate, and wait methods all call send_multiassignment. For example transport,
Definition at line 62 of file Transport.h.
typedef std::vector<std::string> madara::transport::Base::HostsVector |
Used to define a vector of hosts to contact.
Definition at line 68 of file Transport.h.
madara::transport::Base::Base | ( | const std::string & | id, |
TransportSettings & | new_settings, | ||
knowledge::ThreadSafeContext & | context | ||
) |
Constructor.
id | unique identifier (generally host:port) |
new_settings | settings to apply to the transport |
context | the knowledge record context |
Definition at line 9 of file Transport.cpp.
|
virtual |
Destructor.
Definition at line 28 of file Transport.cpp.
|
inline |
all subclasses should call this method at the beginning of send_data
Definition at line 19 of file Transport.inl.
|
virtual |
Closes this transport.
Reimplemented in madara::transport::UdpRegistryClient, madara::transport::SpliceDDSTransport, madara::transport::UdpTransport, madara::transport::UdpRegistryServer, madara::transport::ZMQTransport, madara::transport::MulticastTransport, madara::transport::BroadcastTransport, madara::transport::TcpTransport, and madara::transport::NddsTransport.
Definition at line 106 of file Transport.cpp.
|
inline |
Invalidates a transport to indicate it is shutting down.
Definition at line 34 of file Transport.inl.
long madara::transport::Base::prep_send | ( | const madara::knowledge::KnowledgeRecords & | orig_updates, |
const char * | print_prefix | ||
) |
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 815 of file Transport.cpp.
|
pure virtual |
Sends a list of updates to the domain.
This function must be implemented by your transport
Implemented in madara::transport::UdpRegistryClient, madara::transport::UdpTransport, madara::transport::ZMQTransport, madara::transport::MulticastTransport, madara::transport::BroadcastTransport, madara::transport::UdpRegistryServer, madara::transport::SpliceDDSTransport, madara::transport::TcpTransport, and madara::transport::NddsTransport.
|
inline |
Getter for the transport settings.
Definition at line 45 of file Transport.inl.
|
virtual |
all subclasses should call this method at the end of its setup
Reimplemented in madara::transport::SpliceDDSTransport, madara::transport::UdpRegistryClient, madara::transport::ZMQTransport, madara::transport::MulticastTransport, madara::transport::BroadcastTransport, madara::transport::UdpTransport, madara::transport::UdpRegistryServer, madara::transport::NddsTransport, and madara::transport::TcpTransport.
Definition at line 33 of file Transport.cpp.
|
inline |
Validates a transport to indicate it is not shutting down.
Definition at line 6 of file Transport.inl.
|
protected |
buffer for sending
Definition at line 209 of file Transport.h.
|
protected |
Definition at line 191 of file Transport.h.
|
protected |
Definition at line 181 of file Transport.h.
|
protected |
host:port identifier of this process
Definition at line 186 of file Transport.h.
|
protected |
Definition at line 179 of file Transport.h.
|
protected |
Definition at line 182 of file Transport.h.
|
protected |
data received rules, defined in Transport settings
Definition at line 195 of file Transport.h.
|
protected |
scheduler for dropping packets to simulate network issues
Definition at line 206 of file Transport.h.
|
protected |
monitor for receiving bandwidth usage
Definition at line 203 of file Transport.h.
|
protected |
monitor for sending bandwidth usage
Definition at line 200 of file Transport.h.
|
protected |
Definition at line 188 of file Transport.h.
|
protected |
Definition at line 180 of file Transport.h.
|
protected |
Definition at line 183 of file Transport.h.