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 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00020 00021 namespace OpenDDS { 00022 namespace DCPS { 00023 00024 class OpenDDS_Udp_Export UdpInst : public TransportInst { 00025 public: 00026 ACE_INT32 send_buffer_size_; 00027 ACE_INT32 rcv_buffer_size_; 00028 00029 virtual int load(ACE_Configuration_Heap& cf, 00030 ACE_Configuration_Section_Key& sect); 00031 00032 /// Diagnostic aid. 00033 virtual OPENDDS_STRING dump_to_str() const; 00034 00035 bool is_reliable() const { return false; } 00036 00037 virtual size_t populate_locator(OpenDDS::DCPS::TransportLocator& trans_info) const; 00038 00039 OPENDDS_STRING local_address_string() const { return local_address_config_str_; } 00040 ACE_INET_Addr local_address() const { return local_address_; } 00041 void local_address(const char* str) 00042 { 00043 local_address_config_str_ = str; 00044 local_address_.set(str); 00045 } 00046 void local_address(u_short port_number, const char* host_name) 00047 { 00048 local_address_config_str_ = host_name; 00049 local_address_config_str_ += ":" + to_dds_string(port_number); 00050 local_address_.set(port_number, host_name); 00051 } 00052 void local_address_set_port(u_short port_number) { 00053 local_address_.set_port_number(port_number); 00054 set_port_in_addr_string(local_address_config_str_, port_number); 00055 } 00056 00057 private: 00058 friend class UdpType; 00059 friend class UdpDataLink; 00060 template <typename T, typename U> 00061 friend RcHandle<T> OpenDDS::DCPS::make_rch(U const&); 00062 explicit UdpInst(const std::string& name); 00063 00064 TransportImpl_rch new_impl(); 00065 00066 /// The address from which to send/receive data. 00067 /// The default value is: none. 00068 ACE_INET_Addr local_address_; 00069 OPENDDS_STRING local_address_config_str_; 00070 }; 00071 00072 } // namespace DCPS 00073 } // namespace OpenDDS 00074 00075 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00076 00077 #endif /* DCPS_UDPINST_H */