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

#include <MulticastInst.h>

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

Public Member Functions

virtual int load (ACE_Configuration_Heap &cf, ACE_Configuration_Section_Key &sect)
 
virtual OPENDDS_STRING dump_to_str () const
 Diagnostic aid. More...
 
bool is_reliable () const
 Does the transport as configured support RELIABLE_RELIABILITY_QOS? More...
 
bool async_send () const
 
virtual size_t populate_locator (OpenDDS::DCPS::TransportLocator &trans_info, ConnectionInfoFlags flags) const
 Populate a transport locator sequence. Return the number of "locators.". More...
 
- Public Member Functions inherited from OpenDDS::DCPS::TransportInst
const OPENDDS_STRINGname () const
 
void dump () const
 Diagnostic aid. More...
 
virtual bool requires_cdr_encapsulation () const
 Does the transport require a CDR-encapsulated data payload? 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
 

Public Attributes

bool default_to_ipv6_
 
u_short port_offset_
 
ACE_INET_Addr group_address_
 
std::string local_address_
 
bool reliable_
 
double syn_backoff_
 
TimeDuration syn_interval_
 
TimeDuration syn_timeout_
 
size_t nak_depth_
 
TimeDuration nak_interval_
 
size_t nak_delay_intervals_
 
size_t nak_max_
 
TimeDuration nak_timeout_
 
unsigned char ttl_
 
size_t rcv_buffer_size_
 
bool async_send_
 
- Public Attributes inherited from OpenDDS::DCPS::TransportInst
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 size_t DEFAULT_NAK_DEPTH = 32u
 
static const long DEFAULT_NAK_INTERVAL = 500
 
static const long DEFAULT_NAK_DELAY_INTERVALS = 4
 
static const long DEFAULT_NAK_MAX = 3
 
static const long DEFAULT_NAK_TIMEOUT = 30000
 
- Static Public Attributes inherited from OpenDDS::DCPS::TransportInst
static const long DEFAULT_DATALINK_RELEASE_DELAY = 10000
 
static const size_t DEFAULT_DATALINK_CONTROL_CHUNKS = 32u
 

Private Member Functions

 MulticastInst (const std::string &name)
 
void default_group_address (ACE_INET_Addr &group_address)
 
TransportImpl_rch new_impl ()
 

Friends

class MulticastType
 
template<typename T , typename U >
RcHandle< T > OpenDDS::DCPS::make_rch (U const &)
 

Additional Inherited Members

- Static Public Member Functions inherited from OpenDDS::DCPS::TransportInst
static OPENDDS_STRING formatNameForDump (const char *name)
 
- Protected Member Functions inherited from OpenDDS::DCPS::TransportInst
 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 inherited from OpenDDS::DCPS::TransportInst
ACE_SYNCH_MUTEX lock_
 
bool shutting_down_
 

Detailed Description

Definition at line 26 of file MulticastInst.h.

Constructor & Destructor Documentation

◆ MulticastInst()

OpenDDS::DCPS::MulticastInst::MulticastInst ( const std::string &  name)
explicitprivate

Definition at line 46 of file MulticastInst.cpp.

References ACE_DEFAULT_MAX_SOCKET_BUFSIZ, default_group_address(), DEFAULT_NAK_INTERVAL, DEFAULT_NAK_TIMEOUT, OpenDDS::DCPS::TimeDuration::from_msec(), group_address_, if(), nak_interval_, nak_timeout_, syn_interval_, and syn_timeout_.

47  : TransportInst("multicast", name),
48  default_to_ipv6_(DEFAULT_TO_IPV6),
49  port_offset_(DEFAULT_PORT_OFFSET),
50  reliable_(DEFAULT_RELIABLE),
51  syn_backoff_(DEFAULT_SYN_BACKOFF),
55  ttl_(DEFAULT_TTL),
56 #if defined (ACE_DEFAULT_MAX_SOCKET_BUFSIZ)
57  rcv_buffer_size_(ACE_DEFAULT_MAX_SOCKET_BUFSIZ),
58 #else
59  // Use system default values.
61 #endif
62  async_send_(DEFAULT_ASYNC_SEND)
63 {
65 
66  syn_interval_ = TimeDuration::from_msec(DEFAULT_SYN_INTERVAL);
67  syn_timeout_ = TimeDuration::from_msec(DEFAULT_SYN_TIMEOUT);
68 
71 }
const OPENDDS_STRING & name() const
Definition: TransportInst.h:70
static const long DEFAULT_NAK_DELAY_INTERVALS
Definition: MulticastInst.h:32
static const long DEFAULT_NAK_TIMEOUT
Definition: MulticastInst.h:34
static const long DEFAULT_NAK_MAX
Definition: MulticastInst.h:33
TransportInst(const char *type, const OPENDDS_STRING &name)
static TimeDuration from_msec(const ACE_UINT64 &ms)
static const long DEFAULT_NAK_INTERVAL
Definition: MulticastInst.h:31
static const size_t DEFAULT_NAK_DEPTH
Definition: MulticastInst.h:30
void default_group_address(ACE_INET_Addr &group_address)

