OpenDDS  Snapshot(2023/04/28-20:55)
UdpInst.h
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #ifndef OPENDDS_DCPS_TRANSPORT_UDP_UDPINST_H
9 #define OPENDDS_DCPS_TRANSPORT_UDP_UDPINST_H
10 
11 #include "Udp_Export.h"
12 #include "UdpTransport.h"
13 
14 #include <dds/DCPS/LogAddr.h>
17 
19 
20 namespace OpenDDS {
21 namespace DCPS {
22 
24 public:
25  ACE_INT32 send_buffer_size_;
26  ACE_INT32 rcv_buffer_size_;
27 
28  virtual int load(ACE_Configuration_Heap& cf,
30 
31  /// Diagnostic aid.
32  virtual OPENDDS_STRING dump_to_str() const;
33 
34  bool is_reliable() const { return false; }
35 
36  virtual size_t populate_locator(OpenDDS::DCPS::TransportLocator& trans_info, ConnectionInfoFlags flags) const;
37 
38  OPENDDS_STRING local_address_string() const { return local_address_config_str_; }
39  ACE_INET_Addr local_address() const { return local_address_; }
40  void local_address(const ACE_INET_Addr& addr)
41  {
42  local_address_ = addr;
43  local_address_config_str_ = LogAddr(addr).str();
44  }
45  void local_address(const char* str)
46  {
47  local_address_config_str_ = str;
48  local_address_ = choose_single_coherent_address(local_address_config_str_, false);
49  }
50  void local_address(u_short port_number, const char* host_name)
51  {
52  local_address_config_str_ = host_name;
53  local_address_config_str_ += ":" + to_dds_string(port_number);
54  local_address_ = choose_single_coherent_address(local_address_config_str_, false);
55  }
56  void local_address_set_port(u_short port_number) {
57  local_address_.set_port_number(port_number);
58  set_port_in_addr_string(local_address_config_str_, port_number);
59  }
60 
61 private:
62  friend class UdpType;
63  friend class UdpDataLink;
64  template <typename T, typename U>
65  friend RcHandle<T> OpenDDS::DCPS::make_rch(U const&);
66  explicit UdpInst(const std::string& name);
67 
68  TransportImpl_rch new_impl();
69 
70  /// The address from which to send/receive data.
71  /// The default value is: none.
74 };
75 
76 } // namespace DCPS
77 } // namespace OpenDDS
78 
80 
81 #endif /* DCPS_UDPINST_H */
static int load
ACE_INT32 send_buffer_size_
Definition: UdpInst.h:25
Base class to hold configuration settings for TransportImpls.
Definition: TransportInst.h:64
String to_dds_string(unsigned short to_convert)
RcHandle< T > make_rch()
Definition: RcHandle_T.h:256
void local_address_set_port(u_short port_number)
Definition: UdpInst.h:56
void local_address(u_short port_number, const char *host_name)
Definition: UdpInst.h:50
#define OPENDDS_STRING
bool is_reliable() const
Does the transport as configured support RELIABLE_RELIABILITY_QOS?
Definition: UdpInst.h:34
ACE_INET_Addr choose_single_coherent_address(const ACE_INET_Addr &address, bool prefer_loopback)
ACE_INET_Addr local_address_
Definition: UdpInst.h:72
ACE_INT32 rcv_buffer_size_
Definition: UdpInst.h:26
const char *const name
Definition: debug.cpp:60
OPENDDS_STRING local_address_string() const
Definition: UdpInst.h:38
const String & str() const
Definition: LogAddr.h:31
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
void local_address(const ACE_INET_Addr &addr)
Definition: UdpInst.h:40
#define OpenDDS_Udp_Export
Definition: Udp_Export.h:24
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
OPENDDS_STRING local_address_config_str_
Definition: UdpInst.h:73
void local_address(const char *str)
Definition: UdpInst.h:45
size_t ConnectionInfoFlags
ACE_INET_Addr local_address() const
Definition: UdpInst.h:39