X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FMPEGDVBBundle%2FTLVPacket.hh;h=492507519b5de73664853abd51aa4414f0c0e256;hb=6a0836b7f462d3d77b79b35638cdbf4c9d4202fc;hp=955160e03fe15695259efbfac28a6a65ad9db8b2;hpb=8e973da50bdd625d2cbdd218143a4fcd920f9109;p=senf.git diff --git a/Packets/MPEGDVBBundle/TLVPacket.hh b/Packets/MPEGDVBBundle/TLVPacket.hh index 955160e..4925075 100644 --- a/Packets/MPEGDVBBundle/TLVPacket.hh +++ b/Packets/MPEGDVBBundle/TLVPacket.hh @@ -1,9 +1,9 @@ // $Id$ // // Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) -// Thorsten Horstmann +// 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 // it under the terms of the GNU General Public License as published by @@ -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 Parse_TLVPacketLength - : public detail::packet::ParseIntOps, + class DynamicTLVLengthParser + : public detail::packet::IntParserOps, public PacketParserBase { public: - Parse_TLVPacketLength(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,22 +63,20 @@ namespace senf { value_type value() const; void value(value_type const & v); - Parse_TLVPacketLength const & operator= (value_type other); - + DynamicTLVLengthParser const & operator= (value_type other); size_type bytes() const; - void init() const; private: - typedef Parse_Flag < 0 > Parse_extended_length_flag; - typedef Parse_UIntField < 1, 8 > Parse_fixed_length; + typedef FlagParser < 0 > ExtendedLengthFlagParser; + typedef UIntFieldParser < 1, 8 > FixedLengthParser; - Parse_extended_length_flag extended_length_flag() const { - return parse( 0 ); + ExtendedLengthFlagParser extended_length_flag() const { + return parse( 0 ); } - Parse_fixed_length fixed_length_field() const { - return parse( 0 ); + FixedLengthParser fixed_length_field() const { + return parse( 0 ); } void resize(size_type size); @@ -93,15 +88,15 @@ namespace senf { \see TLVPacketType */ - template - struct Parse_TLVPacket : public PacketParserBase + template + struct TLVPacketParser : public PacketParserBase { # include SENF_PARSER() - SENF_PARSER_FIELD( type, Parse_UInt32 ); + SENF_PARSER_FIELD( type, TypeParser ); SENF_PARSER_FIELD( length, LengthParser ); - SENF_PARSER_FINALIZE(Parse_TLVPacket); + SENF_PARSER_FINALIZE(TLVPacketParser); }; /** \brief generic TLV Packet type @@ -110,12 +105,12 @@ namespace senf { \ingroup protocolbundle_mpegdvb */ - template + template struct TLVPacketType : public PacketTypeBase { - typedef ConcretePacket > packet; - typedef Parse_TLVPacket parser; + typedef ConcretePacket > packet; + typedef TLVPacketParser parser; static optional_range nextPacketRange(packet p); static size_type initSize(); @@ -124,13 +119,8 @@ namespace senf { static void dump(packet p, std::ostream & os); }; - - typedef TLVPacketType::packet TLVPacket; - typedef TLVPacketType::packet TLVFix8Packet; - typedef TLVPacketType::packet TLVFix16Packet; - typedef TLVPacketType::packet TLVFix24Packet; - typedef TLVPacketType::packet TLVFix32Packet; + typedef ConcretePacket > MIHInfoElement; }