From: jmo Date: Fri, 22 Jan 2010 17:12:20 +0000 (+0000) Subject: - IPv6 Ext Option documentation added X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=8348a88c43eb04dc2979f3c07b2e6e920f251073;p=senf.git - IPv6 Ext Option documentation added - IPv6 Dest Ext option added git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1549 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Packets/DefaultBundle/IPv6ExtOptions.hh b/senf/Packets/DefaultBundle/IPv6ExtOptions.hh index 66ecce7..aef3db9 100644 --- a/senf/Packets/DefaultBundle/IPv6ExtOptions.hh +++ b/senf/Packets/DefaultBundle/IPv6ExtOptions.hh @@ -33,6 +33,18 @@ ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { + /** \brief IPv6 Extension Option parser + + Definition of parser fields in RFC2460 and assignments of type field at IANA + + Used in \ref IPv6HopByHopOptionsPacketParser and \ref IPv6DestinationOptionsPacketParser. + + \see IANA IPv6 Parameters\n + \ref IPv6GenericOptionParser + + \ingroup protocolbundle_default + */ + class IPv6OptionParser : public PacketParserBase { public: diff --git a/senf/Packets/DefaultBundle/IPv6Extensions.cc b/senf/Packets/DefaultBundle/IPv6Extensions.cc index d9b1dc9..631d87e 100644 --- a/senf/Packets/DefaultBundle/IPv6Extensions.cc +++ b/senf/Packets/DefaultBundle/IPv6Extensions.cc @@ -114,8 +114,24 @@ prefix_ void senf::IPv6DestinationOptionsPacketType::dump(packet p, std::ostream os << "Internet protocol Version 6 Destination Options extension:\n" << senf::fieldName("next header") << unsigned (p->nextHeader()) << "\n" << senf::fieldName("header length") << unsigned (p->headerLength()) << "\n"; + os << " OptionTypes:\n"; + typedef IPv6DestinationOptionsPacket::Parser::options_t::container optContainer_t; + optContainer_t options (p->options()); + for (optContainer_t::const_iterator i = options.begin(); i != options.end(); ++i) + i->dump( os); +} + +prefix_ void senf::IPv6DestinationOptionsPacketType::finalize(packet p) +{ + try { + p->nextHeader() << key(p.next()); + } + catch (InvalidPacketChainException & ex) { + p->nextHeader() << 59; // No next header + } } + ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_ //#include "IPv6Extensions.mpp" diff --git a/senf/Packets/DefaultBundle/IPv6Extensions.hh b/senf/Packets/DefaultBundle/IPv6Extensions.hh index 3124b27..bf41e88 100644 --- a/senf/Packets/DefaultBundle/IPv6Extensions.hh +++ b/senf/Packets/DefaultBundle/IPv6Extensions.hh @@ -303,8 +303,14 @@ namespace senf { { # include SENF_PARSER() SENF_PARSER_FIELD ( nextHeader, UInt8Parser ); - SENF_PARSER_FIELD ( headerLength, UInt8Parser ); - + SENF_PARSER_FIELD_RO ( headerLength, UInt8Parser ); + typedef detail::FixedAuxParserPolicy ListOptionTypeAuxPolicy; + typedef detail::ListOptionTypeParser_Policy< + IPv6GenericOptionParser, ListOptionTypeAuxPolicy> ListOptionTypePolicy; + typedef ListParser ListOptionTypeParser; + + SENF_PARSER_FIELD ( options, ListOptionTypeParser); + SENF_PARSER_FINALIZE ( IPv6DestinationOptionsPacketParser ); }; @@ -346,8 +352,7 @@ namespace senf { /** \brief Dump given IPv6DestinationOptionsPacket in readable form to given output stream */ static void dump(packet p, std::ostream & os); - static void finalize(packet p) { - p->nextHeader() << key(p.next(nothrow)); } + static void finalize(packet p); }; /** \brief IPv6 routing Destination Options packet typedef