MADARA
3.1.8
|
Provides context about the transport. More...
#include <TransportContext.h>
Public Types | |
enum | Operations { IDLE_OPERATION = 0, SENDING_OPERATION = 1, RECEIVING_OPERATION = 2, REBROADCASTING_OPERATION = 3 } |
Public Member Functions | |
TransportContext (int64_t operation=IDLE_OPERATION, uint64_t receive_bandwidth=0, uint64_t send_bandwidth=0, uint64_t message_time=0, uint64_t current_time=time(NULL), const std::string &domain="", const std::string &originator="", const std::string &endpoint="") | |
Constructor. More... | |
TransportContext (const TransportContext &rhs) | |
Copy constructor. More... | |
~TransportContext () | |
Destructor. More... | |
void | add_record (const std::string &key, const madara::knowledge::KnowledgeRecord &record) |
Adds a record to the list that should be appended to send or rebroadcast. More... | |
void | clear_records (void) |
Clears records added through filtering operations. More... | |
uint64_t | get_current_time (void) const |
Gets the current timestamp. More... | |
const std::string & | get_domain (void) const |
Returns the network domain. More... | |
const std::string & | get_endpoint (void) const |
Returns the current message endpoint. More... | |
uint64_t | get_message_time (void) const |
Gets the message timestamp. More... | |
int64_t | get_operation (void) const |
Get operation that the context is performing. More... | |
const std::string & | get_originator (void) const |
Returns the current message originator. More... | |
uint64_t | get_receive_bandwidth (void) const |
Gets the receive bandwidth in bytes per second. More... | |
const knowledge::KnowledgeMap & | get_records (void) const |
Returns the additional records stored in the context. More... | |
uint64_t | get_send_bandwidth (void) const |
Gets the send/rebroadcast bandwidth in bytes per second. More... | |
void | operator= (const TransportContext &rhs) |
Assignment operator. More... | |
void | set_current_time (uint64_t current_time) |
Sets the current time. More... | |
void | set_domain (const std::string &domain) |
Sets the network domain. More... | |
void | set_endpoint (const std::string &endpoint) |
Sets the current message endpoint. More... | |
void | set_message_time (uint64_t message_time) |
Sets the message time. More... | |
void | set_operation (int64_t operation) |
Sets the operation that the context is/should be performing. More... | |
void | set_originator (const std::string &originator) |
Sets the current message originator. More... | |
void | set_receive_bandwidth (uint64_t bandwidth) |
Sets the bandwidth used for receives in bytes per second. More... | |
void | set_records (const knowledge::KnowledgeMap &source) |
Sets the current message originator. More... | |
void | set_send_bandwidth (uint64_t bandwidth) |
Sets the bandwidth used for sends/rebroadcast in bytes per second. More... | |
Private Attributes | |
uint64_t | current_time_ |
Current timestamp. More... | |
std::string | domain_ |
Networking domain. More... | |
std::string | endpoint_ |
Public endpoint of the current message. More... | |
uint64_t | message_time_ |
Message timestamp. More... | |
int64_t | operation_ |
Operation being performed. More... | |
std::string | originator_ |
Originator of the current message. More... | |
uint64_t | receive_bandwidth_ |
Bandwidth being utilized for receive operations. More... | |
knowledge::KnowledgeMap | records_ |
Context specific records. More... | |
uint64_t | send_bandwidth_ |
Bandwidth being utilized for send operations. More... | |
Provides context about the transport.
Definition at line 19 of file TransportContext.h.
Enumerator | |
---|---|
IDLE_OPERATION | |
SENDING_OPERATION | |
RECEIVING_OPERATION | |
REBROADCASTING_OPERATION |
Definition at line 23 of file TransportContext.h.
madara::transport::TransportContext::TransportContext | ( | int64_t | operation = IDLE_OPERATION , |
uint64_t | receive_bandwidth = 0 , |
||
uint64_t | send_bandwidth = 0 , |
||
uint64_t | message_time = 0 , |
||
uint64_t | current_time = time (NULL) , |
||
const std::string & | domain = "" , |
||
const std::string & | originator = "" , |
||
const std::string & | endpoint = "" |
||
) |
Constructor.
Definition at line 5 of file TransportContext.cpp.
madara::transport::TransportContext::TransportContext | ( | const TransportContext & | rhs | ) |
Copy constructor.
rhs | the value to be copied into this class |
Definition at line 22 of file TransportContext.cpp.
madara::transport::TransportContext::~TransportContext | ( | ) |
Destructor.
Definition at line 36 of file TransportContext.cpp.
|
inline |
Adds a record to the list that should be appended to send or rebroadcast.
key | key of the record to add |
record | record to add to the append list |
Definition at line 78 of file TransportContext.inl.
|
inline |
Clears records added through filtering operations.
Definition at line 7 of file TransportContext.inl.
|
inline |
Gets the current timestamp.
Definition at line 31 of file TransportContext.inl.
|
inline |
Returns the network domain.
Definition at line 99 of file TransportContext.inl.
|
inline |
Returns the current message endpoint.
Endpoint is the public host:port information about how to actually contact the sender, whereas originator is the declared identifier of the sender.
Definition at line 125 of file TransportContext.inl.
|
inline |
Gets the message timestamp.
For receive and rebroadcast operations, this timestamp will be the time that the message was originally sent. For send operations, this timestamp is typically the same as the current timestamp.
Definition at line 37 of file TransportContext.inl.
|
inline |
Get operation that the context is performing.
Definition at line 13 of file TransportContext.inl.
|
inline |
Returns the current message originator.
Definition at line 112 of file TransportContext.inl.
|
inline |
Gets the receive bandwidth in bytes per second.
Definition at line 19 of file TransportContext.inl.
|
inline |
Returns the additional records stored in the context.
Definition at line 86 of file TransportContext.inl.
|
inline |
Gets the send/rebroadcast bandwidth in bytes per second.
Definition at line 25 of file TransportContext.inl.
void madara::transport::TransportContext::operator= | ( | const TransportContext & | rhs | ) |
Assignment operator.
rhs | the value to be copied into this class |
Definition at line 41 of file TransportContext.cpp.
|
inline |
Sets the current time.
This should be time (NULL).
current_time | the current time in seconds |
Definition at line 64 of file TransportContext.inl.
|
inline |
Sets the network domain.
domain | the knowledge domain |
Definition at line 92 of file TransportContext.inl.
|
inline |
Sets the current message endpoint.
Endpoint is the public host:port information about how to actually contact the sender, whereas originator is the declared identifier of the sender.
endpoint | the public host:port information for the sender |
Definition at line 118 of file TransportContext.inl.
|
inline |
Sets the message time.
For receive and rebroadcast operations, this timestamp will be the time that the message was originally sent. For send operations, this timestamp is typically the same as the current timestamp.
message_time | the message time in seconds |
Definition at line 71 of file TransportContext.inl.
|
inline |
Sets the operation that the context is/should be performing.
operation | operation the context is undertaking |
Definition at line 43 of file TransportContext.inl.
|
inline |
Sets the current message originator.
originator | the originator of the current message |
Definition at line 105 of file TransportContext.inl.
|
inline |
Sets the bandwidth used for receives in bytes per second.
bandwidth | bandwidth being used by the transport |
Definition at line 50 of file TransportContext.inl.
|
inline |
Sets the current message originator.
source | the source record map to set |
Definition at line 131 of file TransportContext.inl.
|
inline |
Sets the bandwidth used for sends/rebroadcast in bytes per second.
bandwidth | bandwidth being used by the transport |
Definition at line 57 of file TransportContext.inl.
|
private |
Current timestamp.
Definition at line 218 of file TransportContext.h.
|
private |
Networking domain.
Definition at line 223 of file TransportContext.h.
|
private |
Public endpoint of the current message.
This may be different from originator as originator is the declared id of the agent sending. Endpoint is the public ip:port information that the underlying socket is claiming the message comes from. This is an important distinction in NAT-based networking.
Definition at line 238 of file TransportContext.h.
|
private |
Message timestamp.
Definition at line 213 of file TransportContext.h.
|
private |
Operation being performed.
Definition at line 198 of file TransportContext.h.
|
private |
Originator of the current message.
Definition at line 228 of file TransportContext.h.
|
private |
Bandwidth being utilized for receive operations.
Definition at line 203 of file TransportContext.h.
|
private |
Context specific records.
Definition at line 243 of file TransportContext.h.
|
private |
Bandwidth being utilized for send operations.
Definition at line 208 of file TransportContext.h.