OpenDDS  Snapshot(2023/04/07-19:43)
Public Member Functions | Public Attributes | List of all members
OpenDDS::DCPS::NetworkInterfaceAddress Struct Reference

#include <NetworkConfigMonitor.h>

Collaboration diagram for OpenDDS::DCPS::NetworkInterfaceAddress:
Collaboration graph
[legend]

Public Member Functions

 NetworkInterfaceAddress ()
 
 NetworkInterfaceAddress (const OPENDDS_STRING &a_name, bool a_can_multicast, const NetworkAddress &a_address)
 
bool is_ipv4 () const
 
bool is_ipv6 () const
 
bool exclude_from_multicast (const char *configured_interface) const
 
bool operator== (const NetworkInterfaceAddress &other) const
 
bool operator!= (const NetworkInterfaceAddress &other) const
 
bool operator< (const NetworkInterfaceAddress &other) const
 

Public Attributes

OPENDDS_STRING name
 
bool can_multicast
 
NetworkAddress address
 

Detailed Description

Definition at line 23 of file NetworkConfigMonitor.h.

Constructor & Destructor Documentation

◆ NetworkInterfaceAddress() [1/2]

OpenDDS::DCPS::NetworkInterfaceAddress::NetworkInterfaceAddress ( )
inline

Definition at line 24 of file NetworkConfigMonitor.h.

◆ NetworkInterfaceAddress() [2/2]

OpenDDS::DCPS::NetworkInterfaceAddress::NetworkInterfaceAddress ( const OPENDDS_STRING a_name,
bool  a_can_multicast,
const NetworkAddress a_address 
)
inline

Definition at line 27 of file NetworkConfigMonitor.h.

30  : name(a_name)
31  , can_multicast(a_can_multicast)
32  , address(a_address)
33  {}

Member Function Documentation

◆ exclude_from_multicast()

bool OpenDDS::DCPS::NetworkInterfaceAddress::exclude_from_multicast ( const char *  configured_interface) const

Definition at line 18 of file NetworkConfigMonitor.cpp.

References address, can_multicast, name, OPENDDS_STRING, and TheServiceParticipant.

Referenced by OpenDDS::DCPS::MulticastManager::process().

19 {
20  if (!can_multicast) {
21  return true;
22  }
23 
24  if (configured_interface && *configured_interface && name != configured_interface) {
25  OPENDDS_STRING ci_semi(configured_interface);
26  if (ci_semi.find_first_of(':') == OPENDDS_STRING::npos) {
27  ci_semi += ':';
28  }
29  NetworkAddress as_addr(ci_semi.c_str());
30  if (as_addr == NetworkAddress() || address != as_addr) {
31  return true;
32  }
33  }
34 
35  const NetworkAddress sp_default = TheServiceParticipant->default_address();
36  return sp_default != NetworkAddress() && address != sp_default;
37 }
#define OPENDDS_STRING
#define TheServiceParticipant

◆ is_ipv4()

bool OpenDDS::DCPS::NetworkInterfaceAddress::is_ipv4 ( ) const
inline

Definition at line 35 of file NetworkConfigMonitor.h.

References AF_INET.

Referenced by OpenDDS::DCPS::MulticastManager::process().

35 { return address.get_type() == AF_INET; }
#define AF_INET

◆ is_ipv6()

bool OpenDDS::DCPS::NetworkInterfaceAddress::is_ipv6 ( ) const
inline

Definition at line 36 of file NetworkConfigMonitor.h.

Referenced by OpenDDS::DCPS::MulticastManager::process().

36 { return address.get_type() == AF_INET6; }

◆ operator!=()

bool OpenDDS::DCPS::NetworkInterfaceAddress::operator!= ( const NetworkInterfaceAddress other) const
inline

Definition at line 46 of file NetworkConfigMonitor.h.

47  {
48  return !(*this == other);
49  }

◆ operator<()

bool OpenDDS::DCPS::NetworkInterfaceAddress::operator< ( const NetworkInterfaceAddress other) const
inline

Definition at line 51 of file NetworkConfigMonitor.h.

References address, name, and name.

52  {
53  if (name != other.name) {
54  return name < other.name;
55  }
56 
57  return address < other.address;
58  }

◆ operator==()

bool OpenDDS::DCPS::NetworkInterfaceAddress::operator== ( const NetworkInterfaceAddress other) const
inline

Definition at line 39 of file NetworkConfigMonitor.h.

References address, can_multicast, name, and name.

40  {
41  return name == other.name &&
42  can_multicast == other.can_multicast &&
43  address == other.address;
44  }

Member Data Documentation

◆ address

NetworkAddress OpenDDS::DCPS::NetworkInterfaceAddress::address

◆ can_multicast

bool OpenDDS::DCPS::NetworkInterfaceAddress::can_multicast

Definition at line 61 of file NetworkConfigMonitor.h.

Referenced by exclude_from_multicast(), and operator==().

◆ name

OPENDDS_STRING OpenDDS::DCPS::NetworkInterfaceAddress::name

The documentation for this struct was generated from the following files: