- IPv6 Ext Option documentation added
jmo [Fri, 22 Jan 2010 17:12:20 +0000 (17:12 +0000)]
- IPv6 Dest Ext option added

git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1549 270642c3-0616-0410-b53a-bc976706d245

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

index 66ecce7..aef3db9 100644 (file)
 ///////////////////////////////hh.p////////////////////////////////////////
 namespace senf {
 
+    /** \brief IPv6 Extension Option parser
+
+        Definition of parser fields in RFC2460 and assignments of <b>type</b> field at <a href="http://www.iana.org/assignments/ipv6-parameters">IANA</a>
+
+        Used in \ref IPv6HopByHopOptionsPacketParser and  \ref IPv6DestinationOptionsPacketParser.
+
+        \see <a href="http://www.iana.org/assignments/ipv6-parameters">IANA IPv6 Parameters</a>\n
+             \ref IPv6GenericOptionParser
+
+        \ingroup protocolbundle_default
+     */
+
     class IPv6OptionParser : public PacketParserBase
     {
     public:
index d9b1dc9..631d87e 100644 (file)
@@ -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"
index 3124b27..bf41e88 100644 (file)
@@ -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<UInt8Parser, 1u> ListOptionTypeAuxPolicy;
+        typedef detail::ListOptionTypeParser_Policy<
+            IPv6GenericOptionParser, ListOptionTypeAuxPolicy> ListOptionTypePolicy;
+        typedef ListParser<ListOptionTypePolicy> 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