small documentation fixes
[senf.git] / Socket / Protocols / INet / MulticastProtocol.hh
1 // $Id$
2 //
3 // Copyright (C) 2007 
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.de>
7 //
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.
12 //
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.
17 //
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.
22
23 /** \file
24     \brief MulticastProtocol public header */
25
26 #ifndef HH_MulticastProtocol_
27 #define HH_MulticastProtocol_ 1
28
29 // Custom includes
30 #include "../../../Socket/SocketProtocol.hh"
31 #include "INet4Address.hh"
32 #include "INet6Address.hh"
33
34 //#include "MulticastProtocol.mpp"
35 ///////////////////////////////hh.p////////////////////////////////////////
36
37 namespace senf {
38
39     ///\addtogroup protocol_facets_group
40     ///\{
41    
42     class MulticastProtocol 
43         : public virtual SocketProtocol
44     {
45     public:
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 */
52
53         bool broadcastEnabled();        ///< Get broadcast send/receive state
54                                         /**< \returns Current state of the broadcastEnabled()
55                                              option. */
56
57
58         unsigned mcTTL() const;         ///< Return current multicast TTL
59         void mcTTL(unsigned value) const; ///< Set multicast TTL
60
61         bool mcLoop() const;            ///< Return current multicast loopback state
62         void mcLoop(bool value) const;  ///< Set multicast loopback state
63
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
67                                              data from */
68     };
69
70     class INet4MulticastProtocol
71         : public virtual SocketProtocol
72     {
73     public:
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
78                                              interface.
79                                              \param[in] mcAddr address of group to join */
80         void mcAddMembership(INet4Address const & mcAddr, INet4Address const & localAddr) 
81             const;
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
94                                              interface.
95                                              \param[in] mcAddr address of group to join
96                                              \param[in] iface interface name */
97
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
102                                              default interface.
103                                              \param[in] mcAddr address of group to leave */
104         void mcDropMembership(INet4Address const & mcAddr, INet4Address const & localAddr) 
105             const;
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
114                                                  from */
115         void mcDropMembership(INet4Address const & mcAddr, std::string const & iface) 
116             const;
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 */
123     };
124
125     class INet6MulticastProtocol
126         : public virtual SocketProtocol
127     {
128     public:
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
133                                              interface.
134                                              \param[in] mcAddr address of group to join */
135         void mcAddMembership(INet6Address const & mcAddr, INet6Address const & localAddr) 
136             const;
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
147                                              interface.
148                                              \param[in] mcAddr address of group to join
149                                              \param[in] iface interface name */
150
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
155                                              default interface.
156                                              \param[in] mcAddr address of group to leave */
157         void mcDropMembership(INet6Address const & mcAddr, INet6Address const & localAddr) 
158             const;
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
165                                                  from */
166         void mcDropMembership(INet6Address const & mcAddr, std::string const & iface) 
167             const;
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
174                                                  from */
175     };
176
177     ///\}
178 }
179
180 ///////////////////////////////hh.e////////////////////////////////////////
181 //#include "MulticastProtocol.cci"
182 //#include "MulticastProtocol.ct"
183 //#include "MulticastProtocol.cti"
184 #endif
185
186 \f
187 // Local Variables:
188 // mode: c++
189 // fill-column: 100
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"
195 // End: