<span coords="597,543,717,570">\ref senf::ppi::connector::PassiveOutput</span>
<span coords="66,432,210,459">\ref senf::ppi::detail::EventBindingBase</span>
<span coords="378,428,505,455">\ref senf::ppi::connector::InputConnector</span>
- <span coords="491,124,694,210">\ref senf::ppi::RouteImplementation</span>
+ <span coords="491,124,694,210">\ref senf::ppi::detail::RouteImplementation</span>
<span coords="283,464,423,491">\ref senf::ppi::connector::OutputConnector</span>
<span coords="512,428,645,455">\ref senf::ppi::connector::ActiveConnector</span>
<span coords="85,487,259,527">\ref senf::ppi::detail::EventBinding</span>
// senf::MulticastSocketProtocol
prefix_ void senf::MulticastSocketProtocol::broadcastEnabled(bool v)
+ const
{
int ivalue (v);
if (::setsockopt(fd(), SOL_SOCKET, SO_BROADCAST, &ivalue, sizeof(ivalue)) < 0)
}
prefix_ bool senf::MulticastSocketProtocol::broadcastEnabled()
+ const
{
int value (0);
::socklen_t len (sizeof(value));
prefix_ bool senf::MulticastSocketProtocol::mcLoop()
const
{
- int value;
+ int value (0);
socklen_t len (sizeof(value));
if (::getsockopt(fd(),SOL_IP,IP_MULTICAST_LOOP,&value,&len) < 0)
throw SystemException();
prefix_ unsigned senf::MulticastSocketProtocol::mcTTL()
const
{
- int value;
+ int value (0);
socklen_t len (sizeof(value));
if (::getsockopt(fd(),SOL_IP,IP_MULTICAST_TTL,&value,&len) < 0)
throw SystemException();
: 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. */
--- /dev/null
+// $Id$
+//
+// Copyright (C) 2008
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Stefan Bund <g0dil@berlios.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+/** \file
+ \brief MulticastSocketProtocol.test unit tests */
+
+//#include "MulticastSocketProtocol.test.hh"
+//#include "MulticastSocketProtocol.test.ih"
+
+// Custom includes
+#include "UDPSocketHandle.hh"
+
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/test_tools.hpp>
+
+#define prefix_
+///////////////////////////////cc.p////////////////////////////////////////
+
+BOOST_AUTO_UNIT_TEST(multicastSocketProtocol)
+{
+ senf::UDPv4ClientSocketHandle sock;
+
+ sock.protocol().broadcastEnabled(false);
+ BOOST_CHECK( ! sock.protocol().broadcastEnabled() );
+ sock.protocol().broadcastEnabled(true);
+ BOOST_CHECK( sock.protocol().broadcastEnabled() );
+
+ sock.protocol().mcTTL(4u);
+ BOOST_CHECK_EQUAL( sock.protocol().mcTTL(), 4u );
+ sock.protocol().mcTTL(1u);
+ BOOST_CHECK_EQUAL( sock.protocol().mcTTL(), 1u );
+
+ sock.protocol().mcLoop(false);
+ BOOST_CHECK( ! sock.protocol().mcLoop() );
+ sock.protocol().mcLoop(true);
+ BOOST_CHECK( sock.protocol().mcLoop() );
+
+ sock.protocol().mcIface("lo");
+}
+
+///////////////////////////////cc.e////////////////////////////////////////
+#undef prefix_
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End: