Socket: Introduce sub-directory structure for concrete protocols
[senf.git] / Packets / DefaultBundle / IpV4Packet.hh
index e8879a2..9d451c5 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: IpV4Packet.hh 307 2007-07-14 21:31:12Z g0dil $
+// $Id$
 //
 // Copyright (C) 2006
 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
 #define HH_IpV4Packet_ 1
 
 // Custom includes
-#include "Packets/PacketType.hh"
-#include "Packets/ParseInt.hh"
-#include "Packets/PacketRegistry.hh"
-#include "Packets/PacketParser.hh"
+#include "Packets/Packets.hh"
 
 //#include "IpV4Packet.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
 
 namespace senf {
 
-    ///\addtogroup protocolbundle_default
-    ///@{
+    /** \brief Parse an IpV4 packet
 
-    struct Parse_IpV4 : public PacketParserBase
-    {
-        SENF_PACKET_PARSER_NO_INIT(Parse_IpV4);
+        Parser implementing the IpV4 header. The fields implemented are:
 
-        ///////////////////////////////////////////////////////////////////////////
+        \see IpV4PacketType \n
+            <a href="http://tools.ietf.org/html/rfc791">RFC 791</a>
 
+        \todo Implement options
+     */
+    struct Parse_IpV4 : public PacketParserBase
+    {
         typedef Parse_UIntField <  0,  4 > Parse_Version;
         typedef Parse_UIntField <  4,  8 > Parse_IHL;
         typedef Parse_UInt8                Parse_8bit;
@@ -53,6 +52,10 @@ namespace senf {
         typedef Parse_UIntField <  3, 16 > Parse_Frag;
         typedef Parse_UInt32               Parse_32bit;
 
+#       ifndef DOXYGEN
+
+        SENF_PACKET_PARSER_NO_INIT(Parse_IpV4);
+
         SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS(
             ((OverlayField)( version,     Parse_Version ))
             ((Field       )( ihl,         Parse_IHL     ))
@@ -69,17 +72,54 @@ namespace senf {
             ((Field       )( source,      Parse_32bit   ))
             ((Field       )( destination, Parse_32bit   )) );
 
+#       else
+
+        Parse_Version version();
+        Parse_IHL ihl();
+        Parse_8bit tos();
+        Parse_16bit length();
+        Parse_16bit identifier();
+        Parse_R reserved();
+        Parse_DF df();
+        Parse_MF mf();
+        Parse_Frag frag();
+        Parse_8bit ttl();
+        Parse_8bit protocol();
+        Parse_16bit crc();
+        Parse_32bit source();
+        Parse_32bit destination();
+
+#       endif
+
         void init() {
             version() = 4;
         }
     };
 
+    /** \brief IP protocol number registry
+
+        This registeres packets with their IP protocol number.
+
+        \see <a href="http://www.iana.org/assignments/protocol-numbers">Protocol numbers</a> \n
+            PacketRegistry
+     */
     struct IpTypes {
-        // See http://www.iana.org/assignments/protocol-numbers
-        // Also used by IPv6
         typedef boost::uint16_t key_t;
     };
 
+    /** \brief IpV4 packet
+        
+        \par Packet type (typedef):
+            \ref IpV4Packet
+
+        \par Fields:
+            \ref Parse_IpV4
+
+        \par Associated registries:
+            \ref IpTypes
+
+        \ingroup protocolbundle_default
+     */
     struct IpV4PacketType
         : public PacketTypeBase,
           public PacketTypeMixin<IpV4PacketType, IpTypes>
@@ -99,13 +139,14 @@ namespace senf {
         static void dump(packet p, std::ostream & os);
     };
         
+    /** \brief IpV4 packet typedef */
     typedef IpV4PacketType::packet IpV4Packet;
-
-    ///@}
 }
 
 
 ///////////////////////////////hh.e////////////////////////////////////////
+#endif
+#ifndef SENF_PACKETS_DECL_ONLY
 //#include IpV4Packet.cci"
 //#include "IpV4Packet.ct"
 //#include "IpV4Packet.cti"