From: tho Date: Tue, 22 Sep 2009 08:26:11 +0000 (+0000) Subject: moved IPv6Extension option-list to defaultbundle X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=79615f135540eb93e24ac7720a9fecb08fba2842;p=senf.git moved IPv6Extension option-list to defaultbundle git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1428 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct b/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct index f498f28..201ccbd 100644 --- a/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct +++ b/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct @@ -20,7 +20,10 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -//#include "IPv6ExtOptionType.hh" +/** \file + \brief IPv6Extension-Options non-inline template implementation */ + +//#include "IPv6ExtOptionType.ih" // Custom includes diff --git a/senf/Packets/DefaultBundle/IPv6ExtOptionType.hh b/senf/Packets/DefaultBundle/IPv6ExtOptionType.hh index 48c8e73..d2b7dce 100644 --- a/senf/Packets/DefaultBundle/IPv6ExtOptionType.hh +++ b/senf/Packets/DefaultBundle/IPv6ExtOptionType.hh @@ -1,6 +1,6 @@ // $Id: IPv6ExtOptionType.hh 869 2008-06-09 13:57:27Z pug $ // -// Copyright (C) 2007 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Philipp.Batroff@fokus.fraunhofer.de @@ -20,8 +20,11 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifndef HH_SENF_Packets_DefaultBundle_IPV6EXTOPTIONTYPE_HH_ -#define HH_SENF_Packets_DefaultBundle_IPV6EXTOPTIONTYPE_HH_1 +/** \file + \brief IPv6Extension-Options public header */ + +#ifndef HH_SENF_Packets_DefaultBundle_IPv6ExtOptionType_HH_ +#define HH_SENF_Packets_DefaultBundle_IPv6ExtOptionType_HH_ 1 // Custom includes #include @@ -30,40 +33,38 @@ ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { -class OptTypeTLVPacketParser: public PacketParserBase { -public: + class OptTypeTLVPacketParser : public PacketParserBase + { + public: # include SENF_PARSER() - SENF_PARSER_BITFIELD (altAction, 2, unsigned); - SENF_PARSER_BITFIELD (changeFlag, 1, unsigned); - SENF_PARSER_BITFIELD (optionType, 5, unsigned); -// SENF_PARSER_FIELD (optionType, UInt8Parser); - SENF_PARSER_FIELD (optionLength, UInt8Parser); - SENF_PARSER_FINALIZE (OptTypeTLVPacketParser); - -}; //OptTypeTLVPacketParser + SENF_PARSER_BITFIELD (altAction, 2, unsigned); + SENF_PARSER_BITFIELD (changeFlag, 1, unsigned); + SENF_PARSER_BITFIELD (optionType, 5, unsigned); + SENF_PARSER_FIELD (optionLength, UInt8Parser); + SENF_PARSER_FINALIZE (OptTypeTLVPacketParser); + }; -struct GenericOptTypeTLVPacketParser: public OptTypeTLVPacketParser { + struct GenericOptTypeTLVPacketParser : public OptTypeTLVPacketParser + { # include SENF_PARSER() - SENF_PARSER_INHERIT ( OptTypeTLVPacketParser ); - SENF_PARSER_SKIP ( optionLength(), 0 ); - SENF_PARSER_FINALIZE ( GenericOptTypeTLVPacketParser ); - - - senf::PacketInterpreterBase::range value() const; + SENF_PARSER_INHERIT ( OptTypeTLVPacketParser ); + SENF_PARSER_SKIP ( optionLength(), 0 ); + SENF_PARSER_FINALIZE ( GenericOptTypeTLVPacketParser ); - template - void value(ForwardReadableRange const &range); + senf::PacketInterpreterBase::range value() const; -}; + template + void value(ForwardReadableRange const &range); + }; -} //namespace senf +} ///////////////////////////////hh.e//////////////////////////////////////// //#include "IPv6ExtOptionType.cci" #include "IPv6ExtOptionType.ct" //#include "IPv6ExtOptionType.cti" -#endif /* HH_SENF_Packets_DefaultBundle_IPV6EXTOPTIONTYPE_HH_ */ +#endif // Local Variables: // mode: c++ diff --git a/senf/Packets/DefaultBundle/IPv6Extensions.hh b/senf/Packets/DefaultBundle/IPv6Extensions.hh index 5f6ba13..1b9a1ef 100644 --- a/senf/Packets/DefaultBundle/IPv6Extensions.hh +++ b/senf/Packets/DefaultBundle/IPv6Extensions.hh @@ -29,10 +29,10 @@ // Custom includes #include #include -#include #include - +#include "ListOptionTypeParser.hh" #include "IPv6Packet.hh" + //#include "IPv6Extensions.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -52,11 +52,9 @@ namespace senf { SENF_PARSER_FIELD ( nextHeader , UInt8Parser ); SENF_PARSER_PRIVATE_FIELD ( reserved1 , UInt8Parser ); - SENF_PARSER_BITFIELD ( fragmentOffset , 13, unsigned ); SENF_PARSER_PRIVATE_BITFIELD ( reserved2 , 2, unsigned ); SENF_PARSER_BITFIELD ( moreFragments , 1, bool ); - SENF_PARSER_FIELD ( id , UInt32Parser ); SENF_PARSER_FINALIZE(IPv6PacketParserExtension_Fragment); @@ -113,10 +111,10 @@ namespace senf { /** \brief Parse in IPv6 routing extension header Parser implementing the IPv6 routing Header extension. The fields implemented are: - \image html IPv6Extensions_Routing.png + \image html IPv6Extensions_Routing.png - \see IPv6ExtensionType_Routing \n - RFC 2460 + \see IPv6ExtensionType_Routing \n + RFC 2460 */ //Routing Header Extension (type 0 only) @@ -190,7 +188,6 @@ The Type 0 Routing header has the following format: (RFC 2460) struct IPv6ExtensionType_Routing : public PacketTypeBase, public PacketTypeMixin - { #ifndef DOXYGEN typedef PacketTypeMixin mixin; diff --git a/senf/Packets/DefaultBundle/IPv6Extensions.test.cc b/senf/Packets/DefaultBundle/IPv6Extensions.test.cc index 8be4f32..d5976c0 100644 --- a/senf/Packets/DefaultBundle/IPv6Extensions.test.cc +++ b/senf/Packets/DefaultBundle/IPv6Extensions.test.cc @@ -38,7 +38,7 @@ #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// -BOOST_AUTO_UNIT_TEST(ipv6Extensions) +BOOST_AUTO_UNIT_TEST(ipv6Extensions_fragment) { // Just for the fun of it, we test a nice chain: A fragment of a fragmented UDP packet @@ -71,8 +71,10 @@ BOOST_AUTO_UNIT_TEST(ipv6Extensions) BOOST_CHECK_EQUAL( pFragment_packet->version(), 6u ); BOOST_CHECK_EQUAL( pFragment_packet->length(), 20u ); BOOST_CHECK_EQUAL( pFragment_packet->nextHeader(), 44u ); - BOOST_CHECK_EQUAL( pFragment_packet->source().value(), senf::INet6Address::from_string("2001::1") ); - BOOST_CHECK_EQUAL( pFragment_packet->destination().value(), senf::INet6Address::from_string("2001::2") ); + BOOST_CHECK_EQUAL( pFragment_packet->source().value(), + senf::INet6Address::from_string("2001::1") ); + BOOST_CHECK_EQUAL( pFragment_packet->destination().value(), + senf::INet6Address::from_string("2001::2") ); std::ostringstream oss (std::ostringstream::out); SENF_CHECK_NO_THROW( pFragment_packet.dump( oss)); @@ -97,27 +99,31 @@ BOOST_AUTO_UNIT_TEST(ipv6Extensions) senf::PacketData::iterator i (uFragment_packet.next().data().begin()); BOOST_CHECK_EQUAL( dFragment_packet.size(), 4u ); BOOST_CHECK_EQUAL( dFragment_packet.data()[0], 0x11 ); +} - //============================================================================================== - + +BOOST_AUTO_UNIT_TEST(ipv6Extensions_routing) +{ unsigned char Routing_packetData[] = { // IP header 0x60, 0x30, 0x00, 0x00, - 0x00, 0x10, //payload Length - 0x2b, //next Header (43 = Routing Header) - 0xff, //Hop Limit - 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x02, 0xff, 0xfe, 0x00, 0x02, 0x00, //Src Addr - 0x35, 0x55, 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77, 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, //Dest. Addr - //Routing Header - 0x3a, //nextHeader (58) - 0x00, //Length ( 0 ) - 0x00, //routing type ( 0 ) - 0x00, //Left Segments ( 0 ) - 0x00, 0x00, 0x00, 0x00, //reserved - //ICMPv6 - 0x01, //type: 1 (unreachable ) - 0x00, //code: 0 (route unreachable) - 0xa3, 0xd3, //checksum (incorrect in wireshark capture file, should be 0xa3c4) + 0x00, 0x10, // payload Length + 0x2b, // next Header (43 = Routing Header) + 0xff, // Hop Limit + 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x01, 0x02, 0xff, 0xfe, 0x00, 0x02, 0x00, // Src Addr + 0x35, 0x55, 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, + 0x77, 0x77, 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, // Dest. Addr + // Routing Header + 0x3a, // nextHeader (58) + 0x00, // length ( 0 ) + 0x00, // routing type ( 0 ) + 0x00, // Left Segments ( 0 ) + 0x00, 0x00, 0x00, 0x00, // reserved + // ICMPv6 + 0x01, // type: 1 (unreachable ) + 0x00, // code: 0 (route unreachable) + 0xa3, 0xd3, // checksum (incorrect in wireshark capture file, should be 0xa3c4) 0x00, 0x00, 0x00, 0x00 }; @@ -126,8 +132,12 @@ BOOST_AUTO_UNIT_TEST(ipv6Extensions) BOOST_CHECK_EQUAL( pRouting_packet->version(), 6u ); BOOST_CHECK_EQUAL( pRouting_packet->length(), 16u ); BOOST_CHECK_EQUAL( pRouting_packet->nextHeader(), 43u ); - BOOST_CHECK_EQUAL( pRouting_packet->source().value(), senf::INet6Address::from_string("fe80::201:2ff:fe00:200") ); - BOOST_CHECK_EQUAL( pRouting_packet->destination().value(), senf::INet6Address::from_string("3555:5555:6666:6666:7777:7777:8888:8888")); + BOOST_CHECK_EQUAL( pRouting_packet->source().value(), + senf::INet6Address::from_string("fe80::201:2ff:fe00:200") ); + BOOST_CHECK_EQUAL( pRouting_packet->destination().value(), + senf::INet6Address::from_string("3555:5555:6666:6666:7777:7777:8888:8888")); + + std::ostringstream oss (std::ostringstream::out); SENF_CHECK_NO_THROW( pRouting_packet.dump( oss)); BOOST_REQUIRE( pRouting_packet.next().is() ); @@ -147,57 +157,50 @@ BOOST_AUTO_UNIT_TEST(ipv6Extensions) BOOST_CHECK_EQUAL( pICMPv6->code(), 0u); BOOST_CHECK_EQUAL( pICMPv6->checksum(), 0xa3d3); } - //============================================================================================== - + + BOOST_AUTO_UNIT_TEST(ipv6Extensions_hopByHop_parse) { unsigned char HopByHop_packetData[] = { - 0x60, 0x00, 0x00, 0x00, //IP version, class, flow label - 0x00, 0x24, //payload length - 0x00, //next header: IPv6 hop-by-hop option (0) - 0x01, //hop limit (1) - 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //IPv6 Source address (fe80::219:b9ff:feeb:b226) - 0x02, 0x19, 0xb9, 0xff, 0xfe, 0xeb, 0xb2, 0x26, - - 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //IPv6 Destination address ff02::16 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - //HopByHop option - 0x3a, //next Header (ICMPv6) - 0x00, //Length (0 = 8Bytes) - - //option Header - 0x05, //option type - 0x02, //option Length (= 2 byte) + 0x60, 0x00, 0x00, 0x00, // IP version, class, flow label + 0x00, 0x24, // payload length + 0x00, // next header: IPv6 hop-by-hop option (0) + 0x01, // hop limit (1) + 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x19, 0xb9, 0xff, 0xfe, 0xeb, 0xb2, 0x26, // IPv6 Source address + 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, // IPv6 Destination address ff02::16 + // HopByHop option + 0x3a, // next Header (ICMPv6) + 0x00, // Length (0 = 8Bytes) + // option Header + 0x05, // option type + 0x02, // option Length (= 2 byte) 0x00, 0x00, //data (zero data here ...) - 0x02, //option type (2, set for testing purposes only) 0x00, //option Type length (=0, no data field needed here) - - //ICMPv6 - 0x8f, //type 143 - 0x00, //code 0, should always be 0 - 0x50, 0xcc, //checksum + // ICMPv6 + 0x8f, // type 143 + 0x00, // code 0, should always be 0 + 0x50, 0xcc, // checksum }; - std::ostringstream oss (std::ostringstream::out); - senf::IPv6Packet pHop_packet (senf::IPv6Packet::create(HopByHop_packetData)); BOOST_CHECK_EQUAL( pHop_packet->version(), 6u ); BOOST_CHECK_EQUAL( pHop_packet->length(), 36u ); BOOST_CHECK_EQUAL( pHop_packet->nextHeader(), 0u ); - BOOST_CHECK_EQUAL( pHop_packet->source().value(), senf::INet6Address::from_string("fe80::219:b9ff:feeb:b226") ); + BOOST_CHECK_EQUAL( pHop_packet->source().value(), + senf::INet6Address::from_string("fe80::219:b9ff:feeb:b226") ); BOOST_CHECK_EQUAL( pHop_packet->destination().value(), senf::INet6Address::from_string("ff02::16") ); + std::ostringstream oss (std::ostringstream::out); SENF_CHECK_NO_THROW( pHop_packet.dump( oss )); - BOOST_REQUIRE( pHop_packet.next().is() ); - //hopByHop extension header + BOOST_REQUIRE( pHop_packet.next().is() ); senf::IPv6Extension_HopByHop pHop_extension (pHop_packet.next().as()); BOOST_CHECK_EQUAL( pHop_extension->nextHeader(), 58u ); BOOST_CHECK_EQUAL( pHop_extension->headerLength(), 0x00 ); - SENF_CHECK_NO_THROW( pHop_extension.dump( oss )); - pHop_extension.dump(oss); senf::IPv6Extension_HopByHop::Parser::options_t::container optC(pHop_extension->options() ); senf::IPv6Extension_HopByHop::Parser::options_t::container::iterator listIter (optC.begin()); @@ -210,7 +213,6 @@ BOOST_AUTO_UNIT_TEST(ipv6Extensions_hopByHop_parse) BOOST_CHECK_EQUAL( listIter->changeFlag(), 0u); BOOST_CHECK_EQUAL( listIter->optionType(), 2u); BOOST_CHECK_EQUAL( listIter->optionLength(), 0); - pHop_extension.dump(oss); BOOST_REQUIRE( pHop_extension.next().is() ); senf::ICMPv6Packet pICMPv6 (pHop_extension.next().as()); diff --git a/senf/Packets/ListOptionTypeParser.cti b/senf/Packets/DefaultBundle/ListOptionTypeParser.cti similarity index 99% rename from senf/Packets/ListOptionTypeParser.cti rename to senf/Packets/DefaultBundle/ListOptionTypeParser.cti index 819f15e..c01fb88 100644 --- a/senf/Packets/ListOptionTypeParser.cti +++ b/senf/Packets/DefaultBundle/ListOptionTypeParser.cti @@ -1,6 +1,6 @@ // $Id: ListOptionTypeParser.cti 869 2008-06-09 13:57:27Z pug $ // -// Copyright (C) 2007 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Philipp.Batroff@fokus.fraunhofer.de @@ -21,7 +21,7 @@ // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /** \file - \brief ListOptionTypeParser inline template implementation */ + \brief ListOptionTypeParser inline template implementation */ #include "ListOptionTypeParser.ih" diff --git a/senf/Packets/ListOptionTypeParser.hh b/senf/Packets/DefaultBundle/ListOptionTypeParser.hh similarity index 86% rename from senf/Packets/ListOptionTypeParser.hh rename to senf/Packets/DefaultBundle/ListOptionTypeParser.hh index bec6708..6eb2ec8 100644 --- a/senf/Packets/ListOptionTypeParser.hh +++ b/senf/Packets/DefaultBundle/ListOptionTypeParser.hh @@ -1,6 +1,6 @@ // $Id: ListOptionTypeParser.hh 965 2008-11-18 16:04:20Z pug $ // -// Copyright (C) 2007 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Philipp.Batroff@fokus.fraunhofer.de @@ -21,13 +21,12 @@ // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /** \file - \brief ListOptionTypeParser public header */ + \brief ListOptionTypeParser public header */ #ifndef HH_SENF_Packets_ListOptionTypeParser_ #define HH_SENF_Packets_ListOptionTypeParser_ 1 // Custom includes -#include "ListParser.hh" //#include "ListOptionTypeParser.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -37,9 +36,6 @@ namespace senf { } ///////////////////////////////hh.e//////////////////////////////////////// -#endif -#if !defined(HH_SENF_Packets_Packets__decls_) && !defined(HH_SENF_Packets_ListOptionTypeParser_i_) -#define HH_SENF_Packets_ListOptionTypeParser_i_ //#include "ListOptionTypeParser.cci" //#include "ListOptionTypeParser.ct" #include "ListOptionTypeParser.cti" diff --git a/senf/Packets/ListOptionTypeParser.ih b/senf/Packets/DefaultBundle/ListOptionTypeParser.ih similarity index 97% rename from senf/Packets/ListOptionTypeParser.ih rename to senf/Packets/DefaultBundle/ListOptionTypeParser.ih index 9743a50..5894386 100644 --- a/senf/Packets/ListOptionTypeParser.ih +++ b/senf/Packets/DefaultBundle/ListOptionTypeParser.ih @@ -1,6 +1,6 @@ // $Id: ListOptionTypeParser.ih 965 2008-11-18 16:04:20Z pug $ // -// Copyright (C) 2007 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Philipp.Batroff@fokus.fraunhofer.de @@ -21,13 +21,13 @@ // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /** \file - \brief ListOptionTypeParser internal header */ + \brief ListOptionTypeParser internal header */ #ifndef IH_SENF_Packets_ListOptionTypeParser_ #define IH_SENF_Packets_ListOptionTypeParser_ 1 // Custom includes -#include "ListParser.ih" +#include ///////////////////////////////ih.p//////////////////////////////////////// diff --git a/senf/Packets/ListOptionTypeParser.test.cc b/senf/Packets/DefaultBundle/ListOptionTypeParser.test.cc similarity index 97% rename from senf/Packets/ListOptionTypeParser.test.cc rename to senf/Packets/DefaultBundle/ListOptionTypeParser.test.cc index b3105ab..c30be0f 100644 --- a/senf/Packets/ListOptionTypeParser.test.cc +++ b/senf/Packets/DefaultBundle/ListOptionTypeParser.test.cc @@ -1,6 +1,6 @@ // $Id: ListOptionTypeParser.test.cc 1345 2009-08-26 15:40:55Z pug $ // -// Copyright (C) 2007 +// Copyright (C) 2009 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Philipp Batroff @@ -21,12 +21,11 @@ // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Custom includes -#include "Packets.hh" -#include +#include +#include "IPv6ExtOptionType.hh" +#include "ListOptionTypeParser.hh" -#include #include - #include #define prefix_ diff --git a/senf/Packets/Packets.hh b/senf/Packets/Packets.hh index a3d8ebd..087d012 100644 --- a/senf/Packets/Packets.hh +++ b/senf/Packets/Packets.hh @@ -42,7 +42,6 @@ #include "ListParser.hh" #include "ListBParser.hh" #include "ListNParser.hh" -#include "ListOptionTypeParser.hh" #include "VariantParser.hh" #include "VectorParser.hh" #include "ParseHelpers.hh" @@ -66,7 +65,6 @@ #include "ListParser.hh" #include "ListBParser.hh" #include "ListNParser.hh" -#include "ListOptionTypeParser.hh" #include "VariantParser.hh" #include "VectorParser.hh" #include "ParseHelpers.hh" diff --git a/senf/Utils/Daemon/Daemon.cc b/senf/Utils/Daemon/Daemon.cc index b84e759..e5ed13b 100644 --- a/senf/Utils/Daemon/Daemon.cc +++ b/senf/Utils/Daemon/Daemon.cc @@ -569,7 +569,9 @@ prefix_ void senf::Daemon::installSighandlers() ::sigaction(SIGFPE, &sa, NULL); ::sigaction(SIGBUS, &sa, NULL); ::sigaction(SIGSEGV, &sa, NULL); +#ifdef SIGSTKFLT //SIGSTKFLT is used for stack faults on coprocessors. That condition doesn't exist on MIPS ::sigaction(SIGSTKFLT, &sa, NULL); +#endif ::sigaction(SIGSYS, &sa, NULL); ::sigaction(SIGUSR2, &sa, NULL); #endif