#include <RtpsUdpInst.h>
Definition at line 28 of file RtpsUdpInst.h.
OpenDDS::DCPS::RtpsUdpInst::RtpsUdpInst | ( | const OPENDDS_STRING & | name | ) | [explicit, private] |
Definition at line 25 of file RtpsUdpInst.cpp.
References defined(), and if().
00026 : TransportInst("rtps_udp", name) 00027 #if defined (ACE_DEFAULT_MAX_SOCKET_BUFSIZ) 00028 , send_buffer_size_(ACE_DEFAULT_MAX_SOCKET_BUFSIZ) 00029 , rcv_buffer_size_(ACE_DEFAULT_MAX_SOCKET_BUFSIZ) 00030 #else 00031 , send_buffer_size_(0) 00032 , rcv_buffer_size_(0) 00033 #endif 00034 , use_multicast_(true) 00035 , ttl_(1) 00036 , multicast_group_address_(7401, "239.255.0.2") 00037 , nak_depth_(32) // default nak_depth in OpenDDS_Multicast 00038 , nak_response_delay_(0, 200*1000 /*microseconds*/) // default from RTPS 00039 , heartbeat_period_(1) // no default in RTPS spec 00040 , heartbeat_response_delay_(0, 500*1000 /*microseconds*/) // default from RTPS 00041 , handshake_timeout_(30) // default syn_timeout in OpenDDS_Multicast 00042 , durable_data_timeout_(60) 00043 , opendds_discovery_guid_(GUID_UNKNOWN) 00044 { 00045 }
OPENDDS_STRING OpenDDS::DCPS::RtpsUdpInst::dump_to_str | ( | ) | const [virtual] |
Diagnostic aid.
Reimplemented from OpenDDS::DCPS::TransportInst.
Definition at line 103 of file RtpsUdpInst.cpp.
References OpenDDS::DCPS::TransportInst::formatNameForDump(), ACE_INET_Addr::get_host_addr(), ACE_INET_Addr::get_port_number(), handshake_timeout_, heartbeat_period_, heartbeat_response_delay_, local_address(), ACE_Time_Value::msec(), multicast_group_address_, multicast_interface_, nak_depth_, nak_response_delay_, OPENDDS_STRING, OpenDDS::DCPS::to_dds_string(), and use_multicast_.
00104 { 00105 OPENDDS_STRING ret; 00106 // ACE_INET_Addr uses a static buffer for get_host_addr() so we can't 00107 // directly call it on both local_address_ and multicast_group_address_, 00108 // since the second call could overwrite the result of the first before the 00109 // OPENDDS_STRING gets a chance to see it. 00110 OPENDDS_STRING local; 00111 OPENDDS_STRING multi; 00112 const char* loc = local_address().get_host_addr(); 00113 if (loc) { 00114 local = loc; 00115 } else { 00116 local = "NOT_SUPPORTED"; 00117 } 00118 const char* mul = multicast_group_address_.get_host_addr(); 00119 if (mul) { 00120 multi = mul; 00121 } else { 00122 multi = "NOT_SUPPORTED"; 00123 } 00124 ret += TransportInst::dump_to_str(); 00125 ret += formatNameForDump("local_address") + local; 00126 ret += ':' + to_dds_string(local_address().get_port_number()) + '\n'; 00127 ret += formatNameForDump("use_multicast") + (use_multicast_ ? "true" : "false") + '\n'; 00128 ret += formatNameForDump("multicast_group_address") + multi 00129 + ':' + to_dds_string(multicast_group_address_.get_port_number()) + '\n'; 00130 ret += formatNameForDump("multicast_interface") + multicast_interface_ + '\n'; 00131 ret += formatNameForDump("nak_depth") + to_dds_string(unsigned(nak_depth_)) + '\n'; 00132 ret += formatNameForDump("nak_response_delay") + to_dds_string(nak_response_delay_.msec()) + '\n'; 00133 ret += formatNameForDump("heartbeat_period") + to_dds_string(heartbeat_period_.msec()) + '\n'; 00134 ret += formatNameForDump("heartbeat_response_delay") + to_dds_string(heartbeat_response_delay_.msec()) + '\n'; 00135 ret += formatNameForDump("handshake_timeout") + to_dds_string(handshake_timeout_.msec()) + '\n'; 00136 return ret; 00137 }
const TransportBLOB * OpenDDS::DCPS::RtpsUdpInst::get_blob | ( | const OpenDDS::DCPS::TransportLocatorSeq & | trans_info | ) | const |
Definition at line 191 of file RtpsUdpInst.cpp.
Referenced by OpenDDS::DCPS::RtpsUdpTransport::register_for_reader(), and OpenDDS::DCPS::RtpsUdpTransport::register_for_writer().
00192 { 00193 for (CORBA::ULong idx = 0, limit = trans_info.length(); idx != limit; ++idx) { 00194 if (std::strcmp(trans_info[idx].transport_type, "rtps_udp") == 0) { 00195 return &trans_info[idx].data; 00196 } 00197 } 00198 00199 return 0; 00200 }
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 48 of file RtpsUdpInst.h.
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 54 of file RtpsUdpInst.cpp.
References ACE_TEXT(), ACE_TEXT_ALWAYS_CHAR, ACE_String_Base< ACE_CHAR_T >::c_str(), GET_CONFIG_STRING_VALUE, GET_CONFIG_TIME_VALUE, GET_CONFIG_TSTRING_VALUE, GET_CONFIG_VALUE, handshake_timeout_, heartbeat_period_, heartbeat_response_delay_, ACE_String_Base< ACE_CHAR_T >::is_empty(), local_address(), multicast_group_address_, multicast_interface_, nak_depth_, nak_response_delay_, ACE_String_Base_Const::npos, rcv_buffer_size_, ACE_String_Base< ACE_CHAR_T >::rfind(), send_buffer_size_, ACE_INET_Addr::set(), ttl_, and use_multicast_.
00056 { 00057 TransportInst::load(cf, sect); // delegate to parent 00058 00059 ACE_TString local_address_s; 00060 GET_CONFIG_TSTRING_VALUE(cf, sect, ACE_TEXT("local_address"), 00061 local_address_s); 00062 if (!local_address_s.is_empty()) { 00063 local_address(ACE_TEXT_ALWAYS_CHAR(local_address_s.c_str())); 00064 } 00065 00066 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("send_buffer_size"), this->send_buffer_size_, ACE_UINT32); 00067 00068 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("rcv_buffer_size"), this->rcv_buffer_size_, ACE_UINT32); 00069 00070 00071 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("use_multicast"), use_multicast_, bool); 00072 00073 ACE_TString group_address_s; 00074 GET_CONFIG_TSTRING_VALUE(cf, sect, ACE_TEXT("multicast_group_address"), 00075 group_address_s); 00076 if (!group_address_s.is_empty()) { 00077 if (group_address_s.rfind(':') == group_address_s.npos) { 00078 // Concatenate a port number if the user does not supply one. 00079 group_address_s += ACE_TEXT(":7401"); 00080 } 00081 multicast_group_address_.set(group_address_s.c_str()); 00082 } 00083 00084 GET_CONFIG_STRING_VALUE(cf, sect, ACE_TEXT("multicast_interface"), 00085 multicast_interface_); 00086 00087 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("nak_depth"), nak_depth_, size_t); 00088 00089 GET_CONFIG_VALUE(cf, sect, ACE_TEXT("ttl"), ttl_, unsigned char); 00090 00091 GET_CONFIG_TIME_VALUE(cf, sect, ACE_TEXT("nak_response_delay"), 00092 nak_response_delay_); 00093 GET_CONFIG_TIME_VALUE(cf, sect, ACE_TEXT("heartbeat_period"), 00094 heartbeat_period_); 00095 GET_CONFIG_TIME_VALUE(cf, sect, ACE_TEXT("heartbeat_response_delay"), 00096 heartbeat_response_delay_); 00097 GET_CONFIG_TIME_VALUE(cf, sect, ACE_TEXT("handshake_timeout"), 00098 handshake_timeout_); 00099 return 0; 00100 }
void OpenDDS::DCPS::RtpsUdpInst::local_address | ( | u_short | port_number, | |
const char * | host_name | |||
) | [inline] |
Definition at line 61 of file RtpsUdpInst.h.
References OpenDDS::DCPS::to_dds_string().
00062 { 00063 local_address_config_str_ = host_name; 00064 local_address_config_str_ += ":" + to_dds_string(port_number); 00065 local_address_.set(port_number, host_name); 00066 }
void OpenDDS::DCPS::RtpsUdpInst::local_address | ( | const char * | str | ) | [inline] |
Definition at line 56 of file RtpsUdpInst.h.
References ACE_INET_Addr::set().
00057 { 00058 local_address_config_str_ = str; 00059 local_address_.set(str); 00060 }
ACE_INET_Addr OpenDDS::DCPS::RtpsUdpInst::local_address | ( | ) | const [inline] |
Definition at line 55 of file RtpsUdpInst.h.
Referenced by OpenDDS::DCPS::RtpsUdpTransport::configure_i(), dump_to_str(), load(), and populate_locator().
00055 { return local_address_; }
void OpenDDS::DCPS::RtpsUdpInst::local_address_set_port | ( | u_short | port_number | ) | [inline] |
Definition at line 67 of file RtpsUdpInst.h.
Referenced by OpenDDS::DCPS::RtpsUdpTransport::configure_i().
00067 { 00068 local_address_.set_port_number(port_number); 00069 set_port_in_addr_string(local_address_config_str_, port_number); 00070 }
OPENDDS_STRING OpenDDS::DCPS::RtpsUdpInst::local_address_string | ( | ) | const [inline] |
Definition at line 54 of file RtpsUdpInst.h.
Referenced by populate_locator().
00054 { return local_address_config_str_; }
TransportImpl_rch OpenDDS::DCPS::RtpsUdpInst::new_impl | ( | ) | [private, virtual] |
Implements OpenDDS::DCPS::TransportInst.
Definition at line 48 of file RtpsUdpInst.cpp.
References OpenDDS::DCPS::ref().
00049 { 00050 return make_rch<RtpsUdpTransport>(ref(*this)); 00051 }
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 140 of file RtpsUdpInst.cpp.
References OpenDDS::RTPS::address_to_bytes(), OpenDDS::RTPS::address_to_kind(), OpenDDS::DCPS::TransportLocator::data, OpenDDS::DCPS::get_interface_addrs(), ACE_INET_Addr::get_port_number(), local_address(), local_address_string(), OpenDDS::RTPS::locators_to_blob(), multicast_group_address_, OpenDDS::DCPS::OPENDDS_VECTOR(), TheServiceParticipant, OpenDDS::DCPS::TransportLocator::transport_type, and use_multicast_.
Referenced by OpenDDS::DCPS::RtpsUdpTransport::connection_info_i().
00141 { 00142 using namespace OpenDDS::RTPS; 00143 00144 LocatorSeq locators; 00145 CORBA::ULong idx = 0; 00146 00147 // multicast first so it's preferred by remote peers 00148 if (this->use_multicast_ && this->multicast_group_address_ != ACE_INET_Addr()) { 00149 idx = locators.length(); 00150 locators.length(idx + 1); 00151 locators[idx].kind = address_to_kind(this->multicast_group_address_); 00152 locators[idx].port = this->multicast_group_address_.get_port_number(); 00153 RTPS::address_to_bytes(locators[idx].address, 00154 this->multicast_group_address_); 00155 } 00156 00157 //if local_address_string is empty, or only the port has been set 00158 //need to get interface addresses to populate into the locator 00159 if (this->local_address_string().empty() || 00160 this->local_address_string().rfind(':') == 0) { 00161 typedef OPENDDS_VECTOR(ACE_INET_Addr) AddrVector; 00162 AddrVector addrs; 00163 if (TheServiceParticipant->default_address ().empty ()) { 00164 get_interface_addrs(addrs); 00165 } else { 00166 addrs.push_back (ACE_INET_Addr (static_cast<u_short> (0), TheServiceParticipant->default_address ().c_str ())); 00167 } 00168 for (AddrVector::iterator adr_it = addrs.begin(); adr_it != addrs.end(); ++adr_it) { 00169 idx = locators.length(); 00170 locators.length(idx + 1); 00171 locators[idx].kind = address_to_kind(*adr_it); 00172 locators[idx].port = this->local_address().get_port_number(); 00173 RTPS::address_to_bytes(locators[idx].address, *adr_it); 00174 } 00175 } else { 00176 idx = locators.length(); 00177 locators.length(idx + 1); 00178 locators[idx].kind = address_to_kind(this->local_address()); 00179 locators[idx].port = this->local_address().get_port_number(); 00180 RTPS::address_to_bytes(locators[idx].address, 00181 this->local_address()); 00182 } 00183 00184 info.transport_type = "rtps_udp"; 00185 RTPS::locators_to_blob(locators, info.data); 00186 00187 return locators.length(); 00188 }
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 49 of file RtpsUdpInst.h.
RcHandle<T> OpenDDS::DCPS::make_rch | ( | U const & | ) | [friend] |
friend class RTPS::Sedp [friend] |
Definition at line 80 of file RtpsUdpInst.h.
friend class RtpsUdpTransport [friend] |
Definition at line 81 of file RtpsUdpInst.h.
friend class RtpsUdpType [friend] |
Definition at line 73 of file RtpsUdpInst.h.
Definition at line 39 of file RtpsUdpInst.h.
Referenced by OpenDDS::DCPS::RtpsUdpDataLink::send_heartbeats(), and OpenDDS::DCPS::RtpsUdpDataLink::send_heartbeats_manual().
Definition at line 39 of file RtpsUdpInst.h.
Referenced by dump_to_str(), and load().
Definition at line 39 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().
Definition at line 39 of file RtpsUdpInst.h.
Referenced by dump_to_str(), and load().
Definition at line 85 of file RtpsUdpInst.h.
OPENDDS_STRING OpenDDS::DCPS::RtpsUdpInst::local_address_config_str_ [private] |
Definition at line 86 of file RtpsUdpInst.h.
Definition at line 35 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 36 of file RtpsUdpInst.h.
Referenced by dump_to_str(), load(), and OpenDDS::DCPS::RtpsUdpDataLink::open().
Definition at line 38 of file RtpsUdpInst.h.
Referenced by dump_to_str(), and load().
Definition at line 39 of file RtpsUdpInst.h.
Referenced by dump_to_str(), and load().
TransportReceiveListener_rch OpenDDS::DCPS::RtpsUdpInst::opendds_discovery_default_listener_ [private] |
Definition at line 82 of file RtpsUdpInst.h.
Referenced by OpenDDS::DCPS::RtpsUdpTransport::configure_i().
Definition at line 83 of file RtpsUdpInst.h.
Referenced by OpenDDS::DCPS::RtpsUdpTransport::configure_i().
Definition at line 31 of file RtpsUdpInst.h.
Referenced by load(), and OpenDDS::DCPS::RtpsUdpDataLink::open().
Definition at line 30 of file RtpsUdpInst.h.
Referenced by load(), and OpenDDS::DCPS::RtpsUdpDataLink::open().
unsigned char OpenDDS::DCPS::RtpsUdpInst::ttl_ |
Definition at line 34 of file RtpsUdpInst.h.
Referenced by load(), and OpenDDS::DCPS::RtpsUdpDataLink::open().
Definition at line 33 of file RtpsUdpInst.h.
Referenced by dump_to_str(), OpenDDS::DCPS::RtpsUdpTransport::get_connection_addr(), load(), OpenDDS::DCPS::RtpsUdpDataLink::open(), populate_locator(), OpenDDS::DCPS::RtpsUdpReceiveStrategy::start_i(), and OpenDDS::DCPS::RtpsUdpReceiveStrategy::stop_i().