4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief MulticastProtocol public header */
26 #ifndef HH_MulticastProtocol_
27 #define HH_MulticastProtocol_ 1
30 #include "../../../Socket/SocketProtocol.hh"
31 #include "INet4Address.hh"
32 #include "INet6Address.hh"
34 //#include "MulticastProtocol.mpp"
35 ///////////////////////////////hh.p////////////////////////////////////////
39 ///\addtogroup protocol_facets_group
42 class MulticastProtocol
43 : public virtual SocketProtocol
46 void broadcastEnabled(bool v); ///< Enable broadcast send/receive
47 /**< If this option is enabled, broadcast UDP messages will
48 be received on the socket and the socket will be
49 allowed to send out broadcast UDP messages
50 \param[in] v \c true to enable broadcast send/receive,
51 \c false to disable */
53 bool broadcastEnabled(); ///< Get broadcast send/receive state
54 /**< \returns Current state of the broadcastEnabled()
58 unsigned mcTTL() const; ///< Return current multicast TTL
59 void mcTTL(unsigned value) const; ///< Set multicast TTL
61 bool mcLoop() const; ///< Return current multicast loopback state
62 void mcLoop(bool value) const; ///< Set multicast loopback state
64 void mcIface(std::string const & iface = std::string()) const;
65 ///< Set multicast send interface of the socket
66 /**< \param[in] iface name of interface to send multicast
70 class INet4MulticastProtocol
71 : public virtual SocketProtocol
74 void mcAddMembership(INet4Address const & mcAddr) const;
75 ///< Join multicast group on default interface
76 /**< This member will add \a mcAddr to the list of multicast
77 groups received. The group is joined on the default
79 \param[in] mcAddr address of group to join */
80 void mcAddMembership(INet4Address const & mcAddr, INet4Address const & localAddr)
82 ///< join multicast group on a specific interface
83 /**< This member will add \a mcAddr to the list of multicast
84 groups received. The group is joined on the interface
85 with the given local address.
86 \deprecated Use \link mcAddMembership(INet4Address const & mcAddr, std::string const & iface) const mcAddMembership( \a mcAddr , \a iface )\endlink
87 for compatibility with the IPv6 API.
88 \param[in] mcAddr address of group to join
89 \param[in] localAddr address of interface to join on */
90 void mcAddMembership(INet4Address const & mcAddr, std::string const & iface) const;
91 ///< join multicast group on a specific interface
92 /**< This member will add \a mcAddr to the list of multicast
93 groups received. The group is joined on the given
95 \param[in] mcAddr address of group to join
96 \param[in] iface interface name */
98 void mcDropMembership(INet4Address const & mcAddr) const;
99 ///< Leave multicast group
100 /**< This member will remove \a mcAddr from the list of
101 multicast groups received. The group is left from the
103 \param[in] mcAddr address of group to leave */
104 void mcDropMembership(INet4Address const & mcAddr, INet4Address const & localAddr)
106 ///< leave multicast group on a specific interface
107 /**< This member will remove \a mcAddr from the list of
108 multicast groups received. The group is left from the
109 interface with the given local address.
110 \deprecated Use \link mcDropMembership(INet4Address const & mcAddr, std::string const & iface) const mcDropMembership( \a mcAddr , \a iface )\endlink
111 for compatibility with the IPv6 API.
112 \param[in] mcAddr address of group to leave
113 \param[in] localAddr address of interface to leave
115 void mcDropMembership(INet4Address const & mcAddr, std::string const & iface)
117 ///< leave multicast group on a specific interface
118 /**< This member will remove \a mcAddr from the list of
119 multicast groups received. The group is left from the
120 interface with the given local address.
121 \param[in] mcAddr address of group to leave
122 \param[in] localAddr address of interface to leave
126 class INet6MulticastProtocol
127 : public virtual SocketProtocol
130 void mcAddMembership(INet6Address const & mcAddr) const;
131 ///< Join multicast group on default interface
132 /**< This member will add \a mcAddr to the list of multicast
133 groups received. The group is joined on the default
135 \param[in] mcAddr address of group to join */
136 void mcAddMembership(INet6Address const & mcAddr, INet6Address const & localAddr)
138 ///< join multicast group on a specific interface
139 /**< This member will add \a mcAddr to the list of multicast
140 groups received. The group is joined on the interface
141 with the given local address.
142 \param[in] mcAddr address of group to join
143 \param[in] localAddr address of interface to join on */
144 void mcAddMembership(INet6Address const & mcAddr, std::string const & iface);
145 ///< join multicast group on a specific interface
146 /**< This member will add \a mcAddr to the list of multicast
147 groups received. The group is joined on the given
149 \param[in] mcAddr address of group to join
150 \param[in] iface interface name */
152 void mcDropMembership(INet6Address const & mcAddr) const;
153 ///< Leave multicast group
154 /**< This member will remove \a mcAddr from the list of
155 multicast groups received. The group is left from the
157 \param[in] mcAddr address of group to leave */
158 void mcDropMembership(INet6Address const & mcAddr, INet6Address const & localAddr)
160 ///< leave multicast group on a specific interface
161 /**< This member will remove \a mcAddr from the list of
162 multicast groups received. The group is left from the
163 interface with the given local address.
164 \param[in] mcAddr address of group to leave
165 \param[in] localAddr address of interface to leave
167 void mcDropMembership(INet6Address const & mcAddr, std::string const & iface)
169 ///< leave multicast group on a specific interface
170 /**< This member will remove \a mcAddr from the list of
171 multicast groups received. The group is left from the
172 interface with the given local address.
173 \param[in] mcAddr address of group to leave
174 \param[in] localAddr address of interface to leave
181 ///////////////////////////////hh.e////////////////////////////////////////
182 //#include "MulticastProtocol.cci"
183 //#include "MulticastProtocol.ct"
184 //#include "MulticastProtocol.cti"
191 // comment-column: 40
192 // c-file-style: "senf"
193 // indent-tabs-mode: nil
194 // ispell-local-dictionary: "american"
195 // compile-command: "scons -u test"