added initfunction for genericOptionTypeParser with return parser and unittest for...
[senf.git] / senf / Packets / DefaultBundle / IPv6Extensions.hh
index 197f5c9..1b9a1ef 100644 (file)
 #define HH_SENF_Packets_DefaultBundle_IPv6Extensions_ 1
 
 // Custom includes
+#include <senf/Packets/Packets.hh>
+#include <senf/Packets/AuxParser.hh>
+#include <senf/Packets/DefaultBundle/IPv6ExtOptionType.hh>
+#include "ListOptionTypeParser.hh"
 #include "IPv6Packet.hh"
 
 //#include "IPv6Extensions.mpp"
@@ -48,11 +52,9 @@ namespace senf {
 
         SENF_PARSER_FIELD            ( nextHeader     , UInt8Parser  );
         SENF_PARSER_PRIVATE_FIELD    ( reserved1      , UInt8Parser  );
-
         SENF_PARSER_BITFIELD         ( fragmentOffset , 13, unsigned );
         SENF_PARSER_PRIVATE_BITFIELD ( reserved2      ,  2, unsigned );
         SENF_PARSER_BITFIELD         ( moreFragments  ,  1, bool     );
-
         SENF_PARSER_FIELD            ( id             , UInt32Parser );
 
         SENF_PARSER_FINALIZE(IPv6PacketParserExtension_Fragment);
@@ -109,10 +111,10 @@ namespace senf {
     /** \brief Parse in IPv6 routing extension header
 
         Parser implementing the IPv6 routing Header extension. The fields implemented are:
-    \image html IPv6Extensions_Routing.png
+        \image html IPv6Extensions_Routing.png
 
-    \see IPv6ExtensionType_Routing \n
-    <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
+        \see IPv6ExtensionType_Routing \n
+        <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
      */
 
 //Routing Header Extension (type 0 only)
@@ -186,7 +188,6 @@ The Type 0 Routing header has the following format: (RFC 2460)
     struct IPv6ExtensionType_Routing
     :   public PacketTypeBase,
         public PacketTypeMixin<IPv6ExtensionType_Routing, IpTypes>
-
     {
 #ifndef DOXYGEN
         typedef PacketTypeMixin<IPv6ExtensionType_Routing, IpTypes> mixin;
@@ -225,13 +226,19 @@ The Type 0 Routing header has the following format: (RFC 2460)
     <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
     */
 
-// Hop-By-Hop skeleton without Options 
+// Hop-By-Hop Extension Header
 
     struct IPv6PacketParserExtension_HopByHop : public PacketParserBase {
 #       include SENF_PARSER()
         SENF_PARSER_FIELD ( nextHeader, UInt8Parser   );
         SENF_PARSER_FIELD ( headerLength, UInt8Parser );
-        
+
+        typedef detail::FixedAuxParserPolicy<UInt8Parser, 1u> ListOptionTypeAuxPolicy;
+        typedef detail::ListOptionTypeParser_Policy<GenericOptTypeTLVPacketParser, ListOptionTypeAuxPolicy> ListOptionTypePolicy;
+        typedef ListParser<ListOptionTypePolicy> ListOptionTypeParser;
+
+        SENF_PARSER_FIELD  ( options, ListOptionTypeParser);
+
         SENF_PARSER_FINALIZE ( IPv6PacketParserExtension_HopByHop );
     };
     
@@ -295,6 +302,7 @@ The Type 0 Routing header has the following format: (RFC 2460)
     // Destination Options skeleton without TLV-Options
 
     struct IPv6PacketParserExtension_Destination : public PacketParserBase {
+
 #       include SENF_PARSER()
         SENF_PARSER_FIELD ( nextHeader, UInt8Parser   );
         SENF_PARSER_FIELD ( headerLength, UInt8Parser );