MADARA  3.1.8
madara::transport::TransportContext Class Reference

Provides context about the transport. More...

#include <TransportContext.h>

Collaboration diagram for madara::transport::TransportContext:

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::KnowledgeMapget_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...
 

Detailed Description

Provides context about the transport.

Definition at line 19 of file TransportContext.h.

Member Enumeration Documentation

Enumerator
IDLE_OPERATION 
SENDING_OPERATION 
RECEIVING_OPERATION 
REBROADCASTING_OPERATION 

Definition at line 23 of file TransportContext.h.

Constructor & Destructor Documentation

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.

Parameters
rhsthe 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.

Member Function Documentation

void madara::transport::TransportContext::add_record ( const std::string &  key,
const madara::knowledge::KnowledgeRecord record 
)
inline

Adds a record to the list that should be appended to send or rebroadcast.

Parameters
keykey of the record to add
recordrecord to add to the append list

Definition at line 78 of file TransportContext.inl.

void madara::transport::TransportContext::clear_records ( void  )
inline

Clears records added through filtering operations.

Definition at line 7 of file TransportContext.inl.

uint64_t madara::transport::TransportContext::get_current_time ( void  ) const
inline

Gets the current timestamp.

Returns
current time in seconds

Definition at line 31 of file TransportContext.inl.

const std::string & madara::transport::TransportContext::get_domain ( void  ) const
inline

Returns the network domain.

Returns
the current knowledge domain

Definition at line 99 of file TransportContext.inl.

const std::string & madara::transport::TransportContext::get_endpoint ( void  ) const
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.

Returns
endpoint the public host:port information for the sender

Definition at line 125 of file TransportContext.inl.

uint64_t madara::transport::TransportContext::get_message_time ( void  ) const
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.

Returns
timestamp of message

Definition at line 37 of file TransportContext.inl.

int64_t madara::transport::TransportContext::get_operation ( void  ) const
inline

Get operation that the context is performing.

Returns
operation being performed. See enums in this class.

Definition at line 13 of file TransportContext.inl.

const std::string & madara::transport::TransportContext::get_originator ( void  ) const
inline

Returns the current message originator.

Returns
the originator of current message

Definition at line 112 of file TransportContext.inl.

uint64_t madara::transport::TransportContext::get_receive_bandwidth ( void  ) const
inline

Gets the receive bandwidth in bytes per second.

Returns
the bandwidth taken up in receive operations

Definition at line 19 of file TransportContext.inl.

const madara::knowledge::KnowledgeMap & madara::transport::TransportContext::get_records ( void  ) const
inline

Returns the additional records stored in the context.

Returns
records to add to context

Definition at line 86 of file TransportContext.inl.

uint64_t madara::transport::TransportContext::get_send_bandwidth ( void  ) const
inline

Gets the send/rebroadcast bandwidth in bytes per second.

Returns
the bandwidth taken up in send/rebroadcast operations

Definition at line 25 of file TransportContext.inl.

void madara::transport::TransportContext::operator= ( const TransportContext rhs)

Assignment operator.

Parameters
rhsthe value to be copied into this class

Definition at line 41 of file TransportContext.cpp.

void madara::transport::TransportContext::set_current_time ( uint64_t  current_time)
inline

Sets the current time.

This should be time (NULL).

Parameters
current_timethe current time in seconds

Definition at line 64 of file TransportContext.inl.

void madara::transport::TransportContext::set_domain ( const std::string &  domain)
inline

Sets the network domain.

Parameters
domainthe knowledge domain

Definition at line 92 of file TransportContext.inl.

void madara::transport::TransportContext::set_endpoint ( const std::string &  endpoint)
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.

Parameters
endpointthe public host:port information for the sender

Definition at line 118 of file TransportContext.inl.

void madara::transport::TransportContext::set_message_time ( uint64_t  message_time)
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.

Parameters
message_timethe message time in seconds

Definition at line 71 of file TransportContext.inl.

void madara::transport::TransportContext::set_operation ( int64_t  operation)
inline

Sets the operation that the context is/should be performing.

Parameters
operationoperation the context is undertaking

Definition at line 43 of file TransportContext.inl.

void madara::transport::TransportContext::set_originator ( const std::string &  originator)
inline

Sets the current message originator.

Parameters
originatorthe originator of the current message

Definition at line 105 of file TransportContext.inl.

void madara::transport::TransportContext::set_receive_bandwidth ( uint64_t  bandwidth)
inline

Sets the bandwidth used for receives in bytes per second.

Parameters
bandwidthbandwidth being used by the transport

Definition at line 50 of file TransportContext.inl.

void madara::transport::TransportContext::set_records ( const knowledge::KnowledgeMap source)
inline

Sets the current message originator.

Parameters
sourcethe source record map to set

Definition at line 131 of file TransportContext.inl.

void madara::transport::TransportContext::set_send_bandwidth ( uint64_t  bandwidth)
inline

Sets the bandwidth used for sends/rebroadcast in bytes per second.

Parameters
bandwidthbandwidth being used by the transport

Definition at line 57 of file TransportContext.inl.

Member Data Documentation

uint64_t madara::transport::TransportContext::current_time_
private

Current timestamp.

Definition at line 218 of file TransportContext.h.

std::string madara::transport::TransportContext::domain_
private

Networking domain.

Definition at line 223 of file TransportContext.h.

std::string madara::transport::TransportContext::endpoint_
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.

uint64_t madara::transport::TransportContext::message_time_
private

Message timestamp.

Definition at line 213 of file TransportContext.h.

int64_t madara::transport::TransportContext::operation_
private

Operation being performed.

Definition at line 198 of file TransportContext.h.

std::string madara::transport::TransportContext::originator_
private

Originator of the current message.

Definition at line 228 of file TransportContext.h.

uint64_t madara::transport::TransportContext::receive_bandwidth_
private

Bandwidth being utilized for receive operations.

Definition at line 203 of file TransportContext.h.

knowledge::KnowledgeMap madara::transport::TransportContext::records_
private

Context specific records.

Definition at line 243 of file TransportContext.h.

uint64_t madara::transport::TransportContext::send_bandwidth_
private

Bandwidth being utilized for send operations.

Definition at line 208 of file TransportContext.h.


The documentation for this class was generated from the following files: