OpenDDS  Snapshot(2023/04/07-19:43)
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
OpenDDS::DCPS::TransportInst Class Referenceabstract

Base class to hold configuration settings for TransportImpls. More...

#include <TransportInst.h>

Inheritance diagram for OpenDDS::DCPS::TransportInst:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::TransportInst:
Collaboration graph
[legend]

Public Member Functions

const OPENDDS_STRINGname () const
 
virtual int load (ACE_Configuration_Heap &cf, ACE_Configuration_Section_Key &sect)
 
void dump () const
 Diagnostic aid. More...
 
virtual OPENDDS_STRING dump_to_str () const
 
virtual bool is_reliable () const =0
 Does the transport as configured support RELIABLE_RELIABILITY_QOS? More...
 
virtual bool requires_cdr_encapsulation () const
 Does the transport require a CDR-encapsulated data payload? More...
 
virtual size_t populate_locator (OpenDDS::DCPS::TransportLocator &trans_info, ConnectionInfoFlags flags) const =0
 Populate a transport locator sequence. Return the number of "locators.". More...
 
DCPS::WeakRcHandle< ICE::Endpointget_ice_endpoint ()
 
void rtps_relay_only_now (bool flag)
 
void use_rtps_relay_now (bool flag)
 
void use_ice_now (bool flag)
 
virtual void update_locators (const GUID_t &, const TransportLocatorSeq &)
 
virtual void get_last_recv_locator (const GUID_t &, TransportLocator &)
 
virtual void rtps_relay_address_change ()
 
ReactorTask_rch reactor_task ()
 
EventDispatcher_rch event_dispatcher ()
 
void count_messages (bool flag)
 
bool count_messages () const
 
virtual void append_transport_statistics (TransportStatisticsSequence &)
 
void drop_messages (bool flag)
 
void drop_messages_m (double m)
 
void drop_messages_b (double b)
 
bool should_drop (ssize_t length) const
 
bool should_drop (const iovec iov[], int n, ssize_t &length) const
 
- Public Member Functions inherited from OpenDDS::DCPS::RcObject
virtual ~RcObject ()
 
virtual void _add_ref ()
 
virtual void _remove_ref ()
 
long ref_count () const
 
WeakObject_get_weak_object () const
 

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)) More...
 
size_t max_samples_per_packet_
 Max number of samples that should ever be in a single packet. More...
 
ACE_UINT32 optimum_packet_size_
 Optimum size (in bytes) of a packet (packet header + sample(s)). More...
 
bool thread_per_connection_
 
long datalink_release_delay_
 
size_t datalink_control_chunks_
 
TimeDuration fragment_reassembly_timeout_
 
size_t receive_preallocated_message_blocks_
 
size_t receive_preallocated_data_blocks_
 

Static Public Attributes

static const long DEFAULT_DATALINK_RELEASE_DELAY = 10000
 
static const size_t DEFAULT_DATALINK_CONTROL_CHUNKS = 32u
 

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)
 
TransportImpl_rch get_or_create_impl ()
 
TransportImpl_rch get_impl ()
 
- Protected Member Functions inherited from OpenDDS::DCPS::RcObject
 RcObject ()
 

Protected Attributes

ACE_SYNCH_MUTEX lock_
 
bool shutting_down_
 

Private Member Functions

void adjust_config_value ()
 
void shutdown ()
 
virtual TransportImpl_rch new_impl ()=0
 

Private Attributes

const OPENDDS_STRING name_
 
TransportImpl_rch impl_
 
bool drop_messages_
 
double drop_messages_m_
 
double drop_messages_b_
 
bool count_messages_
 
ACE_Thread_Mutex config_lock_
 

Friends

class TransportRegistry
 
class TransportClient
 

Detailed Description

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 64 of file TransportInst.h.

Constructor & Destructor Documentation

◆ TransportInst()

ACE_INLINE OpenDDS::DCPS::TransportInst::TransportInst ( const char *  type,
const OPENDDS_STRING name 
)
protected

Definition at line 13 of file TransportInst.inl.

References ACE_INLINE, adjust_config_value(), and DBG_ENTRY_LVL.

15  : transport_type_(type)
27  , shutting_down_(false)
28  , name_(name)
29  , drop_messages_(false)
30  , drop_messages_m_(0)
31  , drop_messages_b_(0)
32  , count_messages_(false)
33 {
34  DBG_ENTRY_LVL("TransportInst", "TransportInst", 6);
36 }
const OPENDDS_STRING & name() const
Definition: TransportInst.h:70
const OPENDDS_STRING transport_type_
Definition: TransportInst.h:85
static const long DEFAULT_DATALINK_RELEASE_DELAY
Definition: TransportInst.h:67
const OPENDDS_STRING name_
static const size_t DEFAULT_DATALINK_CONTROL_CHUNKS
Definition: TransportInst.h:68
ACE_UINT32 max_packet_size_
Max size (in bytes) of a packet (packet header + sample(s))
Definition: TransportInst.h:96
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68
size_t max_samples_per_packet_
Max number of samples that should ever be in a single packet.
Definition: TransportInst.h:99
TimeDuration fragment_reassembly_timeout_
ACE_UINT32 optimum_packet_size_
Optimum size (in bytes) of a packet (packet header + sample(s)).

