X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FMPEGDVBBundle%2FTLVPacket.hh;h=f033a4d4669f0cc3c243dc91cc3f9df5faa6c284;hb=3449642e5fd7b1c83c866b98f2462c2323edddf0;hp=f81eafd99b224ea72a71ca7297975603692c6aeb;hpb=ab243554f940af9f873e1a920d0a6b7886c6f5cf;p=senf.git diff --git a/Packets/MPEGDVBBundle/TLVPacket.hh b/Packets/MPEGDVBBundle/TLVPacket.hh index f81eafd..f033a4d 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 @@ -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 @@ -35,44 +35,48 @@ namespace senf { - struct UnsuportedTLVPacketException : public std::exception - { - virtual char const * what() const throw() { - return "length of length can be max. 4 bytes. Sorry."; - } - }; - - class Parse_TLVPacketLength - : public detail::packet::ParseIntOps, + /** \brief xxx + + \todo document me + \todo add usefull exceptions strings + + */ + struct UnsuportedTLVPacketException : public senf::Exception + { UnsuportedTLVPacketException() + : senf::Exception("length of length can be max. 4 bytes. Sorry."){} }; + + /** \brief xxx + \todo document me + */ + 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; - - value_type value() const; + static const size_type init_bytes = 1; + static value_type const min_value = 0; + static value_type const max_value = 4294967295u; + value_type value() const; void value(value_type const & v); - Parse_TLVPacketLength const & operator= (value_type other); - - static const size_type init_bytes = 1; - + 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); @@ -80,51 +84,49 @@ namespace senf { /** \brief parse TLVPacket Packet - XXX - + \todo document me + \see TLVPacketType */ - struct Parse_TLVPacket : public PacketParserBase + template + struct TLVPacketParser : public PacketParserBase { # include SENF_PARSER() - SENF_PARSER_FIELD( type, Parse_UInt32 ); - SENF_PARSER_FIELD( length, Parse_TLVPacketLength ); + SENF_PARSER_FIELD( type, TypeParser ); + SENF_PARSER_FIELD( length, LengthParser ); - SENF_PARSER_FINALIZE(Parse_TLVPacket); + SENF_PARSER_FINALIZE(TLVPacketParser); }; - - /** \brief TLV Packet + + /** \brief generic TLV Packet type + + \todo document me - \par Packet type (typedef): - \ref TLVPacket - - \par Fields: - \ref Parse_TLVPacket - \ingroup protocolbundle_mpegdvb */ + 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 void init(packet p); static size_type initSize(); + static void finalize(packet p); + static void dump(packet p, std::ostream & os); }; - - typedef TLVPacketType::packet TLVPacket; + typedef ConcretePacket > MIHInfoElement; } ///////////////////////////////hh.e//////////////////////////////////////// //#include "TLVPacket.cci" -//#include "TLVPacket.ct" +#include "TLVPacket.ct" //#include "TLVPacket.cti" #endif