#include <TcpInst.h>
Inheritance diagram for OpenDDS::DCPS::TcpInst:
Public Member Functions | |
virtual int | load (ACE_Configuration_Heap &cf, ACE_Configuration_Section_Key §) |
virtual OPENDDS_STRING | dump_to_str () |
Diagnostic aid. | |
bool | is_reliable () const |
Does the transport as configured support RELIABLE_RELIABILITY_QOS? | |
const std::string & | get_public_address () const |
virtual size_t | populate_locator (OpenDDS::DCPS::TransportLocator &trans_info) const |
Populate a transport locator sequence. Return the number of "locators.". | |
OPENDDS_STRING | local_address_string () const |
ACE_INET_Addr | local_address () const |
void | local_address (const char *str) |
void | local_address (u_short port_number, const char *host_name) |
void | local_address_set_port (u_short port_number) |
Public Attributes | |
std::string | pub_address_str_ |
bool | enable_nagle_algorithm_ |
int | conn_retry_initial_delay_ |
double | conn_retry_backoff_multiplier_ |
int | conn_retry_attempts_ |
int | max_output_pause_period_ |
int | passive_reconnect_duration_ |
Private Member Functions | |
TcpInst (const OPENDDS_STRING &name) | |
virtual | ~TcpInst () |
TcpTransport * | new_impl (const TransportInst_rch &inst) |
Private Attributes | |
ACE_INET_Addr | local_address_ |
std::string | local_address_str_ |
Friends | |
class | TcpType |
class | TcpTransport |
class | ::DDS_TEST |
Definition at line 27 of file TcpInst.h.
ACE_INLINE OpenDDS::DCPS::TcpInst::TcpInst | ( | const OPENDDS_STRING & | name | ) | [explicit, private] |
Definition at line 11 of file TcpInst.inl.
References DBG_ENTRY_LVL.
00012 : TransportInst("tcp", name), 00013 enable_nagle_algorithm_(false), 00014 conn_retry_initial_delay_(500), 00015 conn_retry_backoff_multiplier_(2.0), 00016 conn_retry_attempts_(3), 00017 max_output_pause_period_(-1), 00018 passive_reconnect_duration_(2000) 00019 { 00020 DBG_ENTRY_LVL("TcpInst", "TcpInst", 6); 00021 }
OpenDDS::DCPS::TcpInst::~TcpInst | ( | ) | [private, virtual] |
Definition at line 22 of file TcpInst.cpp.
References DBG_ENTRY_LVL.
00023 { 00024 DBG_ENTRY_LVL("TcpInst","~TcpInst",6); 00025 }
OPENDDS_STRING OpenDDS::DCPS::TcpInst::dump_to_str | ( | ) | [virtual] |
Diagnostic aid.
Reimplemented from OpenDDS::DCPS::TransportInst.
Definition at line 70 of file TcpInst.cpp.
References conn_retry_attempts_, conn_retry_backoff_multiplier_, conn_retry_initial_delay_, OpenDDS::DCPS::TransportInst::dump_to_str(), enable_nagle_algorithm_, OpenDDS::DCPS::TransportInst::formatNameForDump(), local_address_string(), max_output_pause_period_, OPENDDS_STRING, passive_reconnect_duration_, and pub_address_str_.
00071 { 00072 std::ostringstream os; 00073 os << TransportInst::dump_to_str() << std::endl; 00074 00075 os << formatNameForDump("local_address") << this->local_address_string() << std::endl; 00076 os << formatNameForDump("pub_address") << this->pub_address_str_ << std::endl; 00077 os << formatNameForDump("enable_nagle_algorithm") << (this->enable_nagle_algorithm_ ? "true" : "false") << std::endl; 00078 os << formatNameForDump("conn_retry_initial_delay") << this->conn_retry_initial_delay_ << std::endl; 00079 os << formatNameForDump("conn_retry_backoff_multiplier") << this->conn_retry_backoff_multiplier_ << std::endl; 00080 os << formatNameForDump("conn_retry_attempts") << this->conn_retry_attempts_ << std::endl; 00081 os << formatNameForDump("passive_reconnect_duration") << this->passive_reconnect_duration_ << std::endl; 00082 os << formatNameForDump("max_output_pause_period") << this->max_output_pause_period_ << std::endl; 00083 return OPENDDS_STRING(os.str()); 00084 }
const std::string& OpenDDS::DCPS::TcpInst::get_public_address | ( | ) | const [inline] |
The public address is our publicly advertised address. Usually this is the same as the local address, but if a public address is explicitly specified, use that.
Definition at line 84 of file TcpInst.h.
00084 { 00085 return (pub_address_str_ == "") ? local_address_str_ : pub_address_str_; 00086 }
bool OpenDDS::DCPS::TcpInst::is_reliable | ( | ) | const [inline, virtual] |
Does the transport as configured support RELIABLE_RELIABILITY_QOS?
Implements OpenDDS::DCPS::TransportInst.
Definition at line 79 of file TcpInst.h.
int OpenDDS::DCPS::TcpInst::load | ( | ACE_Configuration_Heap & | cf, | |
ACE_Configuration_Section_Key & | sect | |||
) | [virtual] |
Overwrite the default configurations with the configuration from the given section in the ACE_Configuration_Heap object.
Reimplemented from OpenDDS::DCPS::TransportInst.
Definition at line 34 of file TcpInst.cpp.
References GET_CONFIG_DOUBLE_VALUE, GET_CONFIG_STRING_VALUE, GET_CONFIG_VALUE, load, local_address(), and pub_address_str_.
00036 { 00037 TransportInst::load(cf, trans_sect); 00038 00039 std::string local_address; 00040 GET_CONFIG_STRING_VALUE(cf, trans_sect, ACE_TEXT("local_address"), local_address); 00041 00042 if (local_address != "") { 00043 this->local_address(local_address.c_str()); 00044 } 00045 00046 GET_CONFIG_STRING_VALUE(cf, trans_sect, ACE_TEXT("pub_address"), pub_address_str_); 00047 00048 GET_CONFIG_VALUE(cf, trans_sect, ACE_TEXT("enable_nagle_algorithm"), 00049 this->enable_nagle_algorithm_, bool) 00050 00051 GET_CONFIG_VALUE(cf, trans_sect, ACE_TEXT("conn_retry_initial_delay"), 00052 this->conn_retry_initial_delay_, int) 00053 00054 GET_CONFIG_DOUBLE_VALUE(cf, trans_sect, ACE_TEXT("conn_retry_backoff_multiplier"), 00055 this->conn_retry_backoff_multiplier_) 00056 00057 GET_CONFIG_VALUE(cf, trans_sect, ACE_TEXT("conn_retry_attempts"), 00058 this->conn_retry_attempts_, int) 00059 00060 GET_CONFIG_VALUE(cf, trans_sect, ACE_TEXT("passive_reconnect_duration"), 00061 this->passive_reconnect_duration_, int) 00062 00063 GET_CONFIG_VALUE(cf, trans_sect, ACE_TEXT("max_output_pause_period"), 00064 this->max_output_pause_period_, int) 00065 00066 return 0; 00067 }
void OpenDDS::DCPS::TcpInst::local_address | ( | u_short | port_number, | |
const char * | host_name | |||
) | [inline] |
Definition at line 97 of file TcpInst.h.
References OpenDDS::DCPS::to_dds_string().
00098 { 00099 local_address_str_ = host_name; 00100 local_address_str_ += ":" + to_dds_string(port_number); 00101 local_address_.set(port_number, host_name); 00102 }
void OpenDDS::DCPS::TcpInst::local_address | ( | const char * | str | ) | [inline] |
Definition at line 92 of file TcpInst.h.
00093 { 00094 local_address_str_ = str; 00095 local_address_.set(str); 00096 }
ACE_INET_Addr OpenDDS::DCPS::TcpInst::local_address | ( | ) | const [inline] |
Definition at line 91 of file TcpInst.h.
Referenced by OpenDDS::DCPS::TcpTransport::configure_i(), and load().
00091 { return local_address_; }
void OpenDDS::DCPS::TcpInst::local_address_set_port | ( | u_short | port_number | ) | [inline] |
Definition at line 103 of file TcpInst.h.
References OPENDDS_STRING, and OpenDDS::DCPS::to_dds_string().
00103 { 00104 local_address_.set_port_number(port_number); 00105 size_t pos = local_address_str_.find_last_of(":"); 00106 OPENDDS_STRING host_name = local_address_str_.substr(0, pos); 00107 local_address_str_ = host_name + ":" + to_dds_string(port_number); 00108 }
OPENDDS_STRING OpenDDS::DCPS::TcpInst::local_address_string | ( | ) | const [inline] |
Definition at line 90 of file TcpInst.h.
Referenced by dump_to_str().
00090 { return local_address_str_; }
OpenDDS::DCPS::TcpTransport * OpenDDS::DCPS::TcpInst::new_impl | ( | const TransportInst_rch & | inst | ) | [private] |
Definition at line 28 of file TcpInst.cpp.
References TcpTransport.
00029 { 00030 return new TcpTransport(inst); 00031 }
size_t OpenDDS::DCPS::TcpInst::populate_locator | ( | OpenDDS::DCPS::TransportLocator & | trans_info | ) | const [virtual] |
Populate a transport locator sequence. Return the number of "locators.".
Implements OpenDDS::DCPS::TransportInst.
Definition at line 87 of file TcpInst.cpp.
References OpenDDS::DCPS::TransportLocator::data, pub_address_str_, and OpenDDS::DCPS::TransportLocator::transport_type.
00088 { 00089 if (this->local_address() != ACE_INET_Addr() || !pub_address_str_.empty()) { 00090 // Get the public address string from the inst (usually the local address) 00091 NetworkAddress network_order_address(this->get_public_address()); 00092 00093 ACE_OutputCDR cdr; 00094 cdr << network_order_address; 00095 const CORBA::ULong len = static_cast<CORBA::ULong>(cdr.total_length()); 00096 char* buffer = const_cast<char*>(cdr.buffer()); // safe 00097 00098 local_info.transport_type = "tcp"; 00099 local_info.data = TransportBLOB(len, len, 00100 reinterpret_cast<CORBA::Octet*>(buffer)); 00101 return 1; 00102 } else { 00103 return 0; 00104 } 00105 }
friend class TcpTransport [friend] |
Number of attemps to reconnect before giving up and calling on_publication_lost() and on_subscription_lost() callbacks. The default is 3.
Definition at line 62 of file TcpInst.h.
Referenced by dump_to_str().
The backoff multiplier for reconnection strategy. The third and so on reconnect will be this value * the previous delay. Hence with conn_retry_initial_delay=500 and conn_retry_backoff_multiplier=1.5 the second reconnect attempt will be at 0.5 seconds after first retry connect fails; the third attempt will be 0.75 seconds after the second retry connect fails; the fourth attempt will be 1.125 seconds after the third retry connect fails. The default value is 2.0.
Definition at line 57 of file TcpInst.h.
Referenced by dump_to_str().
The initial retry delay in milliseconds. The first connection retry will be when the loss of connection is detected. The second try will be after this delay. The default is 500 miliseconds.
Definition at line 47 of file TcpInst.h.
Referenced by dump_to_str().
Definition at line 41 of file TcpInst.h.
Referenced by dump_to_str(), and OpenDDS::DCPS::TcpConnection::set_sock_options().
ACE_INET_Addr OpenDDS::DCPS::TcpInst::local_address_ [private] |
std::string OpenDDS::DCPS::TcpInst::local_address_str_ [private] |
Maximum period (in milliseconds) of not being able to send queued messages. If there are samples queued and no output for longer than this period then the connection will be closed and on_*_lost() callbacks will be called. If the value is zero, the default, then this check will not be made.
Definition at line 69 of file TcpInst.h.
Referenced by dump_to_str().
The time period in milliseconds for the acceptor side of a connection to wait for the connection to be reconnected. If not reconnected within this period then on_publication_lost() and on_subscription_lost() callbacks will be called. The default is 2 seconds (2000 millseconds).
Definition at line 77 of file TcpInst.h.
Referenced by dump_to_str().
std::string OpenDDS::DCPS::TcpInst::pub_address_str_ |
The address string provided to DCPSInfoRepo for connectors. This string is either from configuration file or defaults to the local address.
Definition at line 39 of file TcpInst.h.
Referenced by dump_to_str(), load(), and populate_locator().