}
namespace {
- void mc6SSMSourceRequest(int operation, int fd, senf::INet6Address const & group,
- senf::INet6Address const & source, std::string const & iface)
- {
- struct group_source_req req;
- ::memset(&req, 0, sizeof(req));
- req.gsr_interface = if_nametoindex(iface.c_str());
- if (req.gsr_interface == 0)
- throw senf::SystemException("::if_nametoindex()", ENOENT SENF_EXC_DEBUGINFO);
- req.gsr_group.ss_family = AF_INET6;
- std::copy(group.begin(), group.end(),
- reinterpret_cast<struct sockaddr_in6&>(req.gsr_group).sin6_addr.s6_addr);
- req.gsr_source.ss_family = AF_INET6;
- std::copy(source.begin(), source.end(),
- reinterpret_cast<struct sockaddr_in6&>(req.gsr_source).sin6_addr.s6_addr);
- if (::setsockopt(fd, SOL_IPV6, MCAST_JOIN_SOURCE_GROUP, &req, sizeof(req)) < 0)
- SENF_THROW_SYSTEM_EXCEPTION("::setsockopt()");
+void mc6SSMSourceRequest(int operation, int fd, senf::INet6Address const & group,
+ senf::INet6Address const & source, int const & ifacei)
+{
+ struct group_source_req req;
+ ::memset(&req, 0, sizeof(req));
+ req.gsr_interface = ifacei;
+ req.gsr_group.ss_family = AF_INET6;
+ std::copy(group.begin(), group.end(),
+ reinterpret_cast<struct sockaddr_in6&>(req.gsr_group).sin6_addr.s6_addr);
+ req.gsr_source.ss_family = AF_INET6;
+ std::copy(source.begin(), source.end(),
+ reinterpret_cast<struct sockaddr_in6&>(req.gsr_source).sin6_addr.s6_addr);
+ if (::setsockopt(fd, SOL_IPV6, MCAST_JOIN_SOURCE_GROUP, &req, sizeof(req)) < 0)
+ SENF_THROW_SYSTEM_EXCEPTION("::setsockopt()");
+}
+void mc6SSMSourceRequest(int operation, int fd, senf::INet6Address const & group,
+ senf::INet6Address const & source, std::string const & iface)
+{
+ int ifacei = if_nametoindex(iface.c_str());
+ if (ifacei == 0)
+ throw senf::SystemException("::if_nametoindex()", ENOENT SENF_EXC_DEBUGINFO);
+ mc6SSMSourceRequest(operation, fd, group, source, ifacei);
}
+
}
prefix_ void senf::INet6MulticastSocketProtocol::mcJoinSSMSource(INet6Address const & group,
mc6SSMSourceRequest(MCAST_JOIN_SOURCE_GROUP, fd(), group, source, iface);
}
+prefix_ void senf::INet6MulticastSocketProtocol::mcJoinSSMSource(INet6Address const & group,
+ INet6Address const & source,
+ int ifacei)
+ const
+{
+ mc6SSMSourceRequest(MCAST_JOIN_SOURCE_GROUP, fd(), group, source, ifacei);
+}
+prefix_ void senf::INet6MulticastSocketProtocol::mcJoinSSMSource(INet6Address const & group,
+ INet6Address const & source)
+ const
+{
+ mc6SSMSourceRequest(MCAST_JOIN_SOURCE_GROUP, fd(), group, source, 0);
+}
+
prefix_ void senf::INet6MulticastSocketProtocol::mcLeaveSSMSource(INet6Address const & group,
INet6Address const & source,
std::string const & iface)
mc6SSMSourceRequest(MCAST_LEAVE_SOURCE_GROUP, fd(), group, source, iface);
}
+
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
//#include "MulticastSocketProtocol.mpp"
\param[in] source SSM multicast source to join the
group on
\param[in] iface interface to join the group on */
+ void mcJoinSSMSource(INet6Address const & group, INet6Address const & source,
+ int ifacei) const;
+ ///< join SSM multicast group
+ /**< This call will join the multicast group \a group for
+ traffic from \a source. A single group may be joined
+ multiple times on different sources.
+ \param[in] group multicast group to join
+ \param[in] source SSM multicast source to join the
+ group on
+ \param[in] ifacei interface index to join the group on */
+ void mcJoinSSMSource(INet6Address const & group, INet6Address const & source) const;
+ ///< join SSM multicast group
+ /**< This call will join the multicast group \a group for
+ traffic from \a source. A single group may be joined
+ multiple times on different sources.
+ \param[in] group multicast group to join
+ \param[in] source SSM multicast source to join the
+ group on */
void mcLeaveSSMSource(INet6Address const & group, INet6Address const & source,
std::string const & iface) const;
///< leave SSM multicast group