◆ ~TransportInst()

OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL OpenDDS::DCPS::TransportInst::~TransportInst ( )
protectedvirtual

Definition at line 35 of file TransportInst.cpp.

References DBG_ENTRY_LVL.

36 {
37  DBG_ENTRY_LVL("TransportInst","~TransportInst",6);
38 }
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68

Member Function Documentation

◆ adjust_config_value()

ACE_INLINE void OpenDDS::DCPS::TransportInst::adjust_config_value ( )
private

Adjust the configuration values which gives warning on adjusted value.

Definition at line 40 of file TransportInst.inl.

References ACE_DEBUG, ACE_TEXT(), LM_NOTICE, max_samples_per_packet_, and OpenDDS::DCPS::MAX_SEND_BLOCKS.

Referenced by load(), and TransportInst().

41 {
42  // Ensure that the number of samples put into the packet does
43  // not exceed the allowed number of io vectors to be sent by the OS.
44  size_t old_value = max_samples_per_packet_;
45 
46  if ((2 * max_samples_per_packet_ + 1) > MAX_SEND_BLOCKS) {
48  ACE_DEBUG((LM_NOTICE,
49  ACE_TEXT("(%P|%t) NOTICE: \"max_samples_per_packet\" is adjusted from %u to %u\n"),
50  old_value, max_samples_per_packet_));
51  }
52 }
#define ACE_DEBUG(X)
ACE_TEXT("TCP_Factory")
size_t max_samples_per_packet_
Max number of samples that should ever be in a single packet.
Definition: TransportInst.h:99

◆ append_transport_statistics()

virtual void OpenDDS::DCPS::TransportInst::append_transport_statistics ( TransportStatisticsSequence )
inlinevirtual

Reimplemented in OpenDDS::DCPS::RtpsUdpInst.

Definition at line 219 of file TransportInst.h.

References OPENDDS_STRING.

Referenced by OpenDDS::RTPS::Sedp::append_transport_statistics().

219 {}

◆ count_messages() [1/2]

void OpenDDS::DCPS::TransportInst::count_messages ( bool  flag)
inline

Definition at line 207 of file TransportInst.h.

References ACE_GUARD.

208  {
210  count_messages_ = flag;
211  }
#define ACE_GUARD(MUTEX, OBJ, LOCK)
ACE_Thread_Mutex config_lock_

◆ count_messages() [2/2]

bool OpenDDS::DCPS::TransportInst::count_messages ( ) const
inline

Definition at line 213 of file TransportInst.h.

References ACE_GUARD_RETURN.

214  {
216  return count_messages_;
217  }
ACE_Thread_Mutex config_lock_
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)

◆ drop_messages()

void OpenDDS::DCPS::TransportInst::drop_messages ( bool  flag)
inline

The RtpsUdpSendStrategy can be configured to simulate a lossy connection by probabilistically not sending RTPS messages. This capability is enabled by setting the flag to true.

The coefficients m and b correspond to a linear model whose argument is the length of the RTPS message. The probablility of dropping the message is p = m * message_length + b. When sending a message, a random number is selected from [0.0, 1.0]. If the random number is less than the drop probability, the message is dropped.

The flag and coefficient can be changed dynamically.

Examples

m = 0 and b = .5 - the probability of dropping a message is .5 regardless of message length.

m = .001 and b = .2 - the probability of dropping a 200-byte message is .4. In this example, all messages longer than 800 bytes will be dropped.

Definition at line 177 of file TransportInst.h.

References ACE_GUARD.

178  {
180  drop_messages_ = flag;
181  }
#define ACE_GUARD(MUTEX, OBJ, LOCK)
ACE_Thread_Mutex config_lock_

◆ drop_messages_b()

void OpenDDS::DCPS::TransportInst::drop_messages_b ( double  b)
inline

The RtpsUdpSendStrategy can be configured to simulate a lossy connection by probabilistically not sending RTPS messages. This capability is enabled by setting the flag to true.

The coefficients m and b correspond to a linear model whose argument is the length of the RTPS message. The probablility of dropping the message is p = m * message_length + b. When sending a message, a random number is selected from [0.0, 1.0]. If the random number is less than the drop probability, the message is dropped.

The flag and coefficient can be changed dynamically.

Examples

m = 0 and b = .5 - the probability of dropping a message is .5 regardless of message length.

m = .001 and b = .2 - the probability of dropping a 200-byte message is .4. In this example, all messages longer than 800 bytes will be dropped.

