4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at
9 // http://senf.berlios.de/license.html
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on,
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
15 // Software distributed under the License is distributed on an "AS IS" basis,
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17 // for the specific language governing rights and limitations under the License.
19 // The Original Code is Fraunhofer FOKUS code.
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
26 // Stefan Bund <g0dil@berlios.de>
29 \brief MulticastSocketProtocol unit tests */
31 //#include "MulticastSocketProtocol.test.hh"
32 //#include "MulticastSocketProtocol.test.ih"
35 #include "UDPSocketHandle.hh"
37 #include <senf/Utils/auto_unit_test.hh>
38 #include <boost/test/test_tools.hpp>
41 //-/////////////////////////////////////////////////////////////////////////////////////////////////
43 SENF_AUTO_UNIT_TEST(multicastSocketProtocol)
45 senf::UDPv4ClientSocketHandle sock;
47 sock.protocol().broadcastEnabled(false);
48 BOOST_CHECK( ! sock.protocol().broadcastEnabled() );
49 sock.protocol().broadcastEnabled(true);
50 BOOST_CHECK( sock.protocol().broadcastEnabled() );
52 sock.protocol().mcTTL(4u);
53 BOOST_CHECK_EQUAL( sock.protocol().mcTTL(), 4u );
54 sock.protocol().mcTTL(1u);
55 BOOST_CHECK_EQUAL( sock.protocol().mcTTL(), 1u );
57 sock.protocol().mcLoop(false);
58 BOOST_CHECK( ! sock.protocol().mcLoop() );
59 sock.protocol().mcLoop(true);
60 BOOST_CHECK( sock.protocol().mcLoop() );
62 sock.protocol().mcIface("lo");
64 SENF_CHECK_NO_THROW( sock.protocol().mcJoinSSMSource(
65 senf::INet4Address(0xE0000001u),
66 senf::INet4Address(0x7F000001u),
68 // This fails with EADDRNOTAVAIL .. no idea why. I tried with 'eth' interface
69 // and a real address (not loopback) to no avail.
70 // SENF_CHECK_NO_THROW( sock.protocol().mcLeaveSSMSource(
71 // senf::INet4Address(0xE0000001u),
72 // senf::INet4Address(0x7F000001u),
75 senf::UDPv6ClientSocketHandle sock6;
77 SENF_CHECK_NO_THROW( sock6.protocol().mcJoinSSMSource(
78 senf::INet6Address(0xFF00u, 0, 0, 0, 0, 0, 0, 1),
79 senf::INet6Address::Loopback,
81 // This fails with EADDRNOTAVAIL .. no idea why. I tried with 'eth' interface
82 // and a real address (not loopback) to no avail.
83 // SENF_CHECK_NO_THROW( sock6.protocol().mcLeaveSSMSource(
84 // senf::INet6Address(0xFF00u, 0, 0, 0, 0, 0, 0, 1),
85 // senf::INet6Address::Loopback,
89 //-/////////////////////////////////////////////////////////////////////////////////////////////////
97 // c-file-style: "senf"
98 // indent-tabs-mode: nil
99 // ispell-local-dictionary: "american"
100 // compile-command: "scons -u test"