OpenDDS  Snapshot(2023/04/28-20:55)
DefaultNetworkConfigMonitor.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_DEFAULT_NETWORK_CONFIG_MONITOR_H
9 #define OPENDDS_DCPS_DEFAULT_NETWORK_CONFIG_MONITOR_H
10 
11 #include "ace/config.h"
12 
13 #include "NetworkConfigMonitor.h"
14 #include "dcps_export.h"
15 
17 
18 namespace OpenDDS {
19 namespace DCPS {
20 
22 public:
23  bool open()
24  {
25  const NetworkAddress sp_default = TheServiceParticipant->default_address();
26  if (sp_default != NetworkAddress()) {
27  set(NetworkInterfaceAddress("", true, sp_default));
28  return true;
29  }
30 
31  static const u_short port_zero = 0;
32  ACE_INET_Addr addr(port_zero, "0.0.0.0");
33  set(NetworkInterfaceAddress("", true, NetworkAddress(addr)));
34 #ifdef ACE_HAS_IPV6
35  ACE_INET_Addr addr2(port_zero, "::");
36  set(NetworkInterfaceAddress("", true, NetworkAddress(addr2)));
37 #endif
38 
39  return true;
40  }
41 
42  bool close() { return true; }
43 };
44 
45 } // DCPS
46 } // OpenDDS
47 
49 
50 #endif // OPENDDS_DCPS_DEFAULT_NETWORK_CONFIG_MONITOR_H
#define OpenDDS_Dcps_Export
Definition: dcps_export.h:24
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
#define TheServiceParticipant
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28