From: tho Date: Tue, 17 Nov 2009 15:17:54 +0000 (+0000) Subject: Packets/DefaultBundle: IPv6ExtensionsHeaders: set nextHeader to 59 if their is no... X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=8bab2fbb2a8272199adc7034ddcd43ecdeb942a9;p=senf.git Packets/DefaultBundle: IPv6ExtensionsHeaders: set nextHeader to 59 if their is no next packet. git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1532 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Packets/DefaultBundle/IPv6Extensions.cc b/senf/Packets/DefaultBundle/IPv6Extensions.cc index 6e8d714..d9b1dc9 100644 --- a/senf/Packets/DefaultBundle/IPv6Extensions.cc +++ b/senf/Packets/DefaultBundle/IPv6Extensions.cc @@ -52,6 +52,16 @@ prefix_ void senf::IPv6FragmentPacketType::dump(packet p, std::ostream & os) << "0x" << std::hex << unsigned(p->id()) << "\n"; } +prefix_ void senf::IPv6FragmentPacketType::finalize(packet p) +{ + try { + p->nextHeader() << key(p.next()); + } + catch (InvalidPacketChainException & ex) { + p->nextHeader() << 59; // No next header + } +} + prefix_ void senf::IPv6RoutingPacketType::dump(packet p, std::ostream & os) { os << "Internet protocol Version 6 routing extension:\n" @@ -67,6 +77,16 @@ prefix_ void senf::IPv6RoutingPacketType::dump(packet p, std::ostream & os) os << " " << *i << "\n"; } +prefix_ void senf::IPv6RoutingPacketType::finalize(packet p) +{ + try { + p->nextHeader() << key(p.next()); + } + catch (InvalidPacketChainException & ex) { + p->nextHeader() << 59; // No next header + } +} + prefix_ void senf::IPv6HopByHopOptionsPacketType::dump(packet p, std::ostream & os) { os << "Internet protocol Version 6 Hop-By-Hop extension:\n" @@ -79,6 +99,16 @@ prefix_ void senf::IPv6HopByHopOptionsPacketType::dump(packet p, std::ostream & i->dump( os); } +prefix_ void senf::IPv6HopByHopOptionsPacketType::finalize(packet p) +{ + try { + p->nextHeader() << key(p.next()); + } + catch (InvalidPacketChainException & ex) { + p->nextHeader() << 59; // No next header + } +} + prefix_ void senf::IPv6DestinationOptionsPacketType::dump(packet p, std::ostream & os) { os << "Internet protocol Version 6 Destination Options extension:\n" diff --git a/senf/Packets/DefaultBundle/IPv6Extensions.hh b/senf/Packets/DefaultBundle/IPv6Extensions.hh index 34f2e83..3124b27 100644 --- a/senf/Packets/DefaultBundle/IPv6Extensions.hh +++ b/senf/Packets/DefaultBundle/IPv6Extensions.hh @@ -98,8 +98,7 @@ namespace senf { /** \brief Dump given IPv6FragmentPacket 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 fragment extension packet typedef @@ -202,11 +201,11 @@ namespace senf { static key_t nextPacketKey(packet p) { return p->nextHeader(); } + /** \brief Dump given IPv6RoutingPacket 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 extension packet typedef @@ -275,14 +274,13 @@ namespace senf { using mixin::init; using mixin::initSize; - static key_t nextPacketKey(packet p) - { return p->nextHeader(); } + static key_t nextPacketKey(packet p) { + return p->nextHeader(); } /** \brief Dump given IPv6HopByHopOptionsPacket 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 Hop-By-Hop packet typedef