MADARA
3.1.8
|
UDP-based transport for knowledge. More...
#include <UdpRegistryClient.h>
Public Types | |
enum | { RELIABLE = 0 } |
enum | { ERROR_UDP_NOT_STARTED = -1 } |
typedef std::vector< std::string > | HostsVector |
Used to define a vector of hosts to contact. More... | |
Public Member Functions | |
UdpRegistryClient (const std::string &id, madara::knowledge::ThreadSafeContext &context, TransportSettings &config, bool launch_transport) | |
Constructor. More... | |
virtual | ~UdpRegistryClient () |
Destructor. More... | |
int | check_transport (void) |
all subclasses should call this method at the beginning of send_data More... | |
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... | |
long | read (void) |
int | reliability (void) const |
Accesses reliability setting. More... | |
int | reliability (const int &setting) |
Accesses reliability setting. More... | |
long | send_data (const madara::knowledge::KnowledgeRecords &updates) |
Sends a list of knowledge updates to listeners. More... | |
void | send_register (void) |
Sends register messages to all servers. More... | |
TransportSettings & | settings (void) |
Getter for the transport settings. More... | |
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... | |
Static Public Attributes | |
static const int | PROFILES = 1 |
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_ |
Private Attributes | |
std::map< std::string, ACE_INET_Addr > | clients_ |
registry clients More... | |
knowledge::containers::Map | endpoints_ |
knowledge::KnowledgeBase | knowledge_ |
knowledge base for threads to use More... | |
threads::Threader | read_threads_ |
threads for reading knowledge updates More... | |
std::map< std::string, ACE_INET_Addr > | servers_ |
registry servers More... | |
ACE_SOCK_Dgram | socket_ |
underlying socket for sending and receiving More... | |
UDP-based transport for knowledge.
This transport currently supports the following transport settings:
1) multiple host:port pairing with self first in vector
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 35 of file UdpRegistryClient.h.
|
inherited |
Used to define a vector of hosts to contact.
Definition at line 68 of file Transport.h.
anonymous enum |
Enumerator | |
---|---|
RELIABLE |
Definition at line 39 of file UdpRegistryClient.h.
anonymous enum |
Enumerator | |
---|---|
ERROR_UDP_NOT_STARTED |
Definition at line 43 of file UdpRegistryClient.h.
madara::transport::UdpRegistryClient::UdpRegistryClient | ( | 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 14 of file UdpRegistryClient.cpp.
|
virtual |
Destructor.
Definition at line 31 of file UdpRegistryClient.cpp.
|
inlineinherited |
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 from madara::transport::Base.
Definition at line 37 of file UdpRegistryClient.cpp.
|
inlineinherited |
Invalidates a transport to indicate it is shutting down.
Definition at line 34 of file Transport.inl.
|
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 815 of file Transport.cpp.
long madara::transport::UdpRegistryClient::read | ( | void | ) |
int madara::transport::UdpRegistryClient::reliability | ( | void | ) | const |
Accesses reliability setting.
If this returns zero, it doesn't make much sense.
Definition at line 55 of file UdpRegistryClient.cpp.
int madara::transport::UdpRegistryClient::reliability | ( | const int & | setting | ) |
Accesses reliability setting.
If this returns zero, it doesn't make much sense.
Definition at line 61 of file UdpRegistryClient.cpp.
|
virtual |
Sends a list of knowledge updates to listeners.
updates | listing of all updates that must be sent |
Implements madara::transport::Base.
Definition at line 310 of file UdpRegistryClient.cpp.
void madara::transport::UdpRegistryClient::send_register | ( | void | ) |
Sends register messages to all servers.
Definition at line 190 of file UdpRegistryClient.cpp.
|
inlineinherited |
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 from madara::transport::Base.
Definition at line 67 of file UdpRegistryClient.cpp.
|
inlineinherited |
Validates a transport to indicate it is not shutting down.
Definition at line 6 of file Transport.inl.
|
protectedinherited |
buffer for sending
Definition at line 209 of file Transport.h.
|
private |
registry clients
Definition at line 106 of file UdpRegistryClient.h.
|
protectedinherited |
Definition at line 191 of file Transport.h.
|
private |
Definition at line 108 of file UdpRegistryClient.h.
|
protectedinherited |
Definition at line 181 of file Transport.h.
|
protectedinherited |
host:port identifier of this process
Definition at line 186 of file Transport.h.
|
protectedinherited |
Definition at line 179 of file Transport.h.
|
private |
knowledge base for threads to use
Definition at line 97 of file UdpRegistryClient.h.
|
protectedinherited |
Definition at line 182 of file Transport.h.
|
protectedinherited |
data received rules, defined in Transport settings
Definition at line 195 of file Transport.h.
|
protectedinherited |
scheduler for dropping packets to simulate network issues
Definition at line 206 of file Transport.h.
|
static |
Definition at line 47 of file UdpRegistryClient.h.
|
private |
threads for reading knowledge updates
Definition at line 100 of file UdpRegistryClient.h.
|
protectedinherited |
monitor for receiving bandwidth usage
Definition at line 203 of file Transport.h.
|
protectedinherited |
monitor for sending bandwidth usage
Definition at line 200 of file Transport.h.
|
private |
registry servers
Definition at line 103 of file UdpRegistryClient.h.
|
protectedinherited |
Definition at line 188 of file Transport.h.
|
protectedinherited |
Definition at line 180 of file Transport.h.
|
private |
underlying socket for sending and receiving
Definition at line 111 of file UdpRegistryClient.h.
|
protectedinherited |
Definition at line 183 of file Transport.h.