X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FIpV6Extensions.test.cc;h=f0fed397038325c0b8d317debd08604c172e668c;hb=85ab07d100a382467a42e19d741d403a7a96c951;hp=1d56ee23ab4b6c4bdcb45376340dc3a822a1f582;hpb=3e42ecb22121f2e6df86b27bea73f890384a4ee4;p=senf.git diff --git a/Packets/IpV6Extensions.test.cc b/Packets/IpV6Extensions.test.cc index 1d56ee2..f0fed39 100644 --- a/Packets/IpV6Extensions.test.cc +++ b/Packets/IpV6Extensions.test.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2007 +// Copyright (C) 2007 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) // Stefan Bund @@ -42,7 +42,7 @@ using namespace senf; BOOST_AUTO_UNIT_TEST(ipv6Extension_Fragment_parser) { unsigned char data[] = { 59, 0, 0x10, 0x20, - 0x01, 0x02, 0x03, 0x04 }; + 0x01, 0x02, 0x03, 0x04 }; typedef unsigned char * iterator; Parse_IpV6Extension_Fragment p (data); @@ -56,54 +56,54 @@ BOOST_AUTO_UNIT_TEST(ipv6Extension_Fragment_parser) BOOST_AUTO_UNIT_TEST(ipv6Extension_Fragment_packet) { // Just for the fun of it, we test a nice chain: A fragment of a fragmented UDP packet - - unsigned char data[] = { - // IP header - 0x60, 0x00, 0x00, 0x00, // IP Version, class, flow label - 0, 20, // payload length - 44, // next header (IPv6 Fragment) - 32, // hop limit - 0x20, 0x01, 0, 0, 0, 0, 0, 0, // source ip = 2001::1 - 0, 0, 0, 0, 0, 0, 0, 0x01, - 0x20, 0x01, 0, 0, 0, 0, 0, 0, // destination ip = 2001::2 - 0, 0, 0, 0, 0, 0, 0, 0x02, - // IPv6 Fragment header - 17, // next header (UDP) - 0, // reserved - 0x05, 0x00, // fragment offset, last fragment - 0x01, 0x02, 0x03, 0x04, // id - // UDP header - 0x10, 0x00, // source port - 0x20, 0x00, // destination port - 0, 12, // length - 0x00, 0x00, // CRC (no, I won't calculate this one ...) - // Payload data - 0x11, 0x12, 0x13, 0x14 + + unsigned char data[] = { + // IP header + 0x60, 0x00, 0x00, 0x00, // IP Version, class, flow label + 0, 20, // payload length + 44, // next header (IPv6 Fragment) + 32, // hop limit + 0x20, 0x01, 0, 0, 0, 0, 0, 0, // source ip = 2001::1 + 0, 0, 0, 0, 0, 0, 0, 0x01, + 0x20, 0x01, 0, 0, 0, 0, 0, 0, // destination ip = 2001::2 + 0, 0, 0, 0, 0, 0, 0, 0x02, + // IPv6 Fragment header + 17, // next header (UDP) + 0, // reserved + 0x05, 0x00, // fragment offset, last fragment + 0x01, 0x02, 0x03, 0x04, // id + // UDP header + 0x10, 0x00, // source port + 0x20, 0x00, // destination port + 0, 12, // length + 0x00, 0x00, // CRC (no, I won't calculate this one ...) + // Payload data + 0x11, 0x12, 0x13, 0x14 }; IpV6Packet::ptr p (Packet::create(data, data + sizeof(data))); - + BOOST_CHECK_EQUAL( p->version(), 6u ); BOOST_CHECK_EQUAL( p->length(), 20u ); BOOST_CHECK_EQUAL( p->nextHeader(), 44u ); BOOST_CHECK_EQUAL( INet6Address(p->source().range()), "2001::1" ); BOOST_CHECK_EQUAL( INet6Address(p->destination().range()), "2001::2" ); BOOST_CHECK( p->next()->is() ); - + IpV6Extension_Fragment::ptr f (p->next()->as()); - + BOOST_CHECK_EQUAL( f->nextHeader(), 17u ); BOOST_CHECK_EQUAL( f->fragmentOffset(), 160u ); BOOST_CHECK_EQUAL( f->id(), 0x01020304u ); BOOST_CHECK( f->next()->is() ); UDPPacket::ptr u (f->next()->as()); - + BOOST_CHECK_EQUAL( u->source(), 0x1000u ); BOOST_CHECK_EQUAL( u->destination(), 0x2000u ); BOOST_CHECK_EQUAL( u->length(), 12u ); BOOST_CHECK( u->next()->is() ); - + Packet::iterator i (u->next()->begin()); BOOST_CHECK_EQUAL( Parse_UInt32(i).value(), 0x11121314u ); } @@ -116,5 +116,6 @@ BOOST_AUTO_UNIT_TEST(ipv6Extension_Fragment_packet) // mode: c++ // fill-column: 100 // c-file-style: "senf" +// indent-tabs-mode: nil // ispell-local-dictionary: "american" // End: