Packets: use SENF_PACKET_REGISTRY_REGISTER macro for packet registration
tho [Wed, 23 Sep 2009 12:20:34 +0000 (12:20 +0000)]
Packets/DefaultBundle: fixed IPv6 Extension Header documentation

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

12 files changed:
senf/Packets/80221Bundle/MIHPacket.cc
senf/Packets/DefaultBundle/EthernetPacket.cc
senf/Packets/DefaultBundle/ICMPv6Packet.cc
senf/Packets/DefaultBundle/ICMPv6TypePacket.cc
senf/Packets/DefaultBundle/IPv4Packet.cc
senf/Packets/DefaultBundle/IPv6Extensions.cc
senf/Packets/DefaultBundle/IPv6Extensions.hh
senf/Packets/DefaultBundle/IPv6Packet.cc
senf/Packets/DefaultBundle/TCPPacket.cc
senf/Packets/DefaultBundle/UDPPacket.cc
senf/Packets/PacketRegistry.hh
senf/Packets/SConscript

index 964389b..748bec4 100644 (file)
@@ -36,9 +36,7 @@
 ///////////////////////////////cc.p////////////////////////////////////////
 
 namespace {
-    senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::MIHPacket>
-        registerMIHPacket (0x86dd);
-
+    SENF_PACKET_REGISTRY_REGISTER( senf::EtherTypes, 0x86dd, senf::MIHPacket);
 }
 
 ///////////////////////////////////////////////////////////////////////////
index b3ba75b..4e009d1 100644 (file)
@@ -35,8 +35,7 @@
 ///////////////////////////////cc.p////////////////////////////////////////
 
 namespace {
-    senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::EthVLanPacket>
-        registerEthVLanPacket(0x8100);
+    SENF_PACKET_REGISTRY_REGISTER( senf::EtherTypes, 0x8100, senf::EthVLanPacket);
 }
 
 ///////////////////////////////////////////////////////////////////////////
index 8692539..d35e2ae 100644 (file)
@@ -35,8 +35,7 @@
 ///////////////////////////////cc.p////////////////////////////////////////
 
 namespace {
-    senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::ICMPv6Packet>
-        registerICMPv6Packet (58);
+    SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 58, senf::ICMPv6Packet);
 }
 
 prefix_ boost::uint16_t senf::ICMPv6PacketParser::calcChecksum() 
index 0cb9b3b..57d1dca 100644 (file)
 #ifndef DOXYGEN
 
 namespace {
-//Implementing the ICMPv6 Type registry
-    senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::ICMPv6ErrDestUnreachable>
-        registerICMPv6ErrDestUnreachable (1);
-    senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::ICMPv6ErrTooBig>
-        registerICMPv6ErrTooBig (2);
-    senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::ICMPv6ErrTimeExceeded>
-        registerICMPv6ErrTimeExceeded (3);
-    senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::ICMPv6ErrParamProblem>
-        registerICMPv6ErrParamProblem (4);
-    senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::ICMPv6EchoRequest>
-        registerICMPv6EchoRequest (128);
-    senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::ICMPv6EchoReply>
-        registerICMPv6EchoReply (129);
-    senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::MLDv2ListenerQuery>
-        registerMLDv2ListenerQuery (130);
-    senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::MLDv2ListenerReport>
-        registerMLDv2ListenerReport (143);
+    SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 1,   senf::ICMPv6ErrDestUnreachable );
+    SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 2,   senf::ICMPv6ErrTooBig          );
+    SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 3,   senf::ICMPv6ErrTimeExceeded    );
+    SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 4,   senf::ICMPv6ErrParamProblem    );
+    SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 128, senf::ICMPv6EchoRequest        );
+    SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 129, senf::ICMPv6EchoReply          );
+    SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 130, senf::MLDv2ListenerQuery       );
+    SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 143, senf::MLDv2ListenerReport      );
 }
 
 #endif
index 3268575..1cdab2e 100644 (file)
 ///////////////////////////////cc.p////////////////////////////////////////
 
 namespace {
-    senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::IPv4Packet>
-        registerIPv4Packet (0x0800);
-
-    senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv4Packet>
-        regsiterIPv4Packet2 (4); // IP-in-IP encapsulation
+    SENF_PACKET_REGISTRY_REGISTER( senf::EtherTypes, 0x0800, senf::IPv4Packet);
+    SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes,    4,      senf::IPv4Packet); // IP-in-IP encapsulation
 }
 
 ///////////////////////////////////////////////////////////////////////////
index 270a307..8a162b5 100644 (file)
 ///////////////////////////////cc.p////////////////////////////////////////
 
 namespace {
-    senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv6FragmentPacket>
-        registerIPv6FragmentPacketType (44);
-    senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv6RoutingPacket>
-        registerIPv6RoutingPacketType (43);
-    senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv6HopByHopOptionsPacket>
-        registerIPv6HopByHopOptionsPacketType (0u);
-    senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv6DestinationOptionsPacket>
-        registerIPv6DestinationOptionsPacketType (60u);
+    SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 44,  senf::IPv6FragmentPacket           );
+    SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 43,  senf::IPv6RoutingPacket            );
+    SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 0u,  senf::IPv6HopByHopOptionsPacket    );
+    SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 60u, senf::IPv6DestinationOptionsPacket );
 }
 
 prefix_ void senf::IPv6FragmentPacketType::dump(packet p, std::ostream & os)
index 7d1aab6..ee4e18e 100644 (file)
@@ -42,7 +42,7 @@ namespace senf {
     /** \brief Parse in IPv6 fragment extension header
         
         Parser implementing the IPv6 fragment extension. The fields implemented are:
-        \image html IPv6Extensions_Fragment.png
+        \image html IPv6FragmentPacket.png
 
         \see IPv6ExtensionType_Fragment \n
             <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
@@ -113,12 +113,12 @@ namespace senf {
 
         Parser implementing the IPv6 routing Header extension (type 0 only).
         The fields implemented are:
-        \image html IPv6Extensions_Routing.png
+        \image html IPv6RoutingPacket.png
 
         \see IPv6ExtensionType_Routing \n
             <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
      */
-    struct IPv6PRoutingPacketParser : public PacketParserBase
+    struct IPv6RoutingPacketParser : public PacketParserBase
     {
         /*
         The Type 0 Routing header has the following format: (RFC 2460)
@@ -158,7 +158,7 @@ namespace senf {
         SENF_PARSER_FIELD ( reserved, UInt32Parser       ); //set to zero by RFC
         SENF_PARSER_VECTOR ( hopAddresses, segmentsLeft, INet6AddressParser );
         
-        SENF_PARSER_FINALIZE ( IPv6PRoutingPacketParser );
+        SENF_PARSER_FINALIZE ( IPv6RoutingPacketParser );
         
         //provisionary, since only type 0 is implemented
         SENF_PARSER_INIT() { 
@@ -193,7 +193,7 @@ namespace senf {
         /** \brief IPv6 routing extension packet typedef */
         typedef ConcretePacket<IPv6RoutingPacketType> packet;
         /** \brief typedef to the parser of IPv6 routing extension packet */
-        typedef IPv6PRoutingPacketParser parser;
+        typedef IPv6RoutingPacketParser parser;
         
         using mixin::nextPacketRange;
         using mixin::nextPacketType;
@@ -218,7 +218,7 @@ namespace senf {
     /** \brief Parse in IPv6 Hop-By-Hop extension header
 
         Parser implementing the IPv6 routing Header extension. The fields implemented are:
-        \image html IPv6Extensions_HopByHop.png
+        \image html IPv6HopByHopOptionsPacket.png
 
         \see IPv6ExtensionType_HopByHop \n
             <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
@@ -291,7 +291,7 @@ namespace senf {
 
         Parser implementing the IPv6 Destination Options Header extension. 
         The fields implemented are:
-        \image html IPv6Extensions_Destination.png
+        \image html IPv6DestinationOptionsPacket.png
 
         \see IPv6ExtensionType_Destination \n
             <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
index 4599276..60f7929 100644 (file)
 ///////////////////////////////cc.p////////////////////////////////////////
 
 namespace {
-    senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::IPv6Packet>
-        registerIPv6Packet (0x86dd);
-
-    senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv6Packet>
-        registerIPv6Packet2 (41); // IP6-in-IP(6) encapsulation
+    SENF_PACKET_REGISTRY_REGISTER( senf::EtherTypes, 0x86dd, senf::IPv6Packet);
+    SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes,    41,     senf::IPv6Packet); // IP6-in-IP(6) encapsulation
 }
 
 prefix_ void senf::IPv6PacketType::dump(packet p, std::ostream & os)
index 60b4beb..5af6c47 100644 (file)
@@ -38,8 +38,7 @@
 ///////////////////////////////cc.p////////////////////////////////////////
 
 namespace {
-    senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::TCPPacket>
-        registerTCPPacket (6);
+    SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 6, senf::TCPPacket);
 }
 
 ///////////////////////////////////////////////////////////////////////////
index 33065ea..3c7980f 100644 (file)
@@ -38,8 +38,7 @@
 ///////////////////////////////cc.p////////////////////////////////////////
 
 namespace {
-    senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::UDPPacket>
-        registerUDPPacket (17);
+    SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 17, senf::UDPPacket);
 }
 
 ///////////////////////////////////////////////////////////////////////////
index 932dfec..19c70d5 100644 (file)
@@ -78,6 +78,11 @@ namespace senf {
         static registration only works when the symbol is included into the final binary. To force
         this inclusion, you should not put packet registrations into a library but into an object
         file.
+        
+        To simplify static registration the SENF_PACKET_REGISTRY_REGISTER macro can be used:
+        \code
+        SENF_PACKET_REGISTRY_REGISTER(SomeTag, SomePacket, key_of_somePacket);
+        \endcode
 
         \ingroup packet_module
      */
@@ -196,6 +201,7 @@ namespace senf {
         This macro will declare an anonymous global variable in such a way, that constructing this
         variable will add a registration to the given packet registry.
 
+        \ingroup packet_module
         \hideinitializer
      */
 #   define SENF_PACKET_REGISTRY_REGISTER( registry, value, type )                                 \
index 68ea6cb..da9f023 100644 (file)
@@ -20,14 +20,14 @@ SENFSCons.AutoRules(env, doc_extra_sources = [
     env.PkgDraw("DefaultBundle/LlcSnapPacket.hh"),
     env.PkgDraw("DefaultBundle/UDPPacket.hh"),
     env.PkgDraw("DefaultBundle/TCPPacket.hh"),
-    env.PkgDraw("DefaultBundle/IPv6Extensions_Fragment.png", "DefaultBundle/IPv6Extensions.hh",
-                PKGDRAWPACKETS = "IPv6PacketParserExtension_Fragment"),
-    env.PkgDraw("DefaultBundle/IPv6Extensions_Routing.png", "DefaultBundle/IPv6Extensions.hh",
-                PKGDRAWPACKETS = "IPv6PacketParserExtension_Routing"),
-    env.PkgDraw("DefaultBundle/IPv6Extensions_HopByHop.png", "DefaultBundle/IPv6Extensions.hh",
-                PKGDRAWPACKETS = "IPv6PacketParserExtension_HopByHop"),
-    env.PkgDraw("DefaultBundle/IPv6Extensions_Destination.png", "DefaultBundle/IPv6Extensions.hh",
-                PKGDRAWPACKETS = "IPv6PacketParserExtension_Destination"),
+    env.PkgDraw("DefaultBundle/IPv6FragmentPacket.png", "DefaultBundle/IPv6Extensions.hh",
+                PKGDRAWPACKETS = "IPv6FragmentPacketParser"),
+    env.PkgDraw("DefaultBundle/IPv6RoutingPacket.png", "DefaultBundle/IPv6Extensions.hh",
+                PKGDRAWPACKETS = "IPv6RoutingPacketParser"),
+    env.PkgDraw("DefaultBundle/IPv6HopByHopOptionsPacket.png", "DefaultBundle/IPv6Extensions.hh",
+                PKGDRAWPACKETS = "IPv6HopByHopOptionsPacketParser"),
+    env.PkgDraw("DefaultBundle/IPv6DestinationOptionsPacket.png", "DefaultBundle/IPv6Extensions.hh",
+                PKGDRAWPACKETS = "IPv6DestinationOptionsPacketParser"),
     env.PkgDraw("DefaultBundle/ICMPv6Packet.hh"),
     env.PkgDraw("DefaultBundle/ICMPv6EchoRequest.png", "DefaultBundle/ICMPv6TypePacket.hh",
                 PKGDRAWPACKETS = "ICMPv6EchoRequestParser"),