Packets: Fix VariantParser invalid parser access bug
[senf.git] / Packets / DataPacket.hh
index fe1bc68..fc8cd04 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 //
-// Copyright (C) 2006
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-//     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
+// Copyright (C) 2007
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+//     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // Free Software Foundation, Inc.,
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-#ifndef HH_DataPacket_
-#define HH_DataPacket_ 1
+/** \file
+    \brief DataPacket public header */
+
+#ifndef HH_SENF_Packets_DataPacket_
+#define HH_SENF_Packets_DataPacket_ 1
 
 // Custom includes
+#include "PacketType.hh"
 #include "Packet.hh"
 
+//#include "DataPacket.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
 
 namespace senf {
 
+    /** \brief Generic payload-only packet
+
+        \par Packet type (typedef):
+            \ref DataPacket
 
-    /** \brief Non-interpreted Packet
+        DataPacket is a simple generic packet with just a payload of uninterpreted data. This is the
+        packet used whenever no more specific packet type can be found for a sub-packet (e.g. as the
+        payload data of a UDP packet)
 
-        A DataPacket is an uninterpreted blob of data. It is terminal
-        in the sense, that no further packet header may follow after
-        this packet. A DataPacket implements the abstract Packet
-        interface and nothing more.
+        \ingroup packet_module
      */
-    class DataPacket : public Packet
+    struct DataPacketType : public PacketTypeBase
     {
-    public:
-        ///////////////////////////////////////////////////////////////////////////
-        // Types
-
-        typedef ptr_t<DataPacket>::ptr ptr;
-        typedef iterator byte_iterator;
-
-        ///////////////////////////////////////////////////////////////////////////
-
-        static void init() {}
-        static bool check(iterator const & b, iterator const & e) { return true; }
-
-    private:
-        template <class Arg>
-        DataPacket(Arg const & arg);
-
-        virtual void v_nextInterpreter() const;
-        virtual void v_finalize();
-        virtual void v_dump(std::ostream & os) const;
-
-        friend class Packet;
+        typedef ConcretePacket<DataPacketType> packet;
+        static void dump(packet p, std::ostream & os);
     };
 
-
+    /** \brief Generic payload-only packet typedef */
+    typedef ConcretePacket<DataPacketType> DataPacket;
 }
 
 ///////////////////////////////hh.e////////////////////////////////////////
+#endif
+#if !defined(HH_SENF_Packets_Packets__decls_) && !defined(HH_SENF_Packets_DataPacket_impl_)
+#define HH_SENF_Packets_DataPacket_impl_
 //#include "DataPacket.cci"
 //#include "DataPacket.ct"
-#include "DataPacket.cti"
+//#include "DataPacket.cti"
 #endif
 
 \f
 // Local Variables:
 // mode: c++
 // fill-column: 100
+// comment-column: 40
 // c-file-style: "senf"
 // indent-tabs-mode: nil
 // ispell-local-dictionary: "american"
 // compile-command: "scons -u test"
-// comment-column: 40
 // End:
+