Definition at line 189 of file TransportInst.h.

References ACE_GUARD.

190  {
192  drop_messages_b_ = b;
193  }
#define ACE_GUARD(MUTEX, OBJ, LOCK)
ACE_Thread_Mutex config_lock_

◆ drop_messages_m()

void OpenDDS::DCPS::TransportInst::drop_messages_m ( double  m)
inline

The RtpsUdpSendStrategy can be configured to simulate a lossy connection by probabilistically not sending RTPS messages. This capability is enabled by setting the flag to true.

The coefficients m and b correspond to a linear model whose argument is the length of the RTPS message. The probablility of dropping the message is p = m * message_length + b. When sending a message, a random number is selected from [0.0, 1.0]. If the random number is less than the drop probability, the message is dropped.

The flag and coefficient can be changed dynamically.

Examples

m = 0 and b = .5 - the probability of dropping a message is .5 regardless of message length.

m = .001 and b = .2 - the probability of dropping a 200-byte message is .4. In this example, all messages longer than 800 bytes will be dropped.

Definition at line 183 of file TransportInst.h.

References ACE_GUARD.

184  {
186  drop_messages_m_ = m;
187  }
#define ACE_GUARD(MUTEX, OBJ, LOCK)
ACE_Thread_Mutex config_lock_

◆ dump()

void OpenDDS::DCPS::TransportInst::dump ( void  ) const

Diagnostic aid.

Definition at line 74 of file TransportInst.cpp.

References ACE_DEBUG, ACE_TEXT(), dump_to_str(), LM_DEBUG, and OPENDDS_STRING.

75 {
76  ACE_DEBUG((LM_DEBUG,
77  ACE_TEXT("\n(%P|%t) TransportInst::dump() -\n%C"),
78  dump_to_str().c_str()));
79 }
#define ACE_DEBUG(X)
virtual OPENDDS_STRING dump_to_str() const
ACE_TEXT("TCP_Factory")

◆ dump_to_str()

OPENDDS_STRING OpenDDS::DCPS::TransportInst::dump_to_str ( ) const
virtual

Reimplemented in OpenDDS::DCPS::MulticastInst, OpenDDS::DCPS::RtpsUdpInst, OpenDDS::DCPS::TcpInst, OpenDDS::DCPS::UdpInst, and OpenDDS::DCPS::ShmemInst.

Definition at line 101 of file TransportInst.cpp.

References datalink_control_chunks_, datalink_release_delay_, formatNameForDump(), fragment_reassembly_timeout_, max_packet_size_, max_samples_per_packet_, name_, OPENDDS_STRING, optimum_packet_size_, queue_initial_pools_, queue_messages_per_pool_, receive_preallocated_data_blocks_, receive_preallocated_message_blocks_, OpenDDS::DCPS::TimeDuration::str(), thread_per_connection_, OpenDDS::DCPS::to_dds_string(), and transport_type_.

Referenced by dump(), OpenDDS::DCPS::ShmemInst::dump_to_str(), OpenDDS::DCPS::UdpInst::dump_to_str(), OpenDDS::DCPS::TcpInst::dump_to_str(), OpenDDS::DCPS::RtpsUdpInst::dump_to_str(), OpenDDS::DCPS::MulticastInst::dump_to_str(), and OpenDDS::DCPS::TransportImpl::dump_to_str().

102 {
103  OPENDDS_STRING ret;
104  ret += formatNameForDump("transport_type") + transport_type_ + '\n';
105  ret += formatNameForDump("name") + name_ + '\n';
106  ret += formatNameForDump("queue_messages_per_pool") + to_dds_string(unsigned(queue_messages_per_pool_)) + '\n';
107  ret += formatNameForDump("queue_initial_pools") + to_dds_string(unsigned(queue_initial_pools_)) + '\n';
108  ret += formatNameForDump("max_packet_size") + to_dds_string(unsigned(max_packet_size_)) + '\n';
109  ret += formatNameForDump("max_samples_per_packet") + to_dds_string(unsigned(max_samples_per_packet_)) + '\n';
110  ret += formatNameForDump("optimum_packet_size") + to_dds_string(unsigned(optimum_packet_size_)) + '\n';
111  ret += formatNameForDump("thread_per_connection") + (thread_per_connection_ ? "true" : "false") + '\n';
112  ret += formatNameForDump("datalink_release_delay") + to_dds_string(datalink_release_delay_) + '\n';
113  ret += formatNameForDump("datalink_control_chunks") + to_dds_string(unsigned(datalink_control_chunks_)) + '\n';
114  ret += formatNameForDump("fragment_reassembly_timeout") + fragment_reassembly_timeout_.str() + '\n';
115  ret += formatNameForDump("receive_preallocated_message_blocks") + to_dds_string(unsigned(receive_preallocated_message_blocks_)) + '\n';
116  ret += formatNameForDump("receive_preallocated_data_blocks") + to_dds_string(unsigned(receive_preallocated_data_blocks_)) + '\n';
117  return ret;
118 }
const OPENDDS_STRING transport_type_
Definition: TransportInst.h:85
#define OPENDDS_STRING
const OPENDDS_STRING name_
String str(unsigned decimal_places=3, bool just_sec=false) const
ACE_UINT32 max_packet_size_
Max size (in bytes) of a packet (packet header + sample(s))
Definition: TransportInst.h:96
size_t max_samples_per_packet_
Max number of samples that should ever be in a single packet.
Definition: TransportInst.h:99
TimeDuration fragment_reassembly_timeout_
static OPENDDS_STRING formatNameForDump(const char *name)
ACE_UINT32 optimum_packet_size_
Optimum size (in bytes) of a packet (packet header + sample(s)).
String to_dds_string(unsigned short to_convert)

