19 InternalSampleInfoSequence& infos,
31 bool any_joined =
false;
33 for (
size_t idx = 0; idx != samples.size(); ++idx) {
37 if (nia.
name.empty()) {
38 nia.
name = multicast_interface;
42 leave(nia, multicast_group_address, multicast_socket
44 , ipv6_multicast_group_address, ipv6_multicast_socket
50 const bool j =
join(nia, reactor, event_handler, multicast_group_address, multicast_socket
52 , ipv6_multicast_group_address, ipv6_multicast_socket
55 any_joined = any_joined || j;
57 leave(nia, multicast_group_address, multicast_socket
59 , ipv6_multicast_group_address, ipv6_multicast_socket
70 return joined_interfaces_.size()
72 + ipv6_joined_interfaces_.size()
90 if (joined_interfaces_.count(nia.
name) == 0 && nia.
is_ipv4()) {
92 joined_interfaces_.insert(nia.
name);
95 "(%P|%t) INFO: MulticastManager::join: joined group %C on %C/%C (%@ joined count %B)\n",
96 LogAddr(multicast_group_address).c_str(),
97 nia.
name.empty() ?
"all interfaces" : nia.
name.c_str(),
109 ACE_ERROR((
LM_ERROR,
"(%P|%t) ERROR: MulticastManager::join: failed to register multicast input handler\n"));
113 ACE_ERROR((
LM_ERROR,
"(%P|%t) ERROR: MulticastManager::join: reactor is NULL\n"));
118 "(%P|%t) WARNING: MulticastManager::join: failed to join group %C on %C/%C (%@ joined count %B): %m\n",
119 LogAddr(multicast_group_address).c_str(),
120 nia.
name.empty() ?
"all interfaces" : nia.
name.c_str(),
129 if (ipv6_joined_interfaces_.count(nia.
name) == 0 && nia.
is_ipv6()) {
135 ipv6_joined_interfaces_.insert(nia.
name);
138 "(%P|%t) INFO: MulticastManager::join: joined group %C on %C/%C (%@ joined count %B)\n",
139 LogAddr(ipv6_multicast_group_address).c_str(),
140 nia.
name.empty() ?
"all interfaces" : nia.
name.c_str(),
152 ACE_ERROR((
LM_ERROR,
"(%P|%t) ERROR: MulticastManager::join: ipv6 failed to register multicast input handler\n"));
156 ACE_ERROR((
LM_ERROR,
"(%P|%t) ERROR: MulticastManager::join: ipv6 reactor is NULL\n"));
161 "(%P|%t) WARNING: MulticastManager::join: failed to join group %C on %C/%C (%@ joined count %B): %m\n",
162 LogAddr(ipv6_multicast_group_address).c_str(),
163 nia.
name.empty() ?
"all interfaces" : nia.
name.c_str(),
184 if (joined_interfaces_.count(nia.
name) != 0 && nia.
is_ipv4()) {
186 joined_interfaces_.erase(nia.
name);
189 "(%P|%t) INFO: MulticastManager::leave: left group %C on %C/%C (%@ joined count %B)\n",
190 LogAddr(multicast_group_address).c_str(),
191 nia.
name.empty() ?
"all interfaces" : nia.
name.c_str(),
199 "(%P|%t) WARNING: MulticastManager::leave: failed to leave group %C on %C/%C (%@ joined count %B): %m\n",
200 LogAddr(multicast_group_address).c_str(),
201 nia.
name.empty() ?
"all interfaces" : nia.
name.c_str(),
210 if (ipv6_joined_interfaces_.count(nia.
name) != 0 && nia.
is_ipv6()) {
212 ipv6_joined_interfaces_.erase(nia.
name);
215 "(%P|%t) INFO: MulticastManager::leave: left group %C on %C/%C (%@ joined count %B)\n",
216 LogAddr(ipv6_multicast_group_address).c_str(),
217 nia.
name.empty() ?
"all interfaces" : nia.
name.c_str(),
225 "(%P|%t) WARNING: MulticastManager::leave: failed to leave group %C on %C/%C (%@ joined count %B): %m\n",
226 LogAddr(ipv6_multicast_group_address).c_str(),
227 nia.
name.empty() ?
"all interfaces" : nia.
name.c_str(),
bool exclude_from_multicast(const char *configured_interface) const
InstanceStateKind instance_state
void leave(const NetworkInterfaceAddress &nia, const NetworkAddress &multicast_group_address, ACE_SOCK_Dgram_Mcast &multicast_socket)
ACE_INET_Addr to_addr() const
size_t joined_interface_count() const
int register_handler(ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask)
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)
bool join(const NetworkInterfaceAddress &nia, ACE_Reactor *reactor, ACE_Event_Handler *event_handler, const NetworkAddress &multicast_group_address, ACE_SOCK_Dgram_Mcast &multicast_socket)
const char * c_str() const
#define ACE_TEXT_CHAR_TO_TCHAR(STRING)
OpenDDS_Dcps_Export LogLevel log_level
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.
const InstanceStateKind ALIVE_INSTANCE_STATE
bool process(InternalDataReader< NetworkInterfaceAddress >::SampleSequence &samples, InternalSampleInfoSequence &infos, const OPENDDS_STRING &multicast_interface, ACE_Reactor *reactor, ACE_Event_Handler *event_handler, const NetworkAddress &multicast_group_address, ACE_SOCK_Dgram_Mcast &multicast_socket)
Returns true if at least one group was joined.