nun mach' ich erst einmal Urlaub....
[senf.git] / Packets / MPEGDVBBundle / SNDUPacket.hh
index bb219ca..5409272 100644 (file)
@@ -1,9 +1,9 @@
-// $Id:DSMCCSection.hh 327 2007-07-20 10:03:44Z tho $
+// $Id$
 //
 // Copyright (C) 2007
 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-//     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
+//     Thorsten Horstmann <thorsten.horstmann@fokus.fraunhofer.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
@@ -28,6 +28,7 @@
 
 // Custom includes
 #include <algorithm>
+#include <boost/crc.hpp>
 #include "Packets/PacketType.hh"
 #include "Packets/ParseInt.hh"
 #include "Packets/PacketRegistry.hh"
@@ -49,7 +50,7 @@ namespace senf {
     {
 #       ifndef DOXYGEN
         
-        SENF_PACKET_PARSER_INIT(Parse_SNDUPacket);
+        SENF_PACKET_PARSER_NO_INIT(Parse_SNDUPacket);
 
 #       endif
         
@@ -73,11 +74,23 @@ namespace senf {
             return parse<Parse_UInt32>( data().size()-4 ); 
         }
         
+        void init() const {
+            defaultInit();
+            d_bit() = false;
+        }
+        
         PacketParserBase::size_type bytes() const;
         
         static const size_type init_bytes = 2+2+4; // D-Bit + 15 bits length + 16 bits type field + 32 bits crc
+
+        boost::uint32_t calcCrc() const;
     };
 
+    
+    struct ULEExtHeaderTypes {
+        typedef boost::uint16_t key_t;
+    };
+    
     /** \brief ULE SNDU Packet
         
         \par Packet type (typedef):
@@ -89,29 +102,41 @@ namespace senf {
         \ingroup protocolbundle_mpegdvb
      */
     struct SNDUPacketType
-        : public PacketTypeBase,
-          public PacketTypeMixin<SNDUPacketType>
+        : public PacketTypeBase
+//          public PacketTypeMixin<SNDUPacketType, ULEExtHeaderTypes>
     {
-        typedef PacketTypeMixin<SNDUPacketType> mixin;
+//        typedef PacketTypeMixin<SNDUPacketType, ULEExtHeaderType> mixin;
         typedef ConcretePacket<SNDUPacketType> packet;
         typedef Parse_SNDUPacket parser;
 
-        using mixin::nextPacketRange;
-//          using mixin::nextPacketType;
-        using mixin::init;
+//        using mixin::nextPacketRange;
+//        using mixin::nextPacketType;
+//        using mixin::init;
+        
+//        static registry_key_t nextPacketKey(packet p);
+        
+        static void init(packet p);
+
+        static factory_t nextPacketType(packet p);
+        
+        static optional_range nextPacketRange(packet p);
         
         static void dump(packet p, std::ostream & os);
         
         static PacketParserBase::size_type initSize();
+        
         static PacketParserBase::size_type initHeadSize();
     };
         
     typedef SNDUPacketType::packet SNDUPacket;
+    
+    typedef boost::crc_optimal<32, 0x04C11DB7, 0xFFFFFFFF, 0, false, false> ule_crc32;
+
 
     /*!
      \def ULE_END_INDICATOR 
-         ULE End Indicator; indicates to the Receiver that there are no 
-         further SNDUs present within the current TS Packet.
+         ULE End Indicator; indicates to the receiver that there are no 
+         further SNDUs present within the current TS packet.
     */
 #   define ULE_END_INDICATOR 0xffff
 }