Member Function Documentation

◆ async_send()

bool OpenDDS::DCPS::MulticastInst::async_send ( ) const
inline

Definition at line 123 of file MulticastInst.h.

123 { return this->async_send_; }

◆ default_group_address()

void OpenDDS::DCPS::MulticastInst::default_group_address ( ACE_INET_Addr group_address)
private

Definition at line 133 of file MulticastInst.cpp.

References default_to_ipv6_, port_offset_, and ACE_INET_Addr::set().

Referenced by load(), and MulticastInst().

134 {
135  if (this->default_to_ipv6_) {
136  group_address.set(this->port_offset_, DEFAULT_IPV6_GROUP_ADDRESS);
137  } else {
138  group_address.set(this->port_offset_, DEFAULT_IPV4_GROUP_ADDRESS);
139  }
140 }
int set(const ACE_INET_Addr &)

◆ dump_to_str()

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

Diagnostic aid.

Reimplemented from OpenDDS::DCPS::TransportInst.

Definition at line 149 of file MulticastInst.cpp.

References async_send_, default_to_ipv6_, OpenDDS::DCPS::TransportInst::dump_to_str(), OpenDDS::DCPS::TransportInst::formatNameForDump(), group_address_, local_address_, nak_delay_intervals_, nak_depth_, nak_interval_, nak_max_, nak_timeout_, OPENDDS_STRING, port_offset_, rcv_buffer_size_, reliable_, OpenDDS::DCPS::LogAddr::str(), OpenDDS::DCPS::TimeDuration::str(), syn_backoff_, syn_interval_, syn_timeout_, and ttl_.

150 {
151  std::ostringstream os;
153 
154  os << formatNameForDump("group_address") << LogAddr(group_address_).str() << std::endl;
155  os << formatNameForDump("local_address") << this->local_address_ << std::endl;
156  os << formatNameForDump("default_to_ipv6") << (this->default_to_ipv6_ ? "true" : "false") << std::endl;
157  os << formatNameForDump("port_offset") << this->port_offset_ << std::endl;
158  os << formatNameForDump("reliable") << (this->reliable_ ? "true" : "false") << std::endl;
159  os << formatNameForDump("syn_backoff") << this->syn_backoff_ << std::endl;
160  os << formatNameForDump("syn_interval") << this->syn_interval_.str() << std::endl;
161  os << formatNameForDump("syn_timeout") << this->syn_timeout_.str() << std::endl;
162  os << formatNameForDump("nak_depth") << this->nak_depth_ << std::endl;
163  os << formatNameForDump("nak_interval") << this->nak_interval_.str() << std::endl;
164  os << formatNameForDump("nak_delay_intervals") << this->nak_delay_intervals_ << std::endl;
165  os << formatNameForDump("nak_max") << this->nak_max_ << std::endl;
166  os << formatNameForDump("nak_timeout") << this->nak_timeout_.str() << std::endl;
167  os << formatNameForDump("ttl") << int(this->ttl_) << std::endl;
168  os << formatNameForDump("rcv_buffer_size");
169 
170  if (this->rcv_buffer_size_ == 0) {
171  os << "System Default Value" << std::endl;
172  } else {
173  os << this->rcv_buffer_size_ << std::endl;
174  }
175 
176  os << formatNameForDump("async_send");
177 
178 #if defined (ACE_WIN32) && defined (ACE_HAS_WIN32_OVERLAPPED_IO)
179  os << (this->async_send_ ? "true" : "false") << std::endl;
180 #else
181  os << "Not Supported on this Platform" << std::endl;
182 #endif
183  return OPENDDS_STRING(os.str());
184 }
virtual OPENDDS_STRING dump_to_str() const
#define OPENDDS_STRING
String str(unsigned decimal_places=3, bool just_sec=false) const
static OPENDDS_STRING formatNameForDump(const char *name)

