OpenDDS::DCPS::RtpsUdpInst Class Reference

#include <RtpsUdpInst.h>

Inheritance diagram for OpenDDS::DCPS::RtpsUdpInst:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual int load (ACE_Configuration_Heap &cf, ACE_Configuration_Section_Key &sect)
virtual OPENDDS_STRING dump_to_str ()
 Diagnostic aid.
bool is_reliable () const
 Does the transport as configured support RELIABLE_RELIABILITY_QOS?
bool requires_cdr () const
 Does the transport require a CDR-encapsulated data payload?
virtual size_t populate_locator (OpenDDS::DCPS::TransportLocator &trans_info) const
 Populate a transport locator sequence. Return the number of "locators.".
const TransportBLOBget_blob (const OpenDDS::DCPS::TransportLocatorSeq &trans_info) const
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

bool use_multicast_
unsigned char ttl_
ACE_INET_Addr multicast_group_address_
OPENDDS_STRING multicast_interface_
size_t nak_depth_
ACE_Time_Value nak_response_delay_
ACE_Time_Value heartbeat_period_
ACE_Time_Value heartbeat_response_delay_
ACE_Time_Value handshake_timeout_
ACE_Time_Value durable_data_timeout_

Private Member Functions

 RtpsUdpInst (const OPENDDS_STRING &name)
TransportImplnew_impl (const TransportInst_rch &inst)

Private Attributes

TransportReceiveListeneropendds_discovery_default_listener_
RepoId opendds_discovery_guid_
ACE_INET_Addr local_address_
OPENDDS_STRING local_address_config_str_

Friends

class RtpsUdpType
class RTPS::Sedp
class RtpsUdpTransport

Detailed Description

Definition at line 25 of file RtpsUdpInst.h.


Constructor & Destructor Documentation

OpenDDS::DCPS::RtpsUdpInst::RtpsUdpInst ( const OPENDDS_STRING &  name  )  [explicit, private]

Definition at line 23 of file RtpsUdpInst.cpp.

00024   : TransportInst("rtps_udp", name)
00025   , use_multicast_(true)
00026   , ttl_(1)
00027   , multicast_group_address_(7401, "239.255.0.2")
00028   , nak_depth_(32) // default nak_depth in OpenDDS_Multicast
00029   , nak_response_delay_(0, 200*1000 /*microseconds*/) // default from RTPS
00030   , heartbeat_period_(1) // no default in RTPS spec
00031   , heartbeat_response_delay_(0, 500*1000 /*microseconds*/) // default from RTPS
00032   , handshake_timeout_(30) // default syn_timeout in OpenDDS_Multicast
00033   , durable_data_timeout_(60)
00034   , opendds_discovery_default_listener_(0)
00035   , opendds_discovery_guid_(GUID_UNKNOWN)
00036 {
00037 }


Member Function Documentation

OPENDDS_STRING OpenDDS::DCPS::RtpsUdpInst::dump_to_str (  )  [virtual]

Diagnostic aid.

Reimplemented from OpenDDS::DCPS::TransportInst.

Definition at line 90 of file RtpsUdpInst.cpp.

References OpenDDS::DCPS::TransportInst::dump_to_str(), OpenDDS::DCPS::TransportInst::formatNameForDump(), handshake_timeout_, heartbeat_period_, heartbeat_response_delay_, local_address(), multicast_group_address_, multicast_interface_, nak_depth_, nak_response_delay_, OPENDDS_STRING, OpenDDS::DCPS::to_dds_string(), and use_multicast_.

