Base class to hold configuration settings for TransportImpls. More...
#include <TransportInst.h>
Public Member Functions | |
const OPENDDS_STRING & | name () const |
virtual int | load (ACE_Configuration_Heap &cf, ACE_Configuration_Section_Key §) |
void | dump () const |
Diagnostic aid. | |
virtual OPENDDS_STRING | dump_to_str () const |
virtual bool | is_reliable () const =0 |
Does the transport as configured support RELIABLE_RELIABILITY_QOS? | |
virtual bool | requires_cdr () const |
Does the transport require a CDR-encapsulated data payload? | |
virtual size_t | populate_locator (OpenDDS::DCPS::TransportLocator &trans_info) const =0 |
Populate a transport locator sequence. Return the number of "locators.". | |
Static Public Member Functions | |
static OPENDDS_STRING | formatNameForDump (const char *name) |
Public Attributes | |
const OPENDDS_STRING | transport_type_ |
size_t | queue_messages_per_pool_ |
size_t | queue_initial_pools_ |
ACE_UINT32 | max_packet_size_ |
Max size (in bytes) of a packet (packet header + sample(s)). | |
size_t | max_samples_per_packet_ |
Max number of samples that should ever be in a single packet. | |
ACE_UINT32 | optimum_packet_size_ |
Optimum size (in bytes) of a packet (packet header + sample(s)). | |
bool | thread_per_connection_ |
long | datalink_release_delay_ |
size_t | datalink_control_chunks_ |
Protected Member Functions | |
TransportInst (const char *type, const OPENDDS_STRING &name) | |
virtual | ~TransportInst () |
void | set_port_in_addr_string (OPENDDS_STRING &addr_str, u_short port_number) |
Private Member Functions | |
void | adjust_config_value () |
void | shutdown () |
TransportImpl * | impl () |
virtual TransportImpl_rch | new_impl ()=0 |
Private Attributes | |
const OPENDDS_STRING | name_ |
TransportImpl_rch | impl_ |
ACE_SYNCH_MUTEX | lock_ |
Friends | |
class | TransportRegistry |
class | TransportClient |
Base class to hold configuration settings for TransportImpls.
Each transport implementation will need to define a concrete subclass of the TransportInst class. The base class (TransportInst) contains configuration settings that are common to all (or most) concrete transport implementations. The concrete transport implementation defines any configuration settings that it requires within its concrete subclass of this TransportInst base class.
The TransportInst object is supplied to the TransportImpl::configure() method.
Definition at line 50 of file TransportInst.h.
ACE_INLINE OpenDDS::DCPS::TransportInst::TransportInst | ( | const char * | type, | |
const OPENDDS_STRING & | name | |||
) | [protected] |
Definition at line 13 of file TransportInst.inl.
References adjust_config_value(), and DBG_ENTRY_LVL.
00015 : transport_type_(type), 00016 queue_messages_per_pool_(DEFAULT_CONFIG_QUEUE_MESSAGES_PER_POOL), 00017 queue_initial_pools_(DEFAULT_CONFIG_QUEUE_INITIAL_POOLS), 00018 max_packet_size_(DEFAULT_CONFIG_MAX_PACKET_SIZE), 00019 max_samples_per_packet_(DEFAULT_CONFIG_MAX_SAMPLES_PER_PACKET), 00020 optimum_packet_size_(DEFAULT_CONFIG_OPTIMUM_PACKET_SIZE), 00021 thread_per_connection_(0), 00022 datalink_release_delay_(10000), 00023 datalink_control_chunks_(32), 00024 name_(name) 00025 { 00026 DBG_ENTRY_LVL("TransportInst", "TransportInst", 6); 00027 this->adjust_config_value(); 00028 }
OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL OpenDDS::DCPS::TransportInst::~TransportInst | ( | ) | [protected, virtual] |
Definition at line 26 of file TransportInst.cpp.
References DBG_ENTRY_LVL.
00027 { 00028 DBG_ENTRY_LVL("TransportInst","~TransportInst",6); 00029 }
ACE_INLINE void OpenDDS::DCPS::TransportInst::adjust_config_value | ( | ) | [private] |
Adjust the configuration values which gives warning on adjusted value.
Definition at line 32 of file TransportInst.inl.
References ACE_TEXT(), LM_NOTICE, max_samples_per_packet_, and OpenDDS::DCPS::MAX_SEND_BLOCKS.
Referenced by load(), and TransportInst().
00033 { 00034 // Ensure that the number of samples put into the packet does 00035 // not exceed the allowed number of io vectors to be sent by the OS. 00036 size_t old_value = max_samples_per_packet_; 00037 00038 if ((2 * max_samples_per_packet_ + 1) > MAX_SEND_BLOCKS) { 00039 max_samples_per_packet_ = (MAX_SEND_BLOCKS + 1) / 2 - 1; 00040 ACE_DEBUG((LM_NOTICE, 00041 ACE_TEXT("(%P|%t) NOTICE: \"max_samples_per_packet\" is adjusted from %u to %u\n"), 00042 old_value, max_samples_per_packet_)); 00043 } 00044 }
void OpenDDS::DCPS::TransportInst::dump | ( | void | ) | const |
Diagnostic aid.
Definition at line 61 of file TransportInst.cpp.
References ACE_TEXT(), dump_to_str(), and LM_DEBUG.
Referenced by OpenDDS::DCPS::TransportSendStrategy::direct_send().
00062 { 00063 ACE_DEBUG((LM_DEBUG, 00064 ACE_TEXT("\n(%P|%t) TransportInst::dump() -\n%C"), 00065 dump_to_str().c_str())); 00066 }
OPENDDS_STRING OpenDDS::DCPS::TransportInst::dump_to_str | ( | ) | const [virtual] |
Reimplemented in OpenDDS::DCPS::MulticastInst, OpenDDS::DCPS::RtpsUdpInst, OpenDDS::DCPS::ShmemInst, OpenDDS::DCPS::TcpInst, and OpenDDS::DCPS::UdpInst.
Definition at line 88 of file TransportInst.cpp.
References datalink_control_chunks_, datalink_release_delay_, formatNameForDump(), max_packet_size_, max_samples_per_packet_, name_, OPENDDS_STRING, optimum_packet_size_, queue_initial_pools_, queue_messages_per_pool_, thread_per_connection_, OpenDDS::DCPS::to_dds_string(), and transport_type_.
Referenced by dump(), and OpenDDS::DCPS::TransportImpl::dump_to_str().
00089 { 00090 OPENDDS_STRING ret; 00091 ret += formatNameForDump("transport_type") + this->transport_type_ + '\n'; 00092 ret += formatNameForDump("name") + this->name_ + '\n'; 00093 ret += formatNameForDump("queue_messages_per_pool") + to_dds_string(unsigned(this->queue_messages_per_pool_)) + '\n'; 00094 ret += formatNameForDump("queue_initial_pools") + to_dds_string(unsigned(this->queue_initial_pools_)) + '\n'; 00095 ret += formatNameForDump("max_packet_size") + to_dds_string(unsigned(this->max_packet_size_)) + '\n'; 00096 ret += formatNameForDump("max_samples_per_packet") + to_dds_string(unsigned(this->max_samples_per_packet_)) + '\n'; 00097 ret += formatNameForDump("optimum_packet_size") + to_dds_string(unsigned(this->optimum_packet_size_)) + '\n'; 00098 ret += formatNameForDump("thread_per_connection") + (this->thread_per_connection_ ? "true" : "false") + '\n'; 00099 ret += formatNameForDump("datalink_release_delay") + to_dds_string(this->datalink_release_delay_) + '\n'; 00100 ret += formatNameForDump("datalink_control_chunks") + to_dds_string(unsigned(this->datalink_control_chunks_)) + '\n'; 00101 return ret; 00102 }
OPENDDS_STRING OpenDDS::DCPS::TransportInst::formatNameForDump | ( | const char * | name | ) | [static] |
Format name of transport configuration parameter for use in conjunction with dump(std::ostream& os).
Definition at line 74 of file TransportInst.cpp.
References OPENDDS_STRING.
Referenced by OpenDDS::DCPS::UdpInst::dump_to_str(), dump_to_str(), OpenDDS::DCPS::TcpInst::dump_to_str(), OpenDDS::DCPS::ShmemInst::dump_to_str(), OpenDDS::DCPS::RtpsUdpInst::dump_to_str(), and OpenDDS::DCPS::MulticastInst::dump_to_str().
00075 { 00076 OPENDDS_STRING formatted_name; 00077 formatted_name.reserve(NAME_INDENT + NAME_WIDTH); 00078 formatted_name += OPENDDS_STRING(NAME_INDENT, ' '); 00079 formatted_name += name; 00080 formatted_name += ":"; 00081 if ((NAME_WIDTH + NAME_INDENT) > formatted_name.length()) { 00082 formatted_name += OPENDDS_STRING((NAME_WIDTH + NAME_INDENT- formatted_name.length()), ' '); 00083 } 00084 return formatted_name; 00085 }
OpenDDS::DCPS::TransportImpl * OpenDDS::DCPS::TransportInst::impl | ( | void | ) | [private] |
Definition at line 114 of file TransportInst.cpp.
References impl_, OpenDDS::DCPS::RcHandle< T >::in(), lock_, and new_impl().
00115 { 00116 ACE_GUARD_RETURN(ACE_SYNCH_MUTEX, g, this->lock_, 0); 00117 if (!this->impl_) { 00118 try { 00119 this->impl_ = this->new_impl(); 00120 } catch (const OpenDDS::DCPS::Transport::UnableToCreate& ) { 00121 return 0; 00122 } 00123 } 00124 return this->impl_.in(); 00125 }
virtual bool OpenDDS::DCPS::TransportInst::is_reliable | ( | ) | const [pure virtual] |
Does the transport as configured support RELIABLE_RELIABILITY_QOS?
Implemented in OpenDDS::DCPS::MulticastInst, OpenDDS::DCPS::RtpsUdpInst, OpenDDS::DCPS::ShmemInst, OpenDDS::DCPS::TcpInst, and OpenDDS::DCPS::UdpInst.
Referenced by OpenDDS::DCPS::RecorderImpl::check_transport_qos(), and OpenDDS::DCPS::DataReaderImpl::check_transport_qos().
int OpenDDS::DCPS::TransportInst::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 in OpenDDS::DCPS::MulticastInst, OpenDDS::DCPS::RtpsUdpInst, OpenDDS::DCPS::ShmemInst, OpenDDS::DCPS::TcpInst, and OpenDDS::DCPS::UdpInst.
Definition at line 32 of file TransportInst.cpp.
References ACE_TEXT(), adjust_config_value(), datalink_control_chunks_, datalink_release_delay_, GET_CONFIG_VALUE, ACE_Configuration_Heap::get_string_value(), LM_WARNING, max_packet_size_, max_samples_per_packet_, optimum_packet_size_, queue_initial_pools_, queue_messages_per_pool_, and thread_per_connection_.
00034 { 00035 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("queue_messages_per_pool"), this->queue_messages_per_pool_, size_t) 00036 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("queue_initial_pools"), this->queue_initial_pools_, size_t) 00037 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("max_packet_size"), this->max_packet_size_, ACE_UINT32) 00038 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("max_samples_per_packet"), this->max_samples_per_packet_, size_t) 00039 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("optimum_packet_size"), this->optimum_packet_size_, ACE_UINT32) 00040 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("thread_per_connection"), this->thread_per_connection_, bool) 00041 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("datalink_release_delay"), this->datalink_release_delay_, int) 00042 00043 // Undocumented - this option is not in the Developer's Guide 00044 // Controls the number of chunks in the allocators used by the datalink 00045 // for control messages. 00046 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("datalink_control_chunks"), this->datalink_control_chunks_, size_t) 00047 00048 ACE_TString stringvalue; 00049 if (cf.get_string_value (sect, ACE_TEXT("passive_connect_duration"), stringvalue) == 0) { 00050 ACE_DEBUG ((LM_WARNING, 00051 ACE_TEXT ("(%P|%t) WARNING: passive_connect_duration option ") 00052 ACE_TEXT ("is deprecated in the transport inst, must be ") 00053 ACE_TEXT ("defined in transport config.\n"))); 00054 } 00055 00056 adjust_config_value(); 00057 return 0; 00058 }
const OPENDDS_STRING& OpenDDS::DCPS::TransportInst::name | ( | void | ) | const [inline] |
Definition at line 53 of file TransportInst.h.
Referenced by OpenDDS::DCPS::SynWatchdog::on_timeout(), and OpenDDS::DCPS::ShmemInst::ShmemInst().
00053 { return name_; }
virtual TransportImpl_rch OpenDDS::DCPS::TransportInst::new_impl | ( | ) | [private, pure virtual] |
Implemented in OpenDDS::DCPS::MulticastInst, OpenDDS::DCPS::RtpsUdpInst, OpenDDS::DCPS::ShmemInst, OpenDDS::DCPS::TcpInst, and OpenDDS::DCPS::UdpInst.
Referenced by impl().
virtual size_t OpenDDS::DCPS::TransportInst::populate_locator | ( | OpenDDS::DCPS::TransportLocator & | trans_info | ) | const [pure virtual] |
Populate a transport locator sequence. Return the number of "locators.".
Implemented in OpenDDS::DCPS::MulticastInst, OpenDDS::DCPS::RtpsUdpInst, OpenDDS::DCPS::ShmemInst, OpenDDS::DCPS::TcpInst, and OpenDDS::DCPS::UdpInst.
virtual bool OpenDDS::DCPS::TransportInst::requires_cdr | ( | ) | const [inline, virtual] |
Does the transport require a CDR-encapsulated data payload?
Reimplemented in OpenDDS::DCPS::RtpsUdpInst.
Definition at line 103 of file TransportInst.h.
void OpenDDS::DCPS::TransportInst::set_port_in_addr_string | ( | OPENDDS_STRING & | addr_str, | |
u_short | port_number | |||
) | [protected] |
Definition at line 128 of file TransportInst.cpp.
References OPENDDS_END_VERSIONED_NAMESPACE_DECL, and ACE_OS::snprintf().
00129 { 00130 #ifdef BUFSIZE 00131 #undef BUFSIZE 00132 #endif 00133 const int BUFSIZE=1024; 00134 char result[BUFSIZE]; 00135 00136 #ifdef __SUNPRO_CC 00137 int count = 0; 00138 std::count(addr_str.begin(), addr_str.end(), ':', count); 00139 if (count < 2) { 00140 #else 00141 if (std::count(addr_str.begin(), addr_str.end(), ':') < 2) { 00142 #endif 00143 OPENDDS_STRING::size_type pos = addr_str.find_last_of(":"); 00144 ACE_OS::snprintf(result, BUFSIZE, "%.*s:%hu", static_cast<int>(pos), addr_str.c_str(), port_number); 00145 } 00146 else { 00147 // this is the numeric form of ipv6 address because it has more than one ':' 00148 if (addr_str[0] != '[') { 00149 ACE_OS::snprintf(result, BUFSIZE, "[%s]:%hu", addr_str.c_str(), port_number); 00150 } 00151 else { 00152 OPENDDS_STRING::size_type pos = addr_str.find_last_of("]"); 00153 ACE_OS::snprintf(result, BUFSIZE, "%.*s:%hu", static_cast<int>(pos+1), addr_str.c_str(), port_number); 00154 } 00155 } 00156 addr_str = result; 00157 }
void OpenDDS::DCPS::TransportInst::shutdown | ( | void | ) | [private] |
Definition at line 105 of file TransportInst.cpp.
References impl_, OpenDDS::DCPS::RcHandle< T >::is_nil(), and lock_.
00106 { 00107 ACE_GUARD(ACE_SYNCH_MUTEX, g, this->lock_); 00108 if (!this->impl_.is_nil()) { 00109 this->impl_->shutdown(); 00110 } 00111 }
friend class TransportClient [friend] |
Definition at line 126 of file TransportInst.h.
friend class TransportRegistry [friend] |
Definition at line 123 of file TransportInst.h.
The number of chunks used to size allocators for transport control samples. The default value is 32.
Definition at line 97 of file TransportInst.h.
Referenced by OpenDDS::DCPS::DataLink::DataLink(), dump_to_str(), and load().
Delay in milliseconds that the datalink should be released after all associations are removed. The default value is 10 seconds.
Definition at line 93 of file TransportInst.h.
Referenced by OpenDDS::DCPS::DataLink::DataLink(), dump_to_str(), and load().
Definition at line 132 of file TransportInst.h.
Referenced by impl(), and shutdown().
ACE_SYNCH_MUTEX OpenDDS::DCPS::TransportInst::lock_ [private] |
Definition at line 133 of file TransportInst.h.
Referenced by impl(), and shutdown().
Max size (in bytes) of a packet (packet header + sample(s)).
Definition at line 79 of file TransportInst.h.
Referenced by dump_to_str(), and load().
Max number of samples that should ever be in a single packet.
Definition at line 82 of file TransportInst.h.
Referenced by adjust_config_value(), dump_to_str(), load(), and OpenDDS::DCPS::MulticastDataLink::MulticastDataLink().
const OPENDDS_STRING OpenDDS::DCPS::TransportInst::name_ [private] |
Definition at line 130 of file TransportInst.h.
Referenced by dump_to_str().
Optimum size (in bytes) of a packet (packet header + sample(s)).
Definition at line 85 of file TransportInst.h.
Referenced by dump_to_str(), and load().
Initial number of pre-allocated pools of link (list) objects for the "send queue" of each DataLink.
Definition at line 76 of file TransportInst.h.
Referenced by dump_to_str(), and load().
Number of pre-created link (list) objects per pool for the "send queue" of each DataLink.
Definition at line 72 of file TransportInst.h.
Referenced by dump_to_str(), and load().
Flag for whether a new thread is needed for connection to send without backpressure.
Definition at line 89 of file TransportInst.h.
Referenced by OpenDDS::DCPS::DataLink::DataLink(), dump_to_str(), and load().
const OPENDDS_STRING OpenDDS::DCPS::TransportInst::transport_type_ |
Definition at line 68 of file TransportInst.h.
Referenced by dump_to_str().