// $Id$
//
// Copyright (C) 2007
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-// Thorsten Horstmann <thorsten.horstmann@fokus.fraunhofer.de>
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Thorsten Horstmann <tho@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
\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<Parse_TLVPacketLength, boost::uint32_t>,
+ class DynamicTLVLengthParser
+ : public detail::packet::IntParserOps<DynamicTLVLengthParser, boost::uint32_t>,
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;
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<Parse_extended_length_flag>( 0 );
+ ExtendedLengthFlagParser extended_length_flag() const {
+ return parse<ExtendedLengthFlagParser>( 0 );
}
- Parse_fixed_length fixed_length_field() const {
- return parse<Parse_fixed_length>( 0 );
+ FixedLengthParser fixed_length_field() const {
+ return parse<FixedLengthParser>( 0 );
}
void resize(size_type size);
\see TLVPacketType
*/
- template <class LengthParser>
- struct Parse_TLVPacket : public PacketParserBase
+ template <class TypeParser, class LengthParser>
+ 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
\ingroup protocolbundle_mpegdvb
*/
- template <class LengthParser>
+ template <class TypeParser, class LengthParser>
struct TLVPacketType
: public PacketTypeBase
{
-#ifndef DOXYGEN
- typedef ConcretePacket<TLVPacketType<LengthParser> > packet;
- typedef Parse_TLVPacket<LengthParser> parser;
-#endif
+ typedef ConcretePacket<TLVPacketType<TypeParser, LengthParser> > packet;
+ typedef TLVPacketParser<TypeParser, LengthParser> parser;
+
static optional_range nextPacketRange(packet p);
static size_type initSize();
static void dump(packet p, std::ostream & os);
};
-
- typedef TLVPacketType<Parse_TLVPacketLength>::packet TLVPacket;
- typedef ConcretePacket<TLVPacketType<Parse_UInt8> > TLVFix8Packet;
- typedef ConcretePacket<TLVPacketType<Parse_UInt16> > TLVFix16Packet;
- typedef ConcretePacket<TLVPacketType<Parse_UInt24> > TLVFix24Packet;
- typedef ConcretePacket<TLVPacketType<Parse_UInt32> > TLVFix32Packet;
+ typedef ConcretePacket<TLVPacketType<UInt32Parser, DynamicTLVLengthParser> > MIHInfoElement;
}