00091 {
00092   OPENDDS_STRING ret;
00093   // ACE_INET_Addr uses a static buffer for get_host_addr() so we can't
00094   // directly call it on both local_address_ and multicast_group_address_,
00095   // since the second call could overwrite the result of the first before the
00096   // OPENDDS_STRING gets a chance to see it.
00097   OPENDDS_STRING local;
00098   OPENDDS_STRING multi;
00099   const char* loc = local_address().get_host_addr();
00100   if (loc) {
00101     local = loc;
00102   } else {
00103     local = "NOT_SUPPORTED";
00104   }
00105   const char* mul = multicast_group_address_.get_host_addr();
00106   if (mul) {
00107     multi = mul;
00108   } else {
00109     multi = "NOT_SUPPORTED";
00110   }
00111   ret += TransportInst::dump_to_str();
00112   ret += formatNameForDump("local_address") + local;
00113   ret += ':' + to_dds_string(local_address().get_port_number()) + '\n';
00114   ret += formatNameForDump("use_multicast") + (use_multicast_ ? "true" : "false") + '\n';
00115   ret += formatNameForDump("multicast_group_address") + multi
00116       + ':' + to_dds_string(multicast_group_address_.get_port_number()) + '\n';
00117   ret += formatNameForDump("multicast_interface") + multicast_interface_ + '\n';
00118   ret += formatNameForDump("nak_depth") + to_dds_string(unsigned(nak_depth_)) + '\n';
00119   ret += formatNameForDump("nak_response_delay") + to_dds_string(nak_response_delay_.msec()) + '\n';
00120   ret += formatNameForDump("heartbeat_period") + to_dds_string(heartbeat_period_.msec()) + '\n';
00121   ret += formatNameForDump("heartbeat_response_delay") + to_dds_string(heartbeat_response_delay_.msec()) + '\n';
00122   ret += formatNameForDump("handshake_timeout") + to_dds_string(handshake_timeout_.msec()) + '\n';
00123   return ret;
00124 }

const TransportBLOB * OpenDDS::DCPS::RtpsUdpInst::get_blob ( const OpenDDS::DCPS::TransportLocatorSeq trans_info  )  const

Definition at line 178 of file RtpsUdpInst.cpp.

00179 {
00180   for (CORBA::ULong idx = 0, limit = trans_info.length(); idx != limit; ++idx) {
00181     if (std::strcmp(trans_info[idx].transport_type, "rtps_udp") == 0) {
00182       return &trans_info[idx].data;
00183     }
00184   }
00185 
00186   return 0;
00187 }

bool OpenDDS::DCPS::RtpsUdpInst::is_reliable (  )  const [inline, virtual]

Does the transport as configured support RELIABLE_RELIABILITY_QOS?

Implements OpenDDS::DCPS::TransportInst.

Definition at line 43 of file RtpsUdpInst.h.

00043 { return true; }

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

References GET_CONFIG_STRING_VALUE, GET_CONFIG_TIME_VALUE, GET_CONFIG_TSTRING_VALUE, GET_CONFIG_VALUE, handshake_timeout_, heartbeat_period_, heartbeat_response_delay_, load, local_address(), multicast_group_address_, multicast_interface_, nak_depth_, nak_response_delay_, ttl_, and use_multicast_.

00048 {
00049   TransportInst::load(cf, sect); // delegate to parent
00050 
00051   ACE_TString local_address_s;
00052   GET_CONFIG_TSTRING_VALUE(cf, sect, ACE_TEXT("local_address"),
00053                            local_address_s);
00054   if (!local_address_s.is_empty()) {
00055     local_address(ACE_TEXT_ALWAYS_CHAR(local_address_s.c_str()));
00056   }
00057 
00058   GET_CONFIG_VALUE(cf, sect, ACE_TEXT("use_multicast"), use_multicast_, bool);
00059 
00060   ACE_TString group_address_s;
00061   GET_CONFIG_TSTRING_VALUE(cf, sect, ACE_TEXT("multicast_group_address"),
00062                            group_address_s);
00063   if (!group_address_s.is_empty()) {
00064     if (group_address_s.rfind(':') == group_address_s.npos) {
00065       // Concatenate a port number if the user does not supply one.
00066       group_address_s += ACE_TEXT(":7401");
00067     }
00068     multicast_group_address_.set(group_address_s.c_str());
00069   }
00070 
00071   GET_CONFIG_STRING_VALUE(cf, sect, ACE_TEXT("multicast_interface"),
00072                           multicast_interface_);
00073 
00074   GET_CONFIG_VALUE(cf, sect, ACE_TEXT("nak_depth"), nak_depth_, size_t);
00075 
00076   GET_CONFIG_VALUE(cf, sect, ACE_TEXT("ttl"), ttl_, unsigned char);
00077 
00078   GET_CONFIG_TIME_VALUE(cf, sect, ACE_TEXT("nak_response_delay"),
00079                         nak_response_delay_);
00080   GET_CONFIG_TIME_VALUE(cf, sect, ACE_TEXT("heartbeat_period"),
00081                         heartbeat_period_);
00082   GET_CONFIG_TIME_VALUE(cf, sect, ACE_TEXT("heartbeat_response_delay"),
00083                         heartbeat_response_delay_);
00084   GET_CONFIG_TIME_VALUE(cf, sect, ACE_TEXT("handshake_timeout"),
00085                         handshake_timeout_);
00086   return 0;
00087 }