◆ event_dispatcher()

OpenDDS::DCPS::EventDispatcher_rch OpenDDS::DCPS::TransportInst::event_dispatcher ( )

Definition at line 223 of file TransportInst.cpp.

References OpenDDS::DCPS::TransportImpl::event_dispatcher(), and get_or_create_impl().

Referenced by OpenDDS::RTPS::Sedp::init().

224 {
225  const TransportImpl_rch temp = get_or_create_impl();
226  return temp ? temp->event_dispatcher() : EventDispatcher_rch();
227 }
RcHandle< TransportImpl > TransportImpl_rch
The type definition for the smart-pointer to the underlying type.
TransportImpl_rch get_or_create_impl()
RcHandle< EventDispatcher > EventDispatcher_rch

◆ formatNameForDump()

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 87 of file TransportInst.cpp.

References name(), and OPENDDS_STRING.

Referenced by OpenDDS::DCPS::ShmemInst::dump_to_str(), OpenDDS::DCPS::UdpInst::dump_to_str(), OpenDDS::DCPS::TcpInst::dump_to_str(), OpenDDS::DCPS::RtpsUdpInst::dump_to_str(), dump_to_str(), and OpenDDS::DCPS::MulticastInst::dump_to_str().

88 {
89  OPENDDS_STRING formatted_name;
90  formatted_name.reserve(NAME_INDENT + NAME_WIDTH);
91  formatted_name += OPENDDS_STRING(NAME_INDENT, ' ');
92  formatted_name += name;
93  formatted_name += ":";
94  if ((NAME_WIDTH + NAME_INDENT) > formatted_name.length()) {
95  formatted_name += OPENDDS_STRING((NAME_WIDTH + NAME_INDENT- formatted_name.length()), ' ');
96  }
97  return formatted_name;
98 }
const OPENDDS_STRING & name() const
Definition: TransportInst.h:70
#define OPENDDS_STRING

◆ get_ice_endpoint()

OpenDDS::DCPS::WeakRcHandle< OpenDDS::ICE::Endpoint > OpenDDS::DCPS::TransportInst::get_ice_endpoint ( )

◆ get_impl()

OpenDDS::DCPS::TransportImpl_rch OpenDDS::DCPS::TransportInst::get_impl ( )
protected

Definition at line 149 of file TransportInst.cpp.

References ACE_GUARD_RETURN, ACE_SYNCH_MUTEX, impl_, and lock_.

Referenced by OpenDDS::DCPS::RtpsUdpInst::rtps_relay_address_change().

150 {
151  ACE_GUARD_RETURN(ACE_SYNCH_MUTEX, g, lock_, TransportImpl_rch());
152  return impl_;
153 }
RcHandle< TransportImpl > TransportImpl_rch
The type definition for the smart-pointer to the underlying type.
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)

◆ get_last_recv_locator()

virtual void OpenDDS::DCPS::TransportInst::get_last_recv_locator ( const GUID_t ,
TransportLocator  
)
inlinevirtual

Reimplemented in OpenDDS::DCPS::RtpsUdpInst.

Definition at line 145 of file TransportInst.h.

Referenced by OpenDDS::RTPS::Sedp::populate_origination_locator().

146  {}

◆ get_or_create_impl()

OpenDDS::DCPS::TransportImpl_rch OpenDDS::DCPS::TransportInst::get_or_create_impl ( )
protected

Definition at line 135 of file TransportInst.cpp.

References ACE_GUARD_RETURN, ACE_SYNCH_MUTEX, impl_, lock_, new_impl(), and shutting_down_.

Referenced by OpenDDS::DCPS::RtpsUdpInst::append_transport_statistics(), OpenDDS::DCPS::TransportClient::enable_transport_using_config(), event_dispatcher(), get_ice_endpoint(), OpenDDS::DCPS::RtpsUdpInst::get_last_recv_locator(), OpenDDS::DCPS::TransportClient::populate_connection_info(), reactor_task(), rtps_relay_only_now(), OpenDDS::DCPS::RtpsUdpInst::update_locators(), use_ice_now(), and use_rtps_relay_now().

