X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FMPEGDVBBundle%2FTLVPacket.hh;h=f033a4d4669f0cc3c243dc91cc3f9df5faa6c284;hb=a58be9dbd48369f2c0469b5c214406d26f1feefa;hp=4ba9b94848b65007ef37d4c7b5666ead0fd99631;hpb=f73fa16ed5abdce272ac77f8b8b9ef2b9922c266;p=senf.git diff --git a/Packets/MPEGDVBBundle/TLVPacket.hh b/Packets/MPEGDVBBundle/TLVPacket.hh index 4ba9b94..f033a4d 100644 --- a/Packets/MPEGDVBBundle/TLVPacket.hh +++ b/Packets/MPEGDVBBundle/TLVPacket.hh @@ -1,8 +1,8 @@ // $Id$ // // Copyright (C) 2007 -// Fraunhofer Institute for Open Communication Systems (FOKUS) -// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Thorsten Horstmann // // This program is free software; you can redistribute it and/or modify @@ -23,8 +23,8 @@ /** \file \brief TLVPacket public header */ -#ifndef HH_TLVPacket_ -#define HH_TLVPacket_ 1 +#ifndef HH_SENF_Packets_MPEGDVBBundle_TLVPacket_ +#define HH_SENF_Packets_MPEGDVBBundle_TLVPacket_ 1 // Custom includes #include @@ -41,22 +41,19 @@ namespace senf { \todo add usefull exceptions strings */ - struct UnsuportedTLVPacketException : public std::exception - { - virtual char const * what() const throw() { - return "length of length can be max. 4 bytes. Sorry."; - } - }; + struct UnsuportedTLVPacketException : public senf::Exception + { UnsuportedTLVPacketException() + : senf::Exception("length of length can be max. 4 bytes. Sorry."){} }; /** \brief xxx \todo document me */ - class TLVPacketLengthParser - : public detail::packet::IntParserOps, + class DynamicTLVLengthParser + : public detail::packet::IntParserOps, public PacketParserBase { public: - TLVPacketLengthParser(data_iterator i, state_type s) : PacketParserBase(i,s) {} + DynamicTLVLengthParser(data_iterator i, state_type s) : PacketParserBase(i,s) {} typedef boost::uint32_t value_type; static const size_type init_bytes = 1; @@ -66,10 +63,8 @@ namespace senf { value_type value() const; void value(value_type const & v); - TLVPacketLengthParser const & operator= (value_type other); - + DynamicTLVLengthParser const & operator= (value_type other); size_type bytes() const; - void init() const; private: @@ -93,12 +88,12 @@ namespace senf { \see TLVPacketType */ - template + template struct TLVPacketParser : public PacketParserBase { # include SENF_PARSER() - SENF_PARSER_FIELD( type, UInt32Parser ); + SENF_PARSER_FIELD( type, TypeParser ); SENF_PARSER_FIELD( length, LengthParser ); SENF_PARSER_FINALIZE(TLVPacketParser); @@ -110,14 +105,13 @@ namespace senf { \ingroup protocolbundle_mpegdvb */ - template + template struct TLVPacketType : public PacketTypeBase { -#ifndef DOXYGEN - typedef ConcretePacket > packet; - typedef TLVPacketParser parser; -#endif + typedef ConcretePacket > packet; + typedef TLVPacketParser parser; + static optional_range nextPacketRange(packet p); static size_type initSize(); @@ -125,13 +119,8 @@ namespace senf { static void dump(packet p, std::ostream & os); }; - - typedef TLVPacketType::packet TLVPacket; - typedef ConcretePacket > TLVFix8Packet; - typedef ConcretePacket > TLVFix16Packet; - typedef ConcretePacket > TLVFix24Packet; - typedef ConcretePacket > TLVFix32Packet; + typedef ConcretePacket > MIHInfoElement; }