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] iface interface name */
125 class INet6MulticastProtocol
126 : public virtual SocketProtocol
129 void mcAddMembership(INet6Address const & mcAddr) const;
130 ///< Join multicast group on default interface
131 /**< This member will add \a mcAddr to the list of multicast
132 groups received. The group is joined on the default
134 \param[in] mcAddr address of group to join */
135 void mcAddMembership(INet6Address const & mcAddr, INet6Address const & localAddr)
137 ///< join multicast group on a specific interface
138 /**< This member will add \a mcAddr to the list of multicast
139 groups received. The group is joined on the interface
140 with the given local address.
141 \param[in] mcAddr address of group to join
142 \param[in] localAddr address of interface to join on */
143 void mcAddMembership(INet6Address const & mcAddr, std::string const & iface);
144 ///< join multicast group on a specific interface
145 /**< This member will add \a mcAddr to the list of multicast
146 groups received. The group is joined on the given
148 \param[in] mcAddr address of group to join
149 \param[in] iface interface name */
151 void mcDropMembership(INet6Address const & mcAddr) const;
152 ///< Leave multicast group
153 /**< This member will remove \a mcAddr from the list of
154 multicast groups received. The group is left from the
156 \param[in] mcAddr address of group to leave */
157 void mcDropMembership(INet6Address const & mcAddr, INet6Address const & localAddr)
159 ///< leave multicast group on a specific interface
160 /**< This member will remove \a mcAddr from the list of
161 multicast groups received. The group is left from the
162 interface with the given local address.
163 \param[in] mcAddr address of group to leave
164 \param[in] localAddr address of interface to leave
166 void mcDropMembership(INet6Address const & mcAddr, std::string const & iface)
168 ///< leave multicast group on a specific interface
169 /**< This member will remove \a mcAddr from the list of
170 multicast groups received. The group is left from the
171 interface with the given local address.
172 \param[in] mcAddr address of group to leave
173 \param[in] localAddr address of interface to leave
180 ///////////////////////////////hh.e////////////////////////////////////////
181 //#include "MulticastProtocol.cci"
182 //#include "MulticastProtocol.ct"
183 //#include "MulticastProtocol.cti"
190 // comment-column: 40
191 // c-file-style: "senf"
192 // indent-tabs-mode: nil
193 // ispell-local-dictionary: "american"
194 // compile-command: "scons -u test"