#include <TcpInst.h>
Public Member Functions | |
virtual int | load (ACE_Configuration_Heap &cf, ACE_Configuration_Section_Key §) |
virtual OPENDDS_STRING | dump_to_str () const |
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 () |
TransportImpl_rch | new_impl () |
Private Attributes | |
ACE_INET_Addr | local_address_ |
std::string | local_address_str_ |
Friends | |
class | TcpType |
class | TcpTransport |
class | ::DDS_TEST |
template<typename T , typename U > | |
RcHandle< T > | OpenDDS::DCPS::make_rch (U const &) |
Definition at line 29 of file TcpInst.h.
OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE OpenDDS::DCPS::TcpInst::TcpInst | ( | const OPENDDS_STRING & | name | ) | [explicit, private] |
Definition at line 13 of file TcpInst.inl.
References DBG_ENTRY_LVL.
00014 : TransportInst("tcp", name), 00015 enable_nagle_algorithm_(false), 00016 conn_retry_initial_delay_(500), 00017 conn_retry_backoff_multiplier_(2.0), 00018 conn_retry_attempts_(3), 00019 max_output_pause_period_(-1), 00020 passive_reconnect_duration_(2000) 00021 { 00022 DBG_ENTRY_LVL("TcpInst", "TcpInst", 6); 00023 }
OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL OpenDDS::DCPS::TcpInst::~TcpInst | ( | ) | [private, virtual] |
Definition at line 24 of file TcpInst.cpp.
References DBG_ENTRY_LVL.
00025 { 00026 DBG_ENTRY_LVL("TcpInst","~TcpInst",6); 00027 }
OPENDDS_STRING OpenDDS::DCPS::TcpInst::dump_to_str | ( | ) | const [virtual] |
Diagnostic aid.
Reimplemented from OpenDDS::DCPS::TransportInst.
Definition at line 72 of file TcpInst.cpp.
References conn_retry_attempts_, conn_retry_backoff_multiplier_, conn_retry_initial_delay_, enable_nagle_algorithm_, OpenDDS::DCPS::TransportInst::formatNameForDump(), local_address_string(), max_output_pause_period_, OPENDDS_STRING, passive_reconnect_duration_, and pub_address_str_.
Referenced by OpenDDS::DCPS::TcpConnection::active_establishment().
00073 { 00074 std::ostringstream os; 00075 os << TransportInst::dump_to_str() << std::endl; 00076 00077 os << formatNameForDump("local_address") << this->local_address_string() << std::endl; 00078 os << formatNameForDump("pub_address") << this->pub_address_str_ << std::endl; 00079 os << formatNameForDump("enable_nagle_algorithm") << (this->enable_nagle_algorithm_ ? "true" : "false") << std::endl; 00080 os << formatNameForDump("conn_retry_initial_delay") << this->conn_retry_initial_delay_ << std::endl; 00081 os << formatNameForDump("conn_retry_backoff_multiplier") << this->conn_retry_backoff_multiplier_ << std::endl; 00082 os << formatNameForDump("conn_retry_attempts") << this->conn_retry_attempts_ << std::endl; 00083 os << formatNameForDump("passive_reconnect_duration") << this->passive_reconnect_duration_ << std::endl; 00084 os << formatNameForDump("max_output_pause_period") << this->max_output_pause_period_ << std::endl; 00085 return OPENDDS_STRING(os.str()); 00086 }
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 86 of file TcpInst.h.
Referenced by OpenDDS::DCPS::TcpConnection::active_establishment(), and populate_locator().
00086 { 00087 return (pub_address_str_ == "") ? local_address_str_ : pub_address_str_; 00088 }
bool OpenDDS::DCPS::TcpInst::is_reliable | ( | ) | const [inline, virtual] |
Does the transport as configured support RELIABLE_RELIABILITY_QOS?
Implements OpenDDS::DCPS::TransportInst.
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 36 of file TcpInst.cpp.
References ACE_TEXT(), conn_retry_attempts_, conn_retry_backoff_multiplier_, conn_retry_initial_delay_, enable_nagle_algorithm_, GET_CONFIG_DOUBLE_VALUE, GET_CONFIG_STRING_VALUE, GET_CONFIG_VALUE, local_address(), max_output_pause_period_, passive_reconnect_duration_, and pub_address_str_.
00038 { 00039 TransportInst::load(cf, trans_sect); 00040 00041 std::string local_address; 00042 GET_CONFIG_STRING_VALUE(cf, trans_sect, ACE_TEXT("local_address"), local_address); 00043 00044 if (local_address != "") { 00045 this->local_address(local_address.c_str()); 00046 } 00047 00048 GET_CONFIG_STRING_VALUE(cf, trans_sect, ACE_TEXT("pub_address"), pub_address_str_); 00049 00050 GET_CONFIG_VALUE(cf, trans_sect, ACE_TEXT("enable_nagle_algorithm"), 00051 this->enable_nagle_algorithm_, bool) 00052 00053 GET_CONFIG_VALUE(cf, trans_sect, ACE_TEXT("conn_retry_initial_delay"), 00054 this->conn_retry_initial_delay_, int) 00055 00056 GET_CONFIG_DOUBLE_VALUE(cf, trans_sect, ACE_TEXT("conn_retry_backoff_multiplier"), 00057 this->conn_retry_backoff_multiplier_) 00058 00059 GET_CONFIG_VALUE(cf, trans_sect, ACE_TEXT("conn_retry_attempts"), 00060 this->conn_retry_attempts_, int) 00061 00062 GET_CONFIG_VALUE(cf, trans_sect, ACE_TEXT("passive_reconnect_duration"), 00063 this->passive_reconnect_duration_, int) 00064 00065 GET_CONFIG_VALUE(cf, trans_sect, ACE_TEXT("max_output_pause_period"), 00066 this->max_output_pause_period_, int) 00067 00068 return 0; 00069 }
void OpenDDS::DCPS::TcpInst::local_address | ( | u_short | port_number, | |
const char * | host_name | |||
) | [inline] |
Definition at line 99 of file TcpInst.h.
References OpenDDS::DCPS::to_dds_string().
00100 { 00101 local_address_str_ = host_name; 00102 local_address_str_ += ":" + to_dds_string(port_number); 00103 local_address_.set(port_number, host_name); 00104 }
void OpenDDS::DCPS::TcpInst::local_address | ( | const char * | str | ) | [inline] |
Definition at line 94 of file TcpInst.h.
References ACE_INET_Addr::set().
00095 { 00096 local_address_str_ = str; 00097 local_address_.set(str); 00098 }
ACE_INET_Addr OpenDDS::DCPS::TcpInst::local_address | ( | ) | const [inline] |
Definition at line 93 of file TcpInst.h.
Referenced by OpenDDS::DCPS::TcpTransport::blob_to_key(), OpenDDS::DCPS::TcpTransport::configure_i(), OpenDDS::DCPS::TcpTransport::fresh_link(), load(), OpenDDS::DCPS::TcpConnection::open(), OpenDDS::DCPS::TcpTransport::passive_connection(), and populate_locator().
00093 { return local_address_; }
void OpenDDS::DCPS::TcpInst::local_address_set_port | ( | u_short | port_number | ) | [inline] |
Definition at line 105 of file TcpInst.h.
Referenced by OpenDDS::DCPS::TcpTransport::configure_i().
00105 { 00106 local_address_.set_port_number(port_number); 00107 set_port_in_addr_string(local_address_str_, port_number); 00108 }
OPENDDS_STRING OpenDDS::DCPS::TcpInst::local_address_string | ( | ) | const [inline] |
Definition at line 92 of file TcpInst.h.
Referenced by dump_to_str().
00092 { return local_address_str_; }
OpenDDS::DCPS::TransportImpl_rch OpenDDS::DCPS::TcpInst::new_impl | ( | ) | [private, virtual] |
Implements OpenDDS::DCPS::TransportInst.
Definition at line 30 of file TcpInst.cpp.
References OpenDDS::DCPS::ref().
00031 { 00032 return make_rch<TcpTransport>(ref(*this)); 00033 }
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 89 of file TcpInst.cpp.
References ACE_OutputCDR::buffer(), OpenDDS::DCPS::TransportLocator::data, get_public_address(), len, local_address(), pub_address_str_, ACE_OutputCDR::total_length(), and OpenDDS::DCPS::TransportLocator::transport_type.
Referenced by OpenDDS::DCPS::TcpTransport::connection_info_i().
00090 { 00091 if (this->local_address() != ACE_INET_Addr() || !pub_address_str_.empty()) { 00092 // Get the public address string from the inst (usually the local address) 00093 NetworkAddress network_order_address(this->get_public_address()); 00094 00095 ACE_OutputCDR cdr; 00096 cdr << network_order_address; 00097 const CORBA::ULong len = static_cast<CORBA::ULong>(cdr.total_length()); 00098 char* buffer = const_cast<char*>(cdr.buffer()); // safe 00099 00100 local_info.transport_type = "tcp"; 00101 local_info.data = TransportBLOB(len, len, 00102 reinterpret_cast<CORBA::Octet*>(buffer)); 00103 return 1; 00104 } else { 00105 return 0; 00106 } 00107 }
RcHandle<T> OpenDDS::DCPS::make_rch | ( | U const & | ) | [friend] |
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 64 of file TcpInst.h.
Referenced by OpenDDS::DCPS::TcpConnection::active_reconnect_i(), dump_to_str(), and load().
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 59 of file TcpInst.h.
Referenced by OpenDDS::DCPS::TcpConnection::active_reconnect_i(), dump_to_str(), and load().
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 49 of file TcpInst.h.
Referenced by OpenDDS::DCPS::TcpConnection::active_reconnect_i(), dump_to_str(), and load().
Definition at line 43 of file TcpInst.h.
Referenced by dump_to_str(), load(), and OpenDDS::DCPS::TcpConnection::set_sock_options().
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 71 of file TcpInst.h.
Referenced by dump_to_str(), and load().
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 79 of file TcpInst.h.
Referenced by dump_to_str(), load(), and OpenDDS::DCPS::TcpConnection::passive_reconnect_i().
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 41 of file TcpInst.h.
Referenced by dump_to_str(), load(), and populate_locator().