OpenDDS::DCPS::UdpInst Class Reference

#include <UdpInst.h>

Inheritance diagram for OpenDDS::DCPS::UdpInst:

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

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?
virtual size_t populate_locator (OpenDDS::DCPS::TransportLocator &trans_info) const
 Populate a transport locator sequence. Return the number of "locators.".
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

ACE_INT32 send_buffer_size_
ACE_INT32 rcv_buffer_size_

Private Member Functions

 UdpInst (const std::string &name)
UdpTransportnew_impl (const TransportInst_rch &inst)

Private Attributes

ACE_INET_Addr local_address_
OPENDDS_STRING local_address_config_str_

Friends

class UdpType
class UdpDataLink

Detailed Description

Definition at line 22 of file UdpInst.h.


Constructor & Destructor Documentation

OpenDDS::DCPS::UdpInst::UdpInst ( const std::string &  name  )  [explicit, private]

Definition at line 22 of file UdpInst.cpp.

00023   : TransportInst("udp", name),
00024 #if defined (ACE_DEFAULT_MAX_SOCKET_BUFSIZ)
00025     send_buffer_size_(ACE_DEFAULT_MAX_SOCKET_BUFSIZ),
00026     rcv_buffer_size_(ACE_DEFAULT_MAX_SOCKET_BUFSIZ)
00027 #else
00028     send_buffer_size_(0),
00029     rcv_buffer_size_(0)
00030 #endif
00031 {
00032 }


Member Function Documentation

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

Diagnostic aid.

Reimplemented from OpenDDS::DCPS::TransportInst.

Definition at line 59 of file UdpInst.cpp.

References OpenDDS::DCPS::TransportInst::dump_to_str(), OpenDDS::DCPS::TransportInst::formatNameForDump(), local_address(), OPENDDS_STRING, rcv_buffer_size_, and send_buffer_size_.

00060 {
00061   std::ostringstream os;
00062   os << TransportInst::dump_to_str() << std::endl;
00063 
00064   os << formatNameForDump("local_address") << this->local_address().get_host_addr()
00065                                            << ":" << this->local_address().get_port_number() << std::endl;
00066   os << formatNameForDump("send_buffer_size") << this->send_buffer_size_ << std::endl;
00067   os << formatNameForDump("rcv_buffer_size") << this->rcv_buffer_size_ << std::endl;
00068   return OPENDDS_STRING(os.str());
00069 }

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

Does the transport as configured support RELIABLE_RELIABILITY_QOS?

Implements OpenDDS::DCPS::TransportInst.

Definition at line 33 of file UdpInst.h.

00033 { return false; }

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

References GET_CONFIG_TSTRING_VALUE, GET_CONFIG_VALUE, load, and local_address().

00043 {
00044   TransportInst::load(cf, sect); // delegate to parent
00045 
00046   ACE_TString local_address_s;
00047   GET_CONFIG_TSTRING_VALUE(cf, sect, ACE_TEXT("local_address"),
00048                            local_address_s);
00049   this->local_address(ACE_TEXT_ALWAYS_CHAR(local_address_s.c_str()));
00050 
00051   GET_CONFIG_VALUE(cf, sect, ACE_TEXT("send_buffer_size"), this->send_buffer_size_, ACE_UINT32);
00052 
00053   GET_CONFIG_VALUE(cf, sect, ACE_TEXT("rcv_buffer_size"), this->rcv_buffer_size_, ACE_UINT32);
00054 
00055   return 0;
00056 }

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

Definition at line 44 of file UdpInst.h.

References OpenDDS::DCPS::to_dds_string().

00045   {
00046     local_address_config_str_ = host_name;
00047     local_address_config_str_ += ":" + to_dds_string(port_number);
00048     local_address_.set(port_number, host_name);
00049   }

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

Definition at line 39 of file UdpInst.h.

00040   {
00041     local_address_config_str_ = str;
00042     local_address_.set(str);
00043   }

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

Definition at line 38 of file UdpInst.h.

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

00038 { return local_address_; }

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

Definition at line 50 of file UdpInst.h.

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

Referenced by OpenDDS::DCPS::UdpDataLink::open().

00050                                                    {
00051     local_address_.set_port_number(port_number);
00052     size_t pos = local_address_config_str_.find_last_of(":");
00053     OPENDDS_STRING host_name = local_address_config_str_.substr(0, pos);
00054     local_address_config_str_ = host_name + ":" + to_dds_string(port_number);
00055   }

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

Definition at line 37 of file UdpInst.h.

00037 { return local_address_config_str_; }

UdpTransport * OpenDDS::DCPS::UdpInst::new_impl ( const TransportInst_rch inst  )  [private]

Definition at line 35 of file UdpInst.cpp.

00036 {
00037   return new UdpTransport(inst);
00038 }

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

References OpenDDS::DCPS::TransportLocator::data, and OpenDDS::DCPS::TransportLocator::transport_type.

00073 {
00074   if (this->local_address() != ACE_INET_Addr()) {
00075     NetworkAddress network_address;
00076     if (!this->local_address_string().empty()) {
00077       network_address = NetworkAddress(this->local_address_string());
00078     } else {
00079       network_address = NetworkAddress(this->local_address(), true);
00080     }
00081     ACE_OutputCDR cdr;
00082     cdr << network_address;
00083 
00084     const CORBA::ULong len = static_cast<CORBA::ULong>(cdr.total_length());
00085     char* buffer = const_cast<char*>(cdr.buffer()); // safe
00086 
00087     info.transport_type = "udp";
00088     info.data = TransportBLOB(len, len, reinterpret_cast<CORBA::Octet*>(buffer));
00089     return 1;
00090   } else {
00091     return 0;
00092   }
00093 }


Friends And Related Function Documentation

friend class UdpDataLink [friend]

Definition at line 59 of file UdpInst.h.

friend class UdpType [friend]

Definition at line 58 of file UdpInst.h.


Member Data Documentation

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

The address from which to send/receive data. The default value is: none.

Definition at line 66 of file UdpInst.h.

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

Definition at line 67 of file UdpInst.h.

ACE_INT32 OpenDDS::DCPS::UdpInst::rcv_buffer_size_

Definition at line 25 of file UdpInst.h.

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

ACE_INT32 OpenDDS::DCPS::UdpInst::send_buffer_size_

Definition at line 24 of file UdpInst.h.

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


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