◆ is_reliable()

bool OpenDDS::DCPS::MulticastInst::is_reliable ( ) const
inlinevirtual

Does the transport as configured support RELIABLE_RELIABILITY_QOS?

Implements OpenDDS::DCPS::TransportInst.

Definition at line 121 of file MulticastInst.h.

Referenced by populate_locator().

121 { return this->reliable_; }

◆ load()

int OpenDDS::DCPS::MulticastInst::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 74 of file MulticastInst.cpp.

References ACE_TEXT(), async_send_, ACE_String_Base< char >::c_str(), default_group_address(), default_to_ipv6_, GET_CONFIG_STRING_VALUE, GET_CONFIG_TIME_VALUE, GET_CONFIG_TSTRING_VALUE, GET_CONFIG_VALUE, group_address_, ACE_String_Base< char >::is_empty(), OpenDDS::DCPS::TransportInst::load(), local_address_, nak_delay_intervals_, nak_depth_, nak_interval_, nak_max_, nak_timeout_, port_offset_, rcv_buffer_size_, reliable_, ACE_INET_Addr::set(), syn_backoff_, syn_interval_, syn_timeout_, and ttl_.

76 {
77  TransportInst::load(cf, sect); // delegate to parent
78 
79  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("default_to_ipv6"),
80  this->default_to_ipv6_, bool)
81 
82  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("port_offset"),
83  this->port_offset_, u_short)
84 
85  // Explicitly initialize this string to stop gcc 11 from issuing a warning.
86  ACE_TString group_address_s(ACE_TEXT(""));
87  GET_CONFIG_TSTRING_VALUE(cf, sect, ACE_TEXT("group_address"),
88  group_address_s)
89  if (group_address_s.is_empty()) {
90  // TODO: Passing 0 instead of transport id. Does this cause complications?
92  } else {
93  this->group_address_.set(group_address_s.c_str());
94  }
95 
96  GET_CONFIG_STRING_VALUE(cf, sect, ACE_TEXT("local_address"),
97  this->local_address_);
98 
99  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("reliable"), this->reliable_, bool)
100 
101  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("syn_backoff"),
102  this->syn_backoff_, double)
103 
104  GET_CONFIG_TIME_VALUE(cf, sect, ACE_TEXT("syn_interval"), this->syn_interval_)
105 
106  GET_CONFIG_TIME_VALUE(cf, sect, ACE_TEXT("syn_timeout"), this->syn_timeout_)
107 
108  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("nak_depth"),
109  this->nak_depth_, size_t)
110 
111  GET_CONFIG_TIME_VALUE(cf, sect, ACE_TEXT("nak_interval"), this->nak_interval_)
112 
113  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("nak_delay_intervals"),
114  this->nak_delay_intervals_, size_t)
115 
116  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("nak_max"), this->nak_max_, size_t)
117 
118  GET_CONFIG_TIME_VALUE(cf, sect, ACE_TEXT("nak_timeout"), this->nak_timeout_)
119 
120  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("ttl"), this->ttl_, unsigned char)
121 
122  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("rcv_buffer_size"),
123  this->rcv_buffer_size_, size_t)
124 
125 #if defined (ACE_WIN32) && defined (ACE_HAS_WIN32_OVERLAPPED_IO)
126  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("async_send"), this->async_send_, bool)
127 #endif
128 
129  return 0;
130 }
#define GET_CONFIG_STRING_VALUE(CF, SECT, KEY, VALUE)
Definition: TransportDefs.h:76
#define GET_CONFIG_VALUE(CF, SECT, KEY, VALUE, TYPE)
Definition: TransportDefs.h:45
#define GET_CONFIG_TSTRING_VALUE(CF, SECT, KEY, VALUE)
int set(const ACE_INET_Addr &)
#define GET_CONFIG_TIME_VALUE(CF, SECT, KEY, VALUE)
ACE_TEXT("TCP_Factory")
void default_group_address(ACE_INET_Addr &group_address)
virtual int load(ACE_Configuration_Heap &cf, ACE_Configuration_Section_Key &sect)