136 {
137  ACE_GUARD_RETURN(ACE_SYNCH_MUTEX, g, lock_, TransportImpl_rch());
138  if (!impl_ && !shutting_down_) {
139  try {
140  impl_ = new_impl();
142  return TransportImpl_rch();
143  }
144  }
145  return impl_;
146 }
RcHandle< TransportImpl > TransportImpl_rch
The type definition for the smart-pointer to the underlying type.
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)
virtual TransportImpl_rch new_impl()=0

◆ is_reliable()

virtual bool OpenDDS::DCPS::TransportInst::is_reliable ( ) const
pure virtual

◆ load()

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::TcpInst, OpenDDS::DCPS::UdpInst, and OpenDDS::DCPS::ShmemInst.

Definition at line 41 of file TransportInst.cpp.

References ACE_DEBUG, ACE_TEXT(), adjust_config_value(), datalink_control_chunks_, datalink_release_delay_, fragment_reassembly_timeout_, GET_CONFIG_TIME_VALUE, 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_, receive_preallocated_data_blocks_, receive_preallocated_message_blocks_, and thread_per_connection_.

Referenced by OpenDDS::DCPS::TransportRegistry::create_new_transport_instance_for_participant(), OpenDDS::DCPS::ShmemInst::load(), OpenDDS::DCPS::UdpInst::load(), OpenDDS::DCPS::TcpInst::load(), OpenDDS::DCPS::RtpsUdpInst::load(), and OpenDDS::DCPS::MulticastInst::load().

43 {
44  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("queue_messages_per_pool"), queue_messages_per_pool_, size_t)
45  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("queue_initial_pools"), queue_initial_pools_, size_t)
46  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("max_packet_size"), max_packet_size_, ACE_UINT32)
47  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("max_samples_per_packet"), max_samples_per_packet_, size_t)
48  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("optimum_packet_size"), optimum_packet_size_, ACE_UINT32)
49  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("thread_per_connection"), thread_per_connection_, bool)
50  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("datalink_release_delay"), datalink_release_delay_, int)
51  GET_CONFIG_TIME_VALUE(cf, sect, ACE_TEXT("fragment_reassembly_timeout"), fragment_reassembly_timeout_);
52 
53  // Undocumented - this option is not in the Developer's Guide
54  // Controls the number of chunks in the allocators used by the datalink
55  // for control messages.
56  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("datalink_control_chunks"), datalink_control_chunks_, size_t)
57 
58  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("receive_preallocated_message_blocks"), receive_preallocated_message_blocks_, size_t)
59  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("receive_preallocated_data_blocks"), receive_preallocated_data_blocks_, size_t)
60 
61  ACE_TString stringvalue;
62  if (cf.get_string_value (sect, ACE_TEXT("passive_connect_duration"), stringvalue) == 0) {
63  ACE_DEBUG ((LM_WARNING,
64  ACE_TEXT ("(%P|%t) WARNING: passive_connect_duration option ")
65  ACE_TEXT ("is deprecated in the transport inst, must be ")
66  ACE_TEXT ("defined in transport config.\n")));
67  }
68 
70  return 0;
71 }
#define ACE_DEBUG(X)
virtual int get_string_value(const ACE_Configuration_Section_Key &key, const ACE_TCHAR *name, ACE_TString &value)
#define GET_CONFIG_VALUE(CF, SECT, KEY, VALUE, TYPE)
Definition: TransportDefs.h:45
ACE_UINT32 max_packet_size_
Max size (in bytes) of a packet (packet header + sample(s))
Definition: TransportInst.h:96
#define GET_CONFIG_TIME_VALUE(CF, SECT, KEY, VALUE)
ACE_TEXT("TCP_Factory")
size_t max_samples_per_packet_
Max number of samples that should ever be in a single packet.
Definition: TransportInst.h:99
TimeDuration fragment_reassembly_timeout_
ACE_UINT32 optimum_packet_size_
Optimum size (in bytes) of a packet (packet header + sample(s)).

◆ name()

const OPENDDS_STRING& OpenDDS::DCPS::TransportInst::name ( void  ) const
inline

◆ new_impl()

virtual TransportImpl_rch OpenDDS::DCPS::TransportInst::new_impl ( )
privatepure virtual

◆ populate_locator()

virtual size_t OpenDDS::DCPS::TransportInst::populate_locator ( OpenDDS::DCPS::TransportLocator trans_info,
ConnectionInfoFlags  flags 
) const
pure virtual

◆ reactor_task()

OpenDDS::DCPS::ReactorTask_rch OpenDDS::DCPS::TransportInst::reactor_task ( )

Definition at line 216 of file TransportInst.cpp.

References get_or_create_impl(), and OpenDDS::DCPS::TransportImpl::reactor_task().