void OpenDDS::DCPS::RtpsUdpInst::local_address ( u_short  port_number,
const char *  host_name 
) [inline]

Definition at line 56 of file RtpsUdpInst.h.

References OpenDDS::DCPS::to_dds_string().

00057   {
00058     local_address_config_str_ = host_name;
00059     local_address_config_str_ += ":" + to_dds_string(port_number);
00060     local_address_.set(port_number, host_name);
00061   }

void OpenDDS::DCPS::RtpsUdpInst::local_address ( const char *  str  )  [inline]

Definition at line 51 of file RtpsUdpInst.h.

00052   {
00053     local_address_config_str_ = str;
00054     local_address_.set(str);
00055   }

ACE_INET_Addr OpenDDS::DCPS::RtpsUdpInst::local_address (  )  const [inline]

Definition at line 50 of file RtpsUdpInst.h.

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

00050 { return local_address_; }

void OpenDDS::DCPS::RtpsUdpInst::local_address_set_port ( u_short  port_number  )  [inline]

Definition at line 62 of file RtpsUdpInst.h.

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

00062                                                    {
00063     local_address_.set_port_number(port_number);
00064     size_t pos = local_address_config_str_.find_last_of(":");
00065     OPENDDS_STRING host_name = local_address_config_str_.substr(0, pos);
00066     local_address_config_str_ = host_name + ":" + to_dds_string(port_number);
00067   }

OPENDDS_STRING OpenDDS::DCPS::RtpsUdpInst::local_address_string (  )  const [inline]

Definition at line 49 of file RtpsUdpInst.h.

Referenced by populate_locator().

00049 { return local_address_config_str_; }

TransportImpl * OpenDDS::DCPS::RtpsUdpInst::new_impl ( const TransportInst_rch inst  )  [private]

Definition at line 40 of file RtpsUdpInst.cpp.

References RtpsUdpTransport.

00041 {
00042   return new RtpsUdpTransport(inst);
00043 }

size_t OpenDDS::DCPS::RtpsUdpInst::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 127 of file RtpsUdpInst.cpp.

References OpenDDS::RTPS::address_to_bytes(), OpenDDS::RTPS::address_to_kind(), OpenDDS::DCPS::TransportLocator::data, OpenDDS::DCPS::get_interface_addrs(), local_address(), local_address_string(), OpenDDS::RTPS::locators_to_blob(), multicast_group_address_, OpenDDS::DCPS::OPENDDS_VECTOR(), TheServiceParticipant, and OpenDDS::DCPS::TransportLocator::transport_type.

00128 {
00129   using namespace OpenDDS::RTPS;
00130 
00131   LocatorSeq locators;
00132   CORBA::ULong idx = 0;
00133 
00134   // multicast first so it's preferred by remote peers
00135   if (this->use_multicast_ && this->multicast_group_address_ != ACE_INET_Addr()) {
00136     idx = locators.length();
00137     locators.length(idx + 1);
00138     locators[idx].kind = address_to_kind(this->multicast_group_address_);
00139     locators[idx].port = this->multicast_group_address_.get_port_number();
00140     RTPS::address_to_bytes(locators[idx].address,
00141                            this->multicast_group_address_);
00142   }
00143 
00144   //if local_address_string is empty, or only the port has been set
00145   //need to get interface addresses to populate into the locator
00146   if (this->local_address_string().empty() ||
00147       this->local_address_string().rfind(':') == 0) {
00148     typedef OPENDDS_VECTOR(ACE_INET_Addr) AddrVector;
00149     AddrVector addrs;
00150     if (TheServiceParticipant->default_address ().empty ()) {
00151       get_interface_addrs(addrs);
00152     } else {
00153       addrs.push_back (ACE_INET_Addr (static_cast<u_short> (0), TheServiceParticipant->default_address ().c_str ()));
00154     }
00155     for (AddrVector::iterator adr_it = addrs.begin(); adr_it != addrs.end(); ++adr_it) {
00156       idx = locators.length();
00157       locators.length(idx + 1);
00158       locators[idx].kind = address_to_kind(*adr_it);
00159       locators[idx].port = this->local_address().get_port_number();
00160       RTPS::address_to_bytes(locators[idx].address, *adr_it);
00161     }
00162   } else {
00163     idx = locators.length();
00164     locators.length(idx + 1);
00165     locators[idx].kind = address_to_kind(this->local_address());
00166     locators[idx].port = this->local_address().get_port_number();
00167     RTPS::address_to_bytes(locators[idx].address,
00168                            this->local_address());
00169   }
00170 
00171   info.transport_type = "rtps_udp";
00172   RTPS::locators_to_blob(locators, info.data);
00173 
00174   return locators.length();
00175 }

