Packets/DefaultBundle: IPv6ExtensionsHeaders: set nextHeader to 59 if their is no...
tho [Tue, 17 Nov 2009 15:17:54 +0000 (15:17 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1532 270642c3-0616-0410-b53a-bc976706d245

senf/Packets/DefaultBundle/IPv6Extensions.cc
senf/Packets/DefaultBundle/IPv6Extensions.hh

index 6e8d714..d9b1dc9 100644 (file)
@@ -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"
index 34f2e83..3124b27 100644 (file)
@@ -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