#include <TransportInst.h>
Inheritance diagram for OpenDDS::DCPS::TransportInst:
Public Member Functions | |
OPENDDS_STRING | name () const |
virtual int | load (ACE_Configuration_Heap &cf, ACE_Configuration_Section_Key §) |
void | dump () |
Diagnostic aid. | |
virtual OPENDDS_STRING | dump_to_str () |
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 () |
Private Member Functions | |
void | adjust_config_value () |
void | shutdown () |
TransportImpl_rch | impl () |
virtual TransportImpl * | new_impl (const RcHandle< TransportInst > &inst)=0 |
Private Attributes | |
const OPENDDS_STRING | name_ |
TransportImpl_rch | impl_ |
ACE_SYNCH_MUTEX | lock_ |
Friends | |
class | TransportRegistry |
class | TransportClient |
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::DCPS::TransportInst::~TransportInst | ( | ) | [protected, virtual] |
Definition at line 23 of file TransportInst.cpp.
References DBG_ENTRY_LVL.
00024 { 00025 DBG_ENTRY_LVL("TransportInst","~TransportInst",6); 00026 }
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 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 | ( | ) |
Diagnostic aid.
Definition at line 58 of file TransportInst.cpp.
References dump_to_str().
00059 { 00060 ACE_DEBUG((LM_DEBUG, 00061 ACE_TEXT("\n(%P|%t) TransportInst::dump() -\n%C"), 00062 dump_to_str().c_str())); 00063 }
OPENDDS_STRING OpenDDS::DCPS::TransportInst::dump_to_str | ( | ) | [virtual] |
Reimplemented in OpenDDS::DCPS::MulticastInst, OpenDDS::DCPS::RtpsUdpInst, OpenDDS::DCPS::ShmemInst, OpenDDS::DCPS::TcpInst, and OpenDDS::DCPS::UdpInst.
Definition at line 85 of file TransportInst.cpp.
References formatNameForDump(), name_, OPENDDS_STRING, thread_per_connection_, OpenDDS::DCPS::to_dds_string(), and transport_type_.
Referenced by dump(), OpenDDS::DCPS::UdpInst::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().
00086 { 00087 OPENDDS_STRING ret; 00088 ret += formatNameForDump("transport_type") + this->transport_type_ + '\n'; 00089 ret += formatNameForDump("name") + this->name_ + '\n'; 00090 ret += formatNameForDump("queue_messages_per_pool") + to_dds_string(unsigned(this->queue_messages_per_pool_)) + '\n'; 00091 ret += formatNameForDump("queue_initial_pools") + to_dds_string(unsigned(this->queue_initial_pools_)) + '\n'; 00092 ret += formatNameForDump("max_packet_size") + to_dds_string(unsigned(this->max_packet_size_)) + '\n'; 00093 ret += formatNameForDump("max_samples_per_packet") + to_dds_string(unsigned(this->max_samples_per_packet_)) + '\n'; 00094 ret += formatNameForDump("optimum_packet_size") + to_dds_string(unsigned(this->optimum_packet_size_)) + '\n'; 00095 ret += formatNameForDump("thread_per_connection") + (this->thread_per_connection_ ? "true" : "false") + '\n'; 00096 ret += formatNameForDump("datalink_release_delay") + to_dds_string(this->datalink_release_delay_) + '\n'; 00097 ret += formatNameForDump("datalink_control_chunks") + to_dds_string(unsigned(this->datalink_control_chunks_)) + '\n'; 00098 return ret; 00099 }
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 71 of file TransportInst.cpp.
References NAME_INDENT(), NAME_WIDTH(), and 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().
00072 { 00073 OPENDDS_STRING formatted_name; 00074 formatted_name.reserve(NAME_INDENT + NAME_WIDTH); 00075 formatted_name += OPENDDS_STRING(NAME_INDENT, ' '); 00076 formatted_name += name; 00077 formatted_name += ":"; 00078 if ((NAME_WIDTH + NAME_INDENT) > formatted_name.length()) { 00079 formatted_name += OPENDDS_STRING((NAME_WIDTH + NAME_INDENT- formatted_name.length()), ' '); 00080 } 00081 return formatted_name; 00082 }
OpenDDS::DCPS::TransportImpl_rch OpenDDS::DCPS::TransportInst::impl | ( | ) | [private] |
Definition at line 112 of file TransportInst.cpp.
References impl_.
00113 { 00114 ACE_GUARD_RETURN(ACE_SYNCH_MUTEX, g, this->lock_, TransportImpl_rch()); 00115 if (this->impl_.is_nil()) { 00116 try { 00117 this->impl_ = this->new_impl(TransportInst_rch(this, false)); 00118 } catch (const OpenDDS::DCPS::Transport::UnableToCreate& ) { 00119 return 0; 00120 } 00121 } 00122 return this->impl_; 00123 }
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 29 of file TransportInst.cpp.
References adjust_config_value(), and GET_CONFIG_VALUE.
00031 { 00032 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("queue_messages_per_pool"), this->queue_messages_per_pool_, size_t) 00033 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("queue_initial_pools"), this->queue_initial_pools_, size_t) 00034 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("max_packet_size"), this->max_packet_size_, ACE_UINT32) 00035 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("max_samples_per_packet"), this->max_samples_per_packet_, size_t) 00036 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("optimum_packet_size"), this->optimum_packet_size_, ACE_UINT32) 00037 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("thread_per_connection"), this->thread_per_connection_, bool) 00038 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("datalink_release_delay"), this->datalink_release_delay_, int) 00039 00040 // Undocumented - this option is not in the Developer's Guide 00041 // Controls the number of chunks in the allocators used by the datalink 00042 // for control messages. 00043 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("datalink_control_chunks"), this->datalink_control_chunks_, size_t) 00044 00045 ACE_TString stringvalue; 00046 if (cf.get_string_value (sect, ACE_TEXT("passive_connect_duration"), stringvalue) == 0) { 00047 ACE_DEBUG ((LM_WARNING, 00048 ACE_TEXT ("(%P|%t) WARNING: passive_connect_duration option ") 00049 ACE_TEXT ("is deprecated in the transport inst, must be ") 00050 ACE_TEXT ("defined in transport config.\n"))); 00051 } 00052 00053 adjust_config_value(); 00054 return 0; 00055 }
OPENDDS_STRING OpenDDS::DCPS::TransportInst::name | ( | ) | const [inline] |
Definition at line 53 of file TransportInst.h.
Referenced by OpenDDS::DCPS::ShmemInst::ShmemInst(), and OpenDDS::DCPS::MulticastDataLink::syn_received_no_session().
00053 { return name_; }
virtual TransportImpl* OpenDDS::DCPS::TransportInst::new_impl | ( | const RcHandle< TransportInst > & | inst | ) | [private, pure virtual] |
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::shutdown | ( | ) | [private] |
Definition at line 102 of file TransportInst.cpp.
References impl_.
00103 { 00104 ACE_GUARD(ACE_SYNCH_MUTEX, g, this->lock_); 00105 if (!this->impl_.is_nil()) { 00106 this->impl_->shutdown(); 00107 this->impl_ = 0; 00108 } 00109 }
friend class TransportClient [friend] |
Definition at line 124 of file TransportInst.h.
friend class TransportRegistry [friend] |
Definition at line 121 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.
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.
ACE_SYNCH_MUTEX OpenDDS::DCPS::TransportInst::lock_ [private] |
Definition at line 131 of file TransportInst.h.
Max size (in bytes) of a packet (packet header + sample(s)).
Definition at line 79 of file TransportInst.h.
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().
const OPENDDS_STRING OpenDDS::DCPS::TransportInst::name_ [private] |
Optimum size (in bytes) of a packet (packet header + sample(s)).
Definition at line 85 of file TransportInst.h.
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.
Number of pre-created link (list) objects per pool for the "send queue" of each DataLink.
Definition at line 72 of file TransportInst.h.
Flag for whether a new thread is needed for connection to send without backpressure.
Definition at line 89 of file TransportInst.h.
Referenced by dump_to_str().
const OPENDDS_STRING OpenDDS::DCPS::TransportInst::transport_type_ |