X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FDefaultBundle%2FUDPPacket.test.cc;h=1c04df1d92bf2f0688b7f13329b629c0c83f4263;hb=HEAD;hp=12c5171f2f332586d05e70a610817de2d0d2f624;hpb=767a76da8e5b96a69b620e44d32e0a1b04005679;p=senf.git diff --git a/senf/Packets/DefaultBundle/UDPPacket.test.cc b/senf/Packets/DefaultBundle/UDPPacket.test.cc index 12c5171..1c04df1 100644 --- a/senf/Packets/DefaultBundle/UDPPacket.test.cc +++ b/senf/Packets/DefaultBundle/UDPPacket.test.cc @@ -2,23 +2,28 @@ // // Copyright (C) 2006 // Fraunhofer Institute for Open Communication Systems (FOKUS) -// Competence Center NETwork research (NET), St. Augustin, GERMANY -// Stefan Bund // -// 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. +// The contents of this file are subject to the Fraunhofer FOKUS Public License +// Version 1.0 (the "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// http://senf.berlios.de/license.html // -// 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. +// The Fraunhofer FOKUS Public License Version 1.0 is based on, +// but modifies the Mozilla Public License Version 1.1. +// See the full license text for the amendments. // -// 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. +// Software distributed under the License is distributed on an "AS IS" basis, +// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +// for the specific language governing rights and limitations under the License. +// +// The Original Code is Fraunhofer FOKUS code. +// +// The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. +// (registered association), Hansastraße 27 c, 80686 Munich, Germany. +// All Rights Reserved. +// +// Contributor(s): +// Stefan Bund /** \file \brief UDPPacket unit tests */ @@ -35,12 +40,12 @@ #include #define prefix_ -///////////////////////////////cc.p//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// SENF_AUTO_UNIT_TEST(udpPacket_parse) { - unsigned char data[] = { + unsigned char data[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }; @@ -57,12 +62,12 @@ SENF_AUTO_UNIT_TEST(udpPacket_parse) SENF_AUTO_UNIT_TEST(udpPacket_in_ipv4_create) { - unsigned char data[] = { + unsigned char data[] = { 0x45, 0x00, 0x00, 0x26, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11, 0x3c, 0xc5, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00, 0x00, 0x01, 0x5b, 0xa0, 0x30, 0x39, 0x00, 0x12, 0xfa, 0x6e, 0x54, 0x45, 0x53, 0x54, - 0x2d, 0x57, 0x52, 0x49, 0x54, 0x45 + 0x2d, 0x57, 0x52, 0x49, 0x54, 0x45 }; senf::IPv4Packet ip (senf::IPv4Packet::create()); @@ -81,7 +86,7 @@ SENF_AUTO_UNIT_TEST(udpPacket_in_ipv4_create) BOOST_CHECK( udp->validateChecksum() ); ip.finalizeAll(); - BOOST_CHECK_EQUAL_COLLECTIONS( + BOOST_CHECK_EQUAL_COLLECTIONS( data, data+sizeof(data), ip.data().begin(), ip.data().end() ); BOOST_CHECK( udp->validateChecksum() ); } @@ -89,7 +94,7 @@ SENF_AUTO_UNIT_TEST(udpPacket_in_ipv4_create) SENF_AUTO_UNIT_TEST(udpPacket_in_ipv6_parse) { // captured udp packet generated with mgen send over ipv6 - unsigned char data[] = { + unsigned char data[] = { // IPv6 Packet 0x60, 0x00, 0x00, 0x00, 0x00, 0x32, 0x11, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -104,7 +109,7 @@ SENF_AUTO_UNIT_TEST(udpPacket_in_ipv6_parse) 0x00, 0x09, 0x5b, 0x37, 0x13, 0x88, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00 + 0x00, 0x00 }; senf::IPv6Packet ip (senf::IPv6Packet::create(data)); @@ -113,22 +118,22 @@ SENF_AUTO_UNIT_TEST(udpPacket_in_ipv6_parse) BOOST_CHECK_EQUAL( ip->hopLimit(), 64u ); BOOST_CHECK_EQUAL( ip->source().value(), senf::INet6Address::Loopback ); BOOST_CHECK_EQUAL( ip->destination().value(), senf::INet6Address::Loopback ); - + std::ostringstream oss (std::ostringstream::out); SENF_CHECK_NO_THROW( ip.dump( oss)); - + BOOST_REQUIRE( ip.next().is() ); senf::UDPPacket udp (ip.next().as()); - + BOOST_CHECK_EQUAL( udp->source(), 5001u ); BOOST_CHECK_EQUAL( udp->destination(), 5000u ); BOOST_CHECK_EQUAL( udp->length(), 50u ); BOOST_CHECK_EQUAL( udp->checksum(), 0x1123 ); - + BOOST_CHECK( udp->validateChecksum() ); } -///////////////////////////////cc.e//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_