Referenced by OpenDDS::RTPS::Sedp::init().

217 {
219  return temp ? temp->reactor_task() : OpenDDS::DCPS::ReactorTask_rch();
220 }
RcHandle< ReactorTask > ReactorTask_rch
The type definition for the smart-pointer to the underlying type.
ReactorTask_rch reactor_task()
TransportImpl_rch get_or_create_impl()

◆ requires_cdr_encapsulation()

virtual bool OpenDDS::DCPS::TransportInst::requires_cdr_encapsulation ( ) const
inlinevirtual

Does the transport require a CDR-encapsulated data payload?

Reimplemented in OpenDDS::DCPS::RtpsUdpInst.

Definition at line 132 of file TransportInst.h.

Referenced by OpenDDS::DCPS::TransportClient::enable_transport_using_config().

132 { return false; }

◆ rtps_relay_address_change()

virtual void OpenDDS::DCPS::TransportInst::rtps_relay_address_change ( )
inlinevirtual

Reimplemented in OpenDDS::DCPS::RtpsUdpInst.

Definition at line 148 of file TransportInst.h.

148 {}

◆ rtps_relay_only_now()

void OpenDDS::DCPS::TransportInst::rtps_relay_only_now ( bool  flag)

◆ set_port_in_addr_string()

void OpenDDS::DCPS::TransportInst::set_port_in_addr_string ( OPENDDS_STRING addr_str,
u_short  port_number 
)
protected

Definition at line 156 of file TransportInst.cpp.

References ACE_OS::snprintf().

157 {
158 #ifdef BUFSIZE
159 #undef BUFSIZE
160 #endif
161  const int BUFSIZE=1024;
162  char result[BUFSIZE];
163 
164  if (std::count(addr_str.begin(), addr_str.end(), ':') < 2) {
165  OPENDDS_STRING::size_type pos = addr_str.find_last_of(":");
166  ACE_OS::snprintf(result, BUFSIZE, "%.*s:%hu", static_cast<int>(pos), addr_str.c_str(), port_number);
167  }
168  else {
169  // this is the numeric form of ipv6 address because it has more than one ':'
170  if (addr_str[0] != '[') {
171  ACE_OS::snprintf(result, BUFSIZE, "[%s]:%hu", addr_str.c_str(), port_number);
172  }
173  else {
174  OPENDDS_STRING::size_type pos = addr_str.find_last_of("]");
175  ACE_OS::snprintf(result, BUFSIZE, "%.*s:%hu", static_cast<int>(pos+1), addr_str.c_str(), port_number);
176  }
177  }
178  addr_str = result;
179 }
int snprintf(char *buf, size_t maxlen, const char *format,...) ACE_GCC_FORMAT_ATTRIBUTE(printf

◆ should_drop() [1/2]

bool OpenDDS::DCPS::TransportInst::should_drop ( ssize_t  length) const

The RtpsUdpSendStrategy can be configured to simulate a lossy connection by probabilistically not sending RTPS messages. This capability is enabled by setting the flag to true.

The coefficients m and b correspond to a linear model whose argument is the length of the RTPS message. The probablility of dropping the message is p = m * message_length + b. When sending a message, a random number is selected from [0.0, 1.0]. If the random number is less than the drop probability, the message is dropped.

The flag and coefficient can be changed dynamically.

Examples

m = 0 and b = .5 - the probability of dropping a message is .5 regardless of message length.

m = .001 and b = .2 - the probability of dropping a 200-byte message is .4. In this example, all messages longer than 800 bytes will be dropped.

Definition at line 230 of file TransportInst.cpp.

References ACE_ERROR, ACE_GUARD_RETURN, config_lock_, drop_messages_, drop_messages_b_, drop_messages_m_, LM_ERROR, and OPENDDS_END_VERSIONED_NAMESPACE_DECL.

231 {
232 #ifdef OPENDDS_TESTING_FEATURES
234  return drop_messages_ && (OPENDDS_DRAND48() < (length * drop_messages_m_ + drop_messages_b_));
235 #else
236  ACE_UNUSED_ARG(length);
237  ACE_ERROR((LM_ERROR,
238  "(%P|%t) ERROR: TransportInst::should_drop: "
239  "caller not conditioned on OPENDDS_TESTING_FEATURES\n"));
240  return false;
241 #endif
242 }
#define ACE_ERROR(X)
ACE_Thread_Mutex config_lock_
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)

◆ should_drop() [2/2]

bool OpenDDS::DCPS::TransportInst::should_drop ( const iovec  iov[],
int  n,
ssize_t length 
) const
inline

The RtpsUdpSendStrategy can be configured to simulate a lossy connection by probabilistically not sending RTPS messages. This capability is enabled by setting the flag to true.

The coefficients m and b correspond to a linear model whose argument is the length of the RTPS message. The probablility of dropping the message is p = m * message_length + b. When sending a message, a random number is selected from [0.0, 1.0]. If the random number is less than the drop probability, the message is dropped.

The flag and coefficient can be changed dynamically.

Examples

m = 0 and b = .5 - the probability of dropping a message is .5 regardless of message length.

m = .001 and b = .2 - the probability of dropping a 200-byte message is .4. In this example, all messages longer than 800 bytes will be dropped.

Definition at line 197 of file TransportInst.h.

198  {
199  length = 0;
200  for (int i = 0; i < n; ++i) {
201  length += iov[i].iov_len;
202  }
203  return should_drop(length);
204  }
bool should_drop(ssize_t length) const

◆ shutdown()

void OpenDDS::DCPS::TransportInst::shutdown ( void  )
private

Definition at line 121 of file TransportInst.cpp.

References ACE_GUARD, ACE_SYNCH_MUTEX, impl_, lock_, OpenDDS::DCPS::TransportImpl::shutdown(), shutting_down_, and OpenDDS::DCPS::RcHandle< T >::swap().

Referenced by OpenDDS::DCPS::TransportRegistry::remove_inst().

122 {
123  TransportImpl_rch impl;
124  {
125  ACE_GUARD(ACE_SYNCH_MUTEX, g, lock_);
126  impl_.swap(impl);
127  shutting_down_ = true;
128  }
129  if (impl) {
130  impl->shutdown();
131  }
132 }
#define ACE_GUARD(MUTEX, OBJ, LOCK)
RcHandle< TransportImpl > TransportImpl_rch
The type definition for the smart-pointer to the underlying type.
void swap(RcHandle &rhs)
Definition: RcHandle_T.h:102

◆ update_locators()

virtual void OpenDDS::DCPS::TransportInst::update_locators ( const GUID_t ,
const TransportLocatorSeq  
)
inlinevirtual

Reimplemented in OpenDDS::DCPS::RtpsUdpInst.

Definition at line 142 of file TransportInst.h.

Referenced by OpenDDS::RTPS::Sedp::update_locators().

143  {}

◆ use_ice_now()

void OpenDDS::DCPS::TransportInst::use_ice_now ( bool  flag)

Definition at line 207 of file TransportInst.cpp.

References get_or_create_impl(), and OpenDDS::DCPS::TransportImpl::use_ice_now().

Referenced by OpenDDS::RTPS::Sedp::use_ice_now().

208 {
210  if (temp) {
211  temp->use_ice_now(flag);
212  }
213 }
virtual void use_ice_now(bool)
TransportImpl_rch get_or_create_impl()

◆ use_rtps_relay_now()

void OpenDDS::DCPS::TransportInst::use_rtps_relay_now ( bool  flag)

Definition at line 198 of file TransportInst.cpp.

References get_or_create_impl(), and OpenDDS::DCPS::TransportImpl::use_rtps_relay_now().

Referenced by OpenDDS::RTPS::Sedp::use_rtps_relay_now().

199 {
201  if (temp) {
202  temp->use_rtps_relay_now(flag);
203  }
204 }
TransportImpl_rch get_or_create_impl()
virtual void use_rtps_relay_now(bool)

Friends And Related Function Documentation

◆ TransportClient

friend class TransportClient
friend

Definition at line 242 of file TransportInst.h.

◆ TransportRegistry

friend class TransportRegistry
friend

Definition at line 239 of file TransportInst.h.

Member Data Documentation

◆ config_lock_

ACE_Thread_Mutex OpenDDS::DCPS::TransportInst::config_lock_
mutableprivate

Definition at line 259 of file TransportInst.h.

Referenced by should_drop().

◆ count_messages_

bool OpenDDS::DCPS::TransportInst::count_messages_
private

Definition at line 257 of file TransportInst.h.

◆ datalink_control_chunks_

size_t OpenDDS::DCPS::TransportInst::datalink_control_chunks_

The number of chunks used to size allocators for transport control samples. The default value is 32.

Definition at line 114 of file TransportInst.h.

Referenced by OpenDDS::DCPS::DataLink::DataLink(), dump_to_str(), and load().

◆ datalink_release_delay_

long OpenDDS::DCPS::TransportInst::datalink_release_delay_

Delay in milliseconds that the datalink should be released after all associations are removed. The default value is 10 seconds.

Definition at line 110 of file TransportInst.h.

Referenced by OpenDDS::DCPS::DataLink::DataLink(), dump_to_str(), TAO_DDS_DCPSInfo_i::init_transport(), and load().

◆ DEFAULT_DATALINK_CONTROL_CHUNKS

const size_t OpenDDS::DCPS::TransportInst::DEFAULT_DATALINK_CONTROL_CHUNKS = 32u
static

Definition at line 68 of file TransportInst.h.

Referenced by OpenDDS::DCPS::DataLink::DataLink().

