Socket/Protocols/INet: Implement SSM Multicast API
[senf.git] / Socket / Protocols / INet / MulticastSocketProtocol.hh
index 1f24836..cf80740 100644 (file)
@@ -40,19 +40,22 @@ namespace senf {
     ///\{
    
     /** \brief Generic addressing type independent multicast protocol facet
+
+        \todo implement complete new multicast API from RFC3678 (as far as supported by linux)
+        \bug mcLeaveSSMSource fails with EADDRNOTAVAIL
      */
     class MulticastSocketProtocol 
         : public virtual SocketProtocol
     {
     public:
-        void broadcastEnabled(bool v);  ///< Enable broadcast send/receive
+        void broadcastEnabled(bool v) const; ///< Enable broadcast send/receive
                                         /**< If this option is enabled, broadcast UDP messages will
                                              be received on the socket and the socket will be
                                              allowed to send out broadcast UDP messages
                                              \param[in] v \c true to enable broadcast send/receive,
                                                  \c false to disable */
 
-        bool broadcastEnabled();        ///< Get broadcast send/receive state
+        bool broadcastEnabled() const;  ///< Get broadcast send/receive state
                                         /**< \returns Current state of the broadcastEnabled()
                                              option. */
 
@@ -73,7 +76,7 @@ namespace senf {
     /** \brief Multicast protocol facet for INet4 addressable multicast enabled sockets
      */
     class INet4MulticastSocketProtocol
-        : public virtual SocketProtocol
+        : public MulticastSocketProtocol
     {
     public:
         void mcAddMembership(INet4Address const & mcAddr) const;
@@ -125,12 +128,35 @@ namespace senf {
                                              interface with the given local address.
                                              \param[in] mcAddr address of group to leave
                                              \param[in] iface interface name */
+
+        void mcJoinSSMSource(INet4Address const & group, INet4Address const & source, 
+                             std::string const & iface) 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] iface interface to join the group on */
+        void mcLeaveSSMSource(INet4Address const & group, INet4Address const & source,
+                              std::string const & iface) const;
+                                        ///< leave SSM multicast group
+                                        /**< This call will leave the multicast group \a group for
+                                             traffic from \a source.
+                                             \param[in] group multicast group to leave
+                                             \param[in] source SSM multicast source to leave the
+                                                 group from
+                                             \param[in] iface interface to leave the group on */
     };
 
     /** \brief Multicast protocol facet for INet6 addressable multicast enabled sockets
+
+        This implementation supports INet6 mapped INet4 multicast addresses. This is a linux
+        specific extension and NOT part of the relevant RFCs.
      */
     class INet6MulticastSocketProtocol
-        : public virtual SocketProtocol
+        : public MulticastSocketProtocol
     {
     public:
         void mcAddMembership(INet6Address const & mcAddr) const;
@@ -139,14 +165,6 @@ namespace senf {
                                              groups received. The group is joined on the default
                                              interface.
                                              \param[in] mcAddr address of group to join */
-        void mcAddMembership(INet6Address const & mcAddr, INet6Address const & localAddr) 
-            const;
-                                        ///< join multicast group on a specific interface
-                                        /**< This member will add \a mcAddr to the list of multicast
-                                             groups received. The group is joined on the interface
-                                             with the given local address.
-                                             \param[in] mcAddr address of group to join
-                                             \param[in] localAddr address of interface to join on */
         void mcAddMembership(INet6Address const & mcAddr, std::string const & iface);
                                         ///< join multicast group on a specific interface
                                         /**< This member will add \a mcAddr to the list of multicast
@@ -161,24 +179,33 @@ namespace senf {
                                              multicast groups received. The group is left from the
                                              default interface.
                                              \param[in] mcAddr address of group to leave */
-        void mcDropMembership(INet6Address const & mcAddr, INet6Address const & localAddr) 
-            const;
+        void mcDropMembership(INet6Address const & mcAddr, std::string const & iface) const;
                                         ///< leave multicast group on a specific interface
                                         /**< This member will remove \a mcAddr from the list of
                                              multicast groups received. The group is left from the
                                              interface with the given local address.
                                              \param[in] mcAddr address of group to leave
-                                             \param[in] localAddr address of interface to leave
-                                                 from */
-        void mcDropMembership(INet6Address const & mcAddr, std::string const & iface) 
-            const;
-                                        ///< leave multicast group on a specific interface
-                                        /**< This member will remove \a mcAddr from the list of
-                                             multicast groups received. The group is left from the
-                                             interface with the given local address.
-                                             \param[in] mcAddr address of group to leave
-                                             \param[in] localAddr address of interface to leave
-                                                 from */
+                                             \param[in] iface interface name */
+
+        void mcJoinSSMSource(INet6Address const & group, INet6Address const & source, 
+                             std::string const & iface) 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] iface interface to join the group on */
+        void mcLeaveSSMSource(INet6Address const & group, INet6Address const & source,
+                              std::string const & iface) const;
+                                        ///< leave SSM multicast group
+                                        /**< This call will leave the multicast group \a group for
+                                             traffic from \a source.
+                                             \param[in] group multicast group to leave
+                                             \param[in] source SSM multicast source to leave the
+                                                 group from
+                                             \param[in] iface interface to leave the group on */
     };
 
     ///\}