bool OpenDDS::DCPS::RtpsUdpInst::requires_cdr (  )  const [inline, virtual]

Does the transport require a CDR-encapsulated data payload?

Reimplemented from OpenDDS::DCPS::TransportInst.

Definition at line 44 of file RtpsUdpInst.h.

00044 { return true; }


Friends And Related Function Documentation

friend class RTPS::Sedp [friend]

Definition at line 75 of file RtpsUdpInst.h.

friend class RtpsUdpTransport [friend]

Definition at line 76 of file RtpsUdpInst.h.

Referenced by new_impl().

friend class RtpsUdpType [friend]

Definition at line 70 of file RtpsUdpInst.h.


Member Data Documentation

ACE_Time_Value OpenDDS::DCPS::RtpsUdpInst::durable_data_timeout_

Definition at line 34 of file RtpsUdpInst.h.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::send_heartbeats(), and OpenDDS::DCPS::RtpsUdpDataLink::send_heartbeats_manual().

ACE_Time_Value OpenDDS::DCPS::RtpsUdpInst::handshake_timeout_

Definition at line 34 of file RtpsUdpInst.h.

Referenced by dump_to_str(), and load().

ACE_Time_Value OpenDDS::DCPS::RtpsUdpInst::heartbeat_period_

Definition at line 34 of file RtpsUdpInst.h.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::check_heartbeats(), dump_to_str(), OpenDDS::DCPS::RtpsUdpDataLink::HeartBeat::enable(), load(), and OpenDDS::DCPS::RtpsUdpDataLink::send_heartbeats().

ACE_Time_Value OpenDDS::DCPS::RtpsUdpInst::heartbeat_response_delay_

Definition at line 34 of file RtpsUdpInst.h.

Referenced by dump_to_str(), and load().

ACE_INET_Addr OpenDDS::DCPS::RtpsUdpInst::local_address_ [private]

Definition at line 80 of file RtpsUdpInst.h.

OPENDDS_STRING OpenDDS::DCPS::RtpsUdpInst::local_address_config_str_ [private]

Definition at line 81 of file RtpsUdpInst.h.

ACE_INET_Addr OpenDDS::DCPS::RtpsUdpInst::multicast_group_address_

Definition at line 30 of file RtpsUdpInst.h.

Referenced by dump_to_str(), load(), OpenDDS::DCPS::RtpsUdpDataLink::open(), and populate_locator().

OPENDDS_STRING OpenDDS::DCPS::RtpsUdpInst::multicast_interface_

Definition at line 31 of file RtpsUdpInst.h.

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

size_t OpenDDS::DCPS::RtpsUdpInst::nak_depth_

Definition at line 33 of file RtpsUdpInst.h.

Referenced by dump_to_str(), and load().

ACE_Time_Value OpenDDS::DCPS::RtpsUdpInst::nak_response_delay_

Definition at line 34 of file RtpsUdpInst.h.

Referenced by dump_to_str(), and load().

TransportReceiveListener* OpenDDS::DCPS::RtpsUdpInst::opendds_discovery_default_listener_ [private]

Definition at line 77 of file RtpsUdpInst.h.

RepoId OpenDDS::DCPS::RtpsUdpInst::opendds_discovery_guid_ [private]

Definition at line 78 of file RtpsUdpInst.h.

unsigned char OpenDDS::DCPS::RtpsUdpInst::ttl_

Definition at line 29 of file RtpsUdpInst.h.

Referenced by load(), and OpenDDS::DCPS::RtpsUdpDataLink::open().

bool OpenDDS::DCPS::RtpsUdpInst::use_multicast_

Definition at line 28 of file RtpsUdpInst.h.

Referenced by dump_to_str(), load(), OpenDDS::DCPS::RtpsUdpDataLink::open(), OpenDDS::DCPS::RtpsUdpReceiveStrategy::start_i(), and OpenDDS::DCPS::RtpsUdpReceiveStrategy::stop_i().


The documentation for this class was generated from the following files:
Generated on Fri Feb 12 20:06:36 2016 for OpenDDS by  doxygen 1.4.7