2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
4 // Stefan Bund <g0dil@berlios.de>
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 \brief IpV6Packet unit tests */
24 //#include "IpV6Packet.test.hh"
25 //#include "IpV6Packet.test.ih"
28 #include "IpV6Packet.hh"
29 #include "Socket/INetAddressing.hh"
31 #include <boost/test/auto_unit_test.hpp>
32 #include <boost/test/test_tools.hpp>
35 ///////////////////////////////cc.p////////////////////////////////////////
39 BOOST_AUTO_UNIT_TEST(ipV6Packet_parser)
41 unsigned char data[] = { 0x60, 0x12, 0x20, 0x30,
42 0x01, 0x02, 0x03, 0x04,
43 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
44 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
45 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
46 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f };
48 typedef unsigned char * iterator;
49 Parse_IpV6<iterator> p(data);
51 BOOST_CHECK_EQUAL( unsigned(p.version()), 0x06u );
52 BOOST_CHECK_EQUAL( unsigned(p.trafficClass()), 0x01u );
53 BOOST_CHECK_EQUAL( unsigned(p.flowLabel()), 0x22030u );
54 BOOST_CHECK_EQUAL( unsigned(p.length()), 0x0102u );
55 BOOST_CHECK_EQUAL( unsigned(p.nextHeader()), 0x03u );
56 BOOST_CHECK_EQUAL( unsigned(p.hopLimit()), 0x04u );
57 BOOST_CHECK_EQUAL( INet6Address(p.source().range()).address() ,
58 "1011:1213:1415:1617:1819:1a1b:1c1d:1e1f" );
59 BOOST_CHECK_EQUAL( INet6Address(p.destination().range()).address() ,
60 "2021:2223:2425:2627:2829:2a2b:2c2d:2e2f" );
63 ///////////////////////////////cc.e////////////////////////////////////////
70 // c-file-style: "senf"
71 // ispell-local-dictionary: "american"