◆ new_impl()

TransportImpl_rch OpenDDS::DCPS::MulticastInst::new_impl ( )
privatevirtual

Implements OpenDDS::DCPS::TransportInst.

Definition at line 143 of file MulticastInst.cpp.

References OPENDDS_STRING, and OpenDDS::DCPS::rchandle_from().

144 {
145  return make_rch<MulticastTransport>(rchandle_from(this));
146 }
RcHandle< T > rchandle_from(T *pointer)
Definition: RcHandle_T.h:310

◆ populate_locator()

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

Populate a transport locator sequence. Return the number of "locators.".

Implements OpenDDS::DCPS::TransportInst.

Definition at line 187 of file MulticastInst.cpp.

References ACE_OutputCDR::buffer(), OpenDDS::DCPS::TransportLocator::data, group_address_, is_reliable(), OPENDDS_END_VERSIONED_NAMESPACE_DECL, ACE_OutputCDR::total_length(), and OpenDDS::DCPS::TransportLocator::transport_type.

188 {
189  if (group_address_ != ACE_INET_Addr()) {
190  NetworkResource network_resource(group_address_);
191 
192  ACE_OutputCDR cdr;
193  cdr << network_resource;
195 
196  const CORBA::ULong len = static_cast<CORBA::ULong>(cdr.total_length());
197  char* buffer = const_cast<char*>(cdr.buffer()); // safe
198 
199  info.transport_type = "multicast";
200  info.data = TransportBLOB(len, len, reinterpret_cast<CORBA::Octet*>(buffer));
201  return 1;
202  } else {
203  return 0;
204  }
205 }
size_t total_length(void) const
ACE_CDR::ULong ULong
const char * buffer(void) const
DDS::OctetSeq TransportBLOB
bool is_reliable() const
Does the transport as configured support RELIABLE_RELIABILITY_QOS?
bool Boolean

Friends And Related Function Documentation

◆ MulticastType

friend class MulticastType
friend

Definition at line 128 of file MulticastInst.h.

◆ OpenDDS::DCPS::make_rch

template<typename T , typename U >
RcHandle<T> OpenDDS::DCPS::make_rch ( U const &  )
friend

Member Data Documentation

◆ async_send_

bool OpenDDS::DCPS::MulticastInst::async_send_

Sending using asynchronous I/O on Windows platforms that support it. The default value is: false. This parameter has no effect on non-Windows platforms and Windows platforms that don't support asynchronous I/O.

Definition at line 113 of file MulticastInst.h.

Referenced by dump_to_str(), and load().

◆ DEFAULT_NAK_DELAY_INTERVALS

const long OpenDDS::DCPS::MulticastInst::DEFAULT_NAK_DELAY_INTERVALS = 4
static

Definition at line 32 of file MulticastInst.h.

Referenced by OpenDDS::DCPS::ReliableSession::send_naks().

◆ DEFAULT_NAK_DEPTH

const size_t OpenDDS::DCPS::MulticastInst::DEFAULT_NAK_DEPTH = 32u
static

Definition at line 30 of file MulticastInst.h.

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

◆ DEFAULT_NAK_INTERVAL

const long OpenDDS::DCPS::MulticastInst::DEFAULT_NAK_INTERVAL = 500
static

Definition at line 31 of file MulticastInst.h.

Referenced by MulticastInst(), and OpenDDS::DCPS::ReliableSession::nak_delay().

◆ DEFAULT_NAK_MAX

const long OpenDDS::DCPS::MulticastInst::DEFAULT_NAK_MAX = 3
static

Definition at line 33 of file MulticastInst.h.

Referenced by OpenDDS::DCPS::ReliableSession::send_naks().

◆ DEFAULT_NAK_TIMEOUT

const long OpenDDS::DCPS::MulticastInst::DEFAULT_NAK_TIMEOUT = 30000
static

Definition at line 34 of file MulticastInst.h.

Referenced by OpenDDS::DCPS::ReliableSession::expire_naks(), and MulticastInst().

◆ default_to_ipv6_

bool OpenDDS::DCPS::MulticastInst::default_to_ipv6_

Enables IPv6 default group address selection. The default value is: false.

Definition at line 38 of file MulticastInst.h.