◆ DEFAULT_DATALINK_RELEASE_DELAY

const long OpenDDS::DCPS::TransportInst::DEFAULT_DATALINK_RELEASE_DELAY = 10000
static

Definition at line 67 of file TransportInst.h.

Referenced by OpenDDS::DCPS::DataLink::DataLink().

◆ drop_messages_

bool OpenDDS::DCPS::TransportInst::drop_messages_
private

Definition at line 253 of file TransportInst.h.

Referenced by should_drop().

◆ drop_messages_b_

double OpenDDS::DCPS::TransportInst::drop_messages_b_
private

Definition at line 255 of file TransportInst.h.

Referenced by should_drop().

◆ drop_messages_m_

double OpenDDS::DCPS::TransportInst::drop_messages_m_
private

Definition at line 254 of file TransportInst.h.

Referenced by should_drop().

◆ fragment_reassembly_timeout_

TimeDuration OpenDDS::DCPS::TransportInst::fragment_reassembly_timeout_

Maximum time to store incoming fragments of incomplete data samples. The expiration time is relative to the last received fragment.

Definition at line 118 of file TransportInst.h.

Referenced by dump_to_str(), and load().

◆ impl_

TransportImpl_rch OpenDDS::DCPS::TransportInst::impl_
private

Definition at line 251 of file TransportInst.h.

Referenced by get_impl(), get_or_create_impl(), and shutdown().

◆ lock_

ACE_SYNCH_MUTEX OpenDDS::DCPS::TransportInst::lock_
mutableprotected

Definition at line 230 of file TransportInst.h.

Referenced by get_impl(), get_or_create_impl(), and shutdown().

◆ max_packet_size_

ACE_UINT32 OpenDDS::DCPS::TransportInst::max_packet_size_

Max size (in bytes) of a packet (packet header + sample(s))

Definition at line 96 of file TransportInst.h.

Referenced by dump_to_str(), load(), and OpenDDS::DCPS::TransportSendStrategy::TransportSendStrategy().

◆ max_samples_per_packet_

size_t OpenDDS::DCPS::TransportInst::max_samples_per_packet_

Max number of samples that should ever be in a single packet.

Definition at line 99 of file TransportInst.h.

Referenced by adjust_config_value(), dump_to_str(), load(), and OpenDDS::DCPS::TransportSendStrategy::TransportSendStrategy().

◆ name_

const OPENDDS_STRING OpenDDS::DCPS::TransportInst::name_
private

Definition at line 249 of file TransportInst.h.

Referenced by dump_to_str().

◆ optimum_packet_size_

ACE_UINT32 OpenDDS::DCPS::TransportInst::optimum_packet_size_

Optimum size (in bytes) of a packet (packet header + sample(s)).

Definition at line 102 of file TransportInst.h.

Referenced by dump_to_str(), load(), and OpenDDS::DCPS::TransportSendStrategy::TransportSendStrategy().

◆ queue_initial_pools_

size_t OpenDDS::DCPS::TransportInst::queue_initial_pools_

Initial number of pre-allocated pools of link (list) objects for the "send queue" of each DataLink.

Definition at line 93 of file TransportInst.h.

Referenced by dump_to_str(), and load().

◆ queue_messages_per_pool_

size_t OpenDDS::DCPS::TransportInst::queue_messages_per_pool_

Number of pre-created link (list) objects per pool for the "send queue" of each DataLink.

Definition at line 89 of file TransportInst.h.

Referenced by dump_to_str(), and load().

◆ receive_preallocated_data_blocks_

size_t OpenDDS::DCPS::TransportInst::receive_preallocated_data_blocks_

Preallocated chunks in allocator for data blocks and data buffers. Default (0) is to use built-in constants in TransportReceiveStrategy

Definition at line 126 of file TransportInst.h.

Referenced by dump_to_str(), and load().

◆ receive_preallocated_message_blocks_

size_t OpenDDS::DCPS::TransportInst::receive_preallocated_message_blocks_

Preallocated chunks in allocator for message blocks. Default (0) is to use built-in constants in TransportReceiveStrategy

Definition at line 122 of file TransportInst.h.

Referenced by dump_to_str(), and load().

◆ shutting_down_

bool OpenDDS::DCPS::TransportInst::shutting_down_
protected

Definition at line 231 of file TransportInst.h.

Referenced by get_or_create_impl(), and shutdown().

◆ thread_per_connection_

bool OpenDDS::DCPS::TransportInst::thread_per_connection_

Flag for whether a new thread is needed for connection to send without backpressure.

Definition at line 106 of file TransportInst.h.

Referenced by OpenDDS::DCPS::DataLink::DataLink(), dump_to_str(), and load().

◆ transport_type_

const OPENDDS_STRING OpenDDS::DCPS::TransportInst::transport_type_

Definition at line 85 of file TransportInst.h.

Referenced by dump_to_str().


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