UdpInst.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef DCPS_UDPINST_H
00009 #define DCPS_UDPINST_H
00010 
00011 #include "Udp_Export.h"
00012 #include "UdpTransport.h"
00013 
00014 #include "ace/INET_Addr.h"
00015 
00016 #include "dds/DCPS/transport/framework/TransportInst.h"
00017 #include "dds/DCPS/SafetyProfileStreams.h"
00018 
00019 namespace OpenDDS {
00020 namespace DCPS {
00021 
00022 class OpenDDS_Udp_Export UdpInst : public TransportInst {
00023 public:
00024   ACE_INT32 send_buffer_size_;
00025   ACE_INT32 rcv_buffer_size_;
00026 
00027   virtual int load(ACE_Configuration_Heap& cf,
00028                    ACE_Configuration_Section_Key& sect);
00029 
00030   /// Diagnostic aid.
00031   virtual OPENDDS_STRING dump_to_str();
00032 
00033   bool is_reliable() const { return false; }
00034 
00035   virtual size_t populate_locator(OpenDDS::DCPS::TransportLocator& trans_info) const;
00036 
00037   OPENDDS_STRING local_address_string() const { return local_address_config_str_; }
00038   ACE_INET_Addr local_address() const { return local_address_; }
00039   void local_address(const char* str)
00040   {
00041     local_address_config_str_ = str;
00042     local_address_.set(str);
00043   }
00044   void local_address(u_short port_number, const char* host_name)
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   }
00050   void local_address_set_port(u_short port_number) {
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   }
00056 
00057 private:
00058   friend class UdpType;
00059   friend class UdpDataLink;
00060   explicit UdpInst(const std::string& name);
00061 
00062   UdpTransport* new_impl(const TransportInst_rch& inst);
00063 
00064   /// The address from which to send/receive data.
00065   /// The default value is: none.
00066   ACE_INET_Addr local_address_;
00067   OPENDDS_STRING local_address_config_str_;
00068 };
00069 
00070 } // namespace DCPS
00071 } // namespace OpenDDS
00072 
00073 #endif  /* DCPS_UDPINST_H */

Generated on Fri Feb 12 20:05:28 2016 for OpenDDS by  doxygen 1.4.7