Referenced by default_group_address(), dump_to_str(), and load().

◆ group_address_

ACE_INET_Addr OpenDDS::DCPS::MulticastInst::group_address_

The multicast group to join to send/receive data. The default value is: 224.0.0.128:<port> [IANA 2009-11-17], or [FF01::80]:<port> [IANA 2009-08-28]

Definition at line 48 of file MulticastInst.h.

Referenced by dump_to_str(), load(), MulticastInst(), and populate_locator().

◆ local_address_

std::string OpenDDS::DCPS::MulticastInst::local_address_

If non-empty, the address to pass to ACE which indicates the local network interface which should be used for joining the multicast group.

Definition at line 53 of file MulticastInst.h.

Referenced by dump_to_str(), and load().

◆ nak_delay_intervals_

size_t OpenDDS::DCPS::MulticastInst::nak_delay_intervals_

The number of interval's between nak's for a sample (after initial nak). The default value is: 4.

Definition at line 88 of file MulticastInst.h.

Referenced by dump_to_str(), and load().

◆ nak_depth_

size_t OpenDDS::DCPS::MulticastInst::nak_depth_

The number of datagrams to retain in order to service repair requests (reliable only). The default value is: 32.

Definition at line 78 of file MulticastInst.h.

Referenced by dump_to_str(), and load().

◆ nak_interval_

TimeDuration OpenDDS::DCPS::MulticastInst::nak_interval_

The minimum number of milliseconds to wait between repair requests (reliable only). The default value is: 500.

Definition at line 83 of file MulticastInst.h.

Referenced by dump_to_str(), load(), and MulticastInst().

◆ nak_max_

size_t OpenDDS::DCPS::MulticastInst::nak_max_

The maximum number of a missing sample will be nak'ed. The default value is: 3.

Definition at line 92 of file MulticastInst.h.

Referenced by dump_to_str(), and load().

◆ nak_timeout_

TimeDuration OpenDDS::DCPS::MulticastInst::nak_timeout_

The maximum number of milliseconds to wait before giving up on a repair response (reliable only). The default value is: 30000 (30 seconds).

Definition at line 97 of file MulticastInst.h.

Referenced by dump_to_str(), load(), and MulticastInst().

◆ port_offset_

u_short OpenDDS::DCPS::MulticastInst::port_offset_

The default port number (when group_address is not set) The default value is: 49152 [IANA 2009-11-16].

Definition at line 42 of file MulticastInst.h.

Referenced by default_group_address(), dump_to_str(), and load().

◆ rcv_buffer_size_

size_t OpenDDS::DCPS::MulticastInst::rcv_buffer_size_

The size of the socket receive buffer. The default value is: ACE_DEFAULT_MAX_SOCKET_BUFSIZ if it's defined, otherwise, 0. If the value is 0, the system default value is used.

Definition at line 107 of file MulticastInst.h.

Referenced by dump_to_str(), and load().

◆ reliable_

bool OpenDDS::DCPS::MulticastInst::reliable_

Enables reliable communication. This option will eventually be deprecated. The default value is: true.

Definition at line 58 of file MulticastInst.h.

Referenced by dump_to_str(), and load().

◆ syn_backoff_

double OpenDDS::DCPS::MulticastInst::syn_backoff_

The exponential base used during handshake retries; smaller values yield shorter delays between attempts. The default value is: 2.0.

Definition at line 63 of file MulticastInst.h.

Referenced by dump_to_str(), and load().

◆ syn_interval_

TimeDuration OpenDDS::DCPS::MulticastInst::syn_interval_

The minimum number of milliseconds to wait between handshake attempts during association. The default value is: 250.

Definition at line 68 of file MulticastInst.h.

Referenced by dump_to_str(), load(), and MulticastInst().

◆ syn_timeout_

TimeDuration OpenDDS::DCPS::MulticastInst::syn_timeout_

The maximum number of milliseconds to wait before giving up on a handshake response during association. The default value is: 30000 (30 seconds).

Definition at line 73 of file MulticastInst.h.

Referenced by dump_to_str(), load(), and MulticastInst().

◆ ttl_

unsigned char OpenDDS::DCPS::MulticastInst::ttl_

time-to-live. The default value is: 1 (in same subnet)

Definition at line 101 of file MulticastInst.h.

Referenced by dump_to_str(), and load().


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