From: pug Date: Wed, 23 Sep 2009 09:40:34 +0000 (+0000) Subject: changed IPv6 Extension Header naming conventions X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=943a0081e419e87e958889eb630f09180a9c196c;p=senf.git changed IPv6 Extension Header naming conventions git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1430 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Packets/DefaultBundle/IPv6ExtOptionType.cc b/senf/Packets/DefaultBundle/IPv6ExtOptionType.cc index a20bf07..cde5f4e 100644 --- a/senf/Packets/DefaultBundle/IPv6ExtOptionType.cc +++ b/senf/Packets/DefaultBundle/IPv6ExtOptionType.cc @@ -27,7 +27,7 @@ #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// -prefix_ senf::PacketInterpreterBase::range senf::GenericOptTypeTLVPacketParser::value() const { +prefix_ senf::PacketInterpreterBase::range senf::GenericOptTypeTLVParser::value() const { senf::PacketData::iterator begin (boost::next(i(), 2 )); return PacketInterpreterBase::range(begin, boost::next( begin, optionLength()) ); } diff --git a/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct b/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct index d816433..6cb4c62 100644 --- a/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct +++ b/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct @@ -31,18 +31,10 @@ ///////////////////////////////ct.p//////////////////////////////////////// template -prefix_ void senf::GenericOptTypeTLVPacketParser::value(ForwardReadableRange const &range) +prefix_ void senf::GenericOptTypeTLVParser::value(ForwardReadableRange const &range) { unsigned int rangeSize = boost::size(range); safe_data_iterator si( data(), boost::next(i(), 2 + optionLength() ) ); -// if ( rangeSize > optionLength() ){ -// std::cout << "rangeSize > optionLength()" << std::endl; -// data().insert(si, rangeSize - optionLength(),0 ); -// } -// if (rangeSize < optionLength() ){ -// std::cout << "rangeSize < optionLength()" << std::endl; -// data().erase(si, si + (optionLength() - rangeSize)); -// } if ( (rangeSize-2) != optionLength() ) resize(optionLength()+2, rangeSize); @@ -58,7 +50,7 @@ prefix_ void senf::GenericOptTypeTLVPacketParser::value(ForwardReadableRange con } template -prefix_ void senf::GenericOptTypeTLVPacketParser::setPayload(ForwardReadableRange const &range) +prefix_ void senf::GenericOptTypeTLVParser::setPayload(ForwardReadableRange const &range) { unsigned int rangeSize = boost::size(range); if ( rangeSize != optionLength() ) @@ -70,7 +62,7 @@ prefix_ void senf::GenericOptTypeTLVPacketParser::setPayload(ForwardReadableRang template -prefix_ Parser& senf::GenericOptTypeTLVPacketParser::init() +prefix_ Parser& senf::GenericOptTypeTLVParser::init() { size_type oldSize ( bytes() ); safe_data_iterator j( data(), i() ); @@ -82,7 +74,7 @@ prefix_ Parser& senf::GenericOptTypeTLVPacketParser::init() } // template -// prefix_ Parser& senf::GenericOptTypeTLVPacketParser::get() +// prefix_ Parser& senf::GenericOptTypeTLVParser::get() // { // SENF_ASSERT (optionType() == typeCode); // return *(this); diff --git a/senf/Packets/DefaultBundle/IPv6ExtOptionType.hh b/senf/Packets/DefaultBundle/IPv6ExtOptionType.hh index f1e8cc5..0811d11 100644 --- a/senf/Packets/DefaultBundle/IPv6ExtOptionType.hh +++ b/senf/Packets/DefaultBundle/IPv6ExtOptionType.hh @@ -33,7 +33,7 @@ ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { - class OptTypeTLVPacketParser : public PacketParserBase + class OptTypeTLVParser : public PacketParserBase { public: # include SENF_PARSER() @@ -41,15 +41,15 @@ namespace senf { SENF_PARSER_BITFIELD (changeFlag, 1, unsigned); SENF_PARSER_BITFIELD (optionType, 5, unsigned); SENF_PARSER_FIELD (optionLength, UInt8Parser); - SENF_PARSER_FINALIZE (OptTypeTLVPacketParser); + SENF_PARSER_FINALIZE (OptTypeTLVParser); }; - struct GenericOptTypeTLVPacketParser : public OptTypeTLVPacketParser + struct GenericOptTypeTLVParser : public OptTypeTLVParser { # include SENF_PARSER() - SENF_PARSER_INHERIT ( OptTypeTLVPacketParser ); + SENF_PARSER_INHERIT ( OptTypeTLVParser ); SENF_PARSER_SKIP ( optionLength(), 0 ); - SENF_PARSER_FINALIZE ( GenericOptTypeTLVPacketParser ); + SENF_PARSER_FINALIZE ( GenericOptTypeTLVParser ); senf::PacketInterpreterBase::range value() const; diff --git a/senf/Packets/DefaultBundle/IPv6Extensions.cc b/senf/Packets/DefaultBundle/IPv6Extensions.cc index 83f9802..b786f71 100644 --- a/senf/Packets/DefaultBundle/IPv6Extensions.cc +++ b/senf/Packets/DefaultBundle/IPv6Extensions.cc @@ -33,17 +33,17 @@ ///////////////////////////////cc.p//////////////////////////////////////// namespace { - senf::PacketRegistry::RegistrationProxy - registerIPv6ExtensionType_Fragment (44); - senf::PacketRegistry::RegistrationProxy - registerIPv6ExtensionType_Routing (43); - senf::PacketRegistry::RegistrationProxy - registerIPv6ExtensionType_HopByHop (0u); - senf::PacketRegistry::RegistrationProxy - registerIPv6ExtensionType_Destination (60u); + senf::PacketRegistry::RegistrationProxy + registerIPv6FragmentType (44); + senf::PacketRegistry::RegistrationProxy + registerIPv6RoutingType (43); + senf::PacketRegistry::RegistrationProxy + registerIPv6HopByHopType (0u); + senf::PacketRegistry::RegistrationProxy + registerIPv6DestinationType (60u); } -prefix_ void senf::IPv6ExtensionType_Fragment::dump(packet p, std::ostream & os) +prefix_ void senf::IPv6FragmentType::dump(packet p, std::ostream & os) { os << "Internet protocol Version 6 fragment extension:\n" << " next header : " << unsigned(p->nextHeader()) << "\n" @@ -52,29 +52,29 @@ prefix_ void senf::IPv6ExtensionType_Fragment::dump(packet p, std::ostream & os) << " id : " << std::hex << unsigned(p->id()) << "\n"; } -prefix_ void senf::IPv6ExtensionType_Routing::dump(packet p, std::ostream & os) +prefix_ void senf::IPv6RoutingType::dump(packet p, std::ostream & os) { os << "Internet protocol Version 6 routing extension:\n" << " next header : " << unsigned (p->nextHeader()) << "\n" << " header length : " << unsigned (p->headerLength()) << "\n" << " routing type : " << unsigned (p->routingType()) << "\n" << " segments left : " << unsigned (p->segmentsLeft()) << "\n"; - IPv6Extension_Routing::Parser::hopAddresses_t::container hopAddresses (p->hopAddresses()); + IPv6Routing::Parser::hopAddresses_t::container hopAddresses (p->hopAddresses()); os << " further Hop Addresses : \n"; if ( p->segmentsLeft() != 0 ){ - for (IPv6Extension_Routing::Parser::hopAddresses_t::container::iterator i (hopAddresses.begin()); i != hopAddresses.end(); ++i) + for (IPv6Routing::Parser::hopAddresses_t::container::iterator i (hopAddresses.begin()); i != hopAddresses.end(); ++i) os << *i << "\n"; } } -prefix_ void senf::IPv6ExtensionType_HopByHop::dump(packet p, std::ostream & os) +prefix_ void senf::IPv6HopByHopType::dump(packet p, std::ostream & os) { os << "Internet protocol Version 6 Hop-By-Hop extension:\n" << " next header : " << unsigned (p->nextHeader()) << "\n" << " header length : " << unsigned (p->headerLength()) << "\n"; os << " OptionTypes:\n"; - IPv6Extension_HopByHop::Parser::options_t::container options (p->options()); - IPv6Extension_HopByHop::Parser::options_t::container::iterator optIter(options.begin()); + IPv6HopByHop::Parser::options_t::container options (p->options()); + IPv6HopByHop::Parser::options_t::container::iterator optIter(options.begin()); for(;optIter != options.end(); ++optIter){ os << " AltAction : " << (unsigned) optIter->altAction() << "\n ChangeFlag : " << (unsigned) optIter->changeFlag() @@ -84,7 +84,7 @@ prefix_ void senf::IPv6ExtensionType_HopByHop::dump(packet p, std::ostream & os) } } -prefix_ void senf::IPv6ExtensionType_Destination::dump(packet p, std::ostream & os) +prefix_ void senf::IPv6DestinationType::dump(packet p, std::ostream & os) { os << "Internet protocol Version 6 Destination Options extension:\n" << " next header : " << unsigned (p->nextHeader()) << "\n" diff --git a/senf/Packets/DefaultBundle/IPv6Extensions.hh b/senf/Packets/DefaultBundle/IPv6Extensions.hh index 1b9a1ef..b08ca4b 100644 --- a/senf/Packets/DefaultBundle/IPv6Extensions.hh +++ b/senf/Packets/DefaultBundle/IPv6Extensions.hh @@ -46,7 +46,7 @@ namespace senf { \see IPv6ExtensionType_Fragment \n RFC 2460 */ - struct IPv6PacketParserExtension_Fragment : public PacketParserBase + struct IPv6FragmentPacketParser : public PacketParserBase { # include SENF_FIXED_PARSER() @@ -57,7 +57,7 @@ namespace senf { SENF_PARSER_BITFIELD ( moreFragments , 1, bool ); SENF_PARSER_FIELD ( id , UInt32Parser ); - SENF_PARSER_FINALIZE(IPv6PacketParserExtension_Fragment); + SENF_PARSER_FINALIZE(IPv6FragmentPacketParser); }; /** \brief IPv6 fragment extension @@ -76,17 +76,17 @@ namespace senf { \ingroup protocolbundle_default */ - struct IPv6ExtensionType_Fragment + struct IPv6FragmentType : public PacketTypeBase, - public PacketTypeMixin + public PacketTypeMixin { #ifndef DOXYGEN - typedef PacketTypeMixin mixin; + typedef PacketTypeMixin mixin; #endif /** \brief IPv6 fragment extension packet typedef */ - typedef ConcretePacket packet; + typedef ConcretePacket packet; /** \brief typedef to the parser of IPv6 fragment extension packet */ - typedef IPv6PacketParserExtension_Fragment parser; + typedef IPv6FragmentPacketParser parser; using mixin::nextPacketRange; using mixin::nextPacketType; @@ -104,7 +104,7 @@ namespace senf { }; /** \brief IPv6 fragment extension packet typedef */ - typedef ConcretePacket IPv6Extension_Fragment; + typedef ConcretePacket IPv6Fragment; // ===================================================================================================== @@ -118,7 +118,7 @@ namespace senf { */ //Routing Header Extension (type 0 only) - struct IPv6PacketParserExtension_Routing : public PacketParserBase + struct IPv6PRoutingPacketParser : public PacketParserBase { /* The Type 0 Routing header has the following format: (RFC 2460) @@ -159,7 +159,7 @@ The Type 0 Routing header has the following format: (RFC 2460) SENF_PARSER_FIELD ( reserved, UInt32Parser ); //set to zero by RFC SENF_PARSER_VECTOR ( hopAddresses, segmentsLeft, INet6AddressParser ); - SENF_PARSER_FINALIZE ( IPv6PacketParserExtension_Routing ); + SENF_PARSER_FINALIZE ( IPv6PRoutingPacketParser ); //provisionary, since only type 0 is implemented SENF_PARSER_INIT() { @@ -185,17 +185,17 @@ The Type 0 Routing header has the following format: (RFC 2460) \ingroup protocolbundle_default */ - struct IPv6ExtensionType_Routing + struct IPv6RoutingType : public PacketTypeBase, - public PacketTypeMixin + public PacketTypeMixin { #ifndef DOXYGEN - typedef PacketTypeMixin mixin; + typedef PacketTypeMixin mixin; #endif /** \brief IPv6 routing extension packet typedef */ - typedef ConcretePacket packet; + typedef ConcretePacket packet; /** \brief typedef to the parser of IPv6 routing extension packet */ - typedef IPv6PacketParserExtension_Routing parser; + typedef IPv6PRoutingPacketParser parser; using mixin::nextPacketRange; using mixin::nextPacketType; @@ -212,7 +212,7 @@ The Type 0 Routing header has the following format: (RFC 2460) }; /** \brief IPv6 routing extension packet typedef */ - typedef ConcretePacket IPv6Extension_Routing; + typedef ConcretePacket IPv6Routing; // ===================================================================================================== @@ -228,18 +228,18 @@ The Type 0 Routing header has the following format: (RFC 2460) // Hop-By-Hop Extension Header - struct IPv6PacketParserExtension_HopByHop : public PacketParserBase { + struct IPv6HopByHopPacketParser : public PacketParserBase { # include SENF_PARSER() SENF_PARSER_FIELD ( nextHeader, UInt8Parser ); SENF_PARSER_FIELD ( headerLength, UInt8Parser ); typedef detail::FixedAuxParserPolicy ListOptionTypeAuxPolicy; - typedef detail::ListOptionTypeParser_Policy ListOptionTypePolicy; + typedef detail::ListOptionTypeParser_Policy ListOptionTypePolicy; typedef ListParser ListOptionTypeParser; SENF_PARSER_FIELD ( options, ListOptionTypeParser); - SENF_PARSER_FINALIZE ( IPv6PacketParserExtension_HopByHop ); + SENF_PARSER_FINALIZE ( IPv6HopByHopPacketParser ); }; /** \brief IPv6 Hop-By-Hop extension @@ -259,17 +259,17 @@ The Type 0 Routing header has the following format: (RFC 2460) \ingroup protocolbundle_default */ - struct IPv6ExtensionType_HopByHop + struct IPv6HopByHopType : public PacketTypeBase, - public PacketTypeMixin + public PacketTypeMixin { #ifndef DOXYGEN - typedef PacketTypeMixin mixin; + typedef PacketTypeMixin mixin; #endif /** \brief IPv6 Hop-By-Hop extension packet typedef */ - typedef ConcretePacket packet; + typedef ConcretePacket packet; /** \brief typedef to the parser of IPv6 Hop-By-Hop extension packet */ - typedef IPv6PacketParserExtension_HopByHop parser; + typedef IPv6HopByHopPacketParser parser; using mixin::nextPacketRange; using mixin::nextPacketType; @@ -286,7 +286,7 @@ The Type 0 Routing header has the following format: (RFC 2460) }; /** \brief IPv6 routing Hop-By-Hop packet typedef */ - typedef ConcretePacket IPv6Extension_HopByHop; + typedef ConcretePacket IPv6HopByHop; // ===================================================================================================== @@ -301,13 +301,13 @@ The Type 0 Routing header has the following format: (RFC 2460) // Destination Options skeleton without TLV-Options - struct IPv6PacketParserExtension_Destination : public PacketParserBase { + struct IPv6DestinationPacketParser : public PacketParserBase { # include SENF_PARSER() SENF_PARSER_FIELD ( nextHeader, UInt8Parser ); SENF_PARSER_FIELD ( headerLength, UInt8Parser ); - SENF_PARSER_FINALIZE ( IPv6PacketParserExtension_Destination ); + SENF_PARSER_FINALIZE ( IPv6DestinationPacketParser ); }; /** \brief IPv6 Destination Options extension @@ -327,17 +327,17 @@ The Type 0 Routing header has the following format: (RFC 2460) \ingroup protocolbundle_default */ - struct IPv6ExtensionType_Destination + struct IPv6DestinationType : public PacketTypeBase, - public PacketTypeMixin + public PacketTypeMixin { #ifndef DOXYGEN - typedef PacketTypeMixin mixin; + typedef PacketTypeMixin mixin; #endif /** \brief IPv6 Destination Options extension packet typedef */ - typedef ConcretePacket packet; + typedef ConcretePacket packet; /** \brief typedef to the parser of IPv6 Destination Options extension packet */ - typedef IPv6PacketParserExtension_Destination parser; + typedef IPv6DestinationPacketParser parser; using mixin::nextPacketRange; using mixin::nextPacketType; @@ -354,7 +354,7 @@ The Type 0 Routing header has the following format: (RFC 2460) }; /** \brief IPv6 routing Destination Options packet typedef */ - typedef ConcretePacket IPv6Extension_Destination; + typedef ConcretePacket IPv6Destination; } //namespace senf diff --git a/senf/Packets/DefaultBundle/IPv6Extensions.test.cc b/senf/Packets/DefaultBundle/IPv6Extensions.test.cc index b629e2f..9451b44 100644 --- a/senf/Packets/DefaultBundle/IPv6Extensions.test.cc +++ b/senf/Packets/DefaultBundle/IPv6Extensions.test.cc @@ -80,9 +80,9 @@ BOOST_AUTO_UNIT_TEST(ipv6Extensions_fragment) std::ostringstream oss (std::ostringstream::out); SENF_CHECK_NO_THROW( pFragment_packet.dump( oss)); - BOOST_CHECK( pFragment_packet.next().is() ); + BOOST_CHECK( pFragment_packet.next().is() ); - senf::IPv6Extension_Fragment fFragment_packet (pFragment_packet.next().as()); + senf::IPv6Fragment fFragment_packet (pFragment_packet.next().as()); BOOST_CHECK_EQUAL( fFragment_packet->nextHeader(), 17u ); BOOST_CHECK_EQUAL( fFragment_packet->fragmentOffset(), 160u ); @@ -141,9 +141,9 @@ BOOST_AUTO_UNIT_TEST(ipv6Extensions_routing) std::ostringstream oss (std::ostringstream::out); SENF_CHECK_NO_THROW( pRouting_packet.dump( oss)); - BOOST_REQUIRE( pRouting_packet.next().is() ); + BOOST_REQUIRE( pRouting_packet.next().is() ); - senf::IPv6Extension_Routing pRouting_extension (pRouting_packet.next().as()); + senf::IPv6Routing pRouting_extension (pRouting_packet.next().as()); BOOST_CHECK_EQUAL( pRouting_extension->nextHeader(), 58u ); BOOST_CHECK_EQUAL( pRouting_extension->headerLength(), 0x00 ); @@ -197,13 +197,13 @@ BOOST_AUTO_UNIT_TEST(ipv6Extensions_hopByHop_parse) std::ostringstream oss (std::ostringstream::out); SENF_CHECK_NO_THROW( pHop_packet.dump( oss )); - BOOST_REQUIRE( pHop_packet.next().is() ); - senf::IPv6Extension_HopByHop pHop_extension (pHop_packet.next().as()); + BOOST_REQUIRE( pHop_packet.next().is() ); + senf::IPv6HopByHop pHop_extension (pHop_packet.next().as()); BOOST_CHECK_EQUAL( pHop_extension->nextHeader(), 58u ); BOOST_CHECK_EQUAL( pHop_extension->headerLength(), 0x00 ); - senf::IPv6Extension_HopByHop::Parser::options_t::container optC(pHop_extension->options() ); - senf::IPv6Extension_HopByHop::Parser::options_t::container::iterator listIter (optC.begin()); + senf::IPv6HopByHop::Parser::options_t::container optC(pHop_extension->options() ); + senf::IPv6HopByHop::Parser::options_t::container::iterator listIter (optC.begin()); BOOST_CHECK_EQUAL( listIter->altAction(), 0u); BOOST_CHECK_EQUAL( listIter->changeFlag(), 0u); @@ -259,14 +259,14 @@ BOOST_AUTO_UNIT_TEST(ipv6Extensions_hopByHop_create) ip->hopLimit() = 1u; ip->source() = senf::INet6Address::from_string("fe80::219:b9ff:feeb:b226"); ip->destination() = senf::INet6Address::from_string("ff02::16"); - senf::IPv6Extension_HopByHop pext (senf::IPv6Extension_HopByHop::createAfter(ip) ); + senf::IPv6HopByHop pext (senf::IPv6HopByHop::createAfter(ip) ); pext->nextHeader() = 58u; pext->headerLength() = 0u; { - senf::IPv6Extension_HopByHop::Parser::options_t::container optC(pext->options() ); + senf::IPv6HopByHop::Parser::options_t::container optC(pext->options() ); optC.push_back_space(); - senf::GenericOptTypeTLVPacketParser opt = optC.back().init(); + senf::GenericOptTypeTLVParser opt = optC.back().init(); opt.altAction() = 0u; opt.changeFlag() = 0u; opt.optionType() = 5u; @@ -274,7 +274,7 @@ BOOST_AUTO_UNIT_TEST(ipv6Extensions_hopByHop_create) opt.setPayload(val); optC.push_back_space(); - opt = optC.back().init(); + opt = optC.back().init(); opt.altAction() = 0u; opt.changeFlag() = 0u; opt.optionType() = 2u; diff --git a/senf/Packets/DefaultBundle/ListOptionTypeParser.test.cc b/senf/Packets/DefaultBundle/ListOptionTypeParser.test.cc index c30be0f..d1ab97a 100644 --- a/senf/Packets/DefaultBundle/ListOptionTypeParser.test.cc +++ b/senf/Packets/DefaultBundle/ListOptionTypeParser.test.cc @@ -41,7 +41,7 @@ namespace { SENF_PARSER_FIELD( size, senf::UInt8Parser ); typedef senf::detail::FixedAuxParserPolicy ListOptionTypeAuxPolicy; - typedef senf::detail::ListOptionTypeParser_Policy ListOptionTypePolicy; + typedef senf::detail::ListOptionTypeParser_Policy ListOptionTypePolicy; typedef senf::ListParser ListOptionTypeParser; SENF_PARSER_FIELD ( list, ListOptionTypeParser);