-// $Id:DatagramSection.hh 327 2007-07-20 10:03:44Z tho $
+// $Id:TransportPacket.hh 560 2007-12-13 14:39:37Z tho $
//
// 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
/** \file
\brief TransportPacket public header */
-#ifndef HH_TransportPacket_
-#define HH_TransportPacket_ 1
+#ifndef HH_SENF_Packets_MPEGDVBBundle_TransportPacket_
+#define HH_SENF_Packets_MPEGDVBBundle_TransportPacket_ 1
// Custom includes
-#include <algorithm>
#include "../../Packets/Packets.hh"
//#include "TransportPacket.mpp"
/** \brief Parse a Transport Stream packet
Parser implementing the header of a MPEG Transport Stream packet.
+ \image html TransportPacket.png
\see TransportPacketType
*/
- struct Parse_TransportPacket : public PacketParserBase
+ struct TransportPacketParser : public PacketParserBase
{
-# include SENF_FIXED_PARSER()
+# include SENF_PARSER()
- SENF_PARSER_FIELD( sync_byte, Parse_UInt8 );
+ SENF_PARSER_FIELD ( sync_byte, UInt8Parser );
+
+ SENF_PARSER_BITFIELD ( transport_error_indicator, 1, bool );
+ SENF_PARSER_BITFIELD_RO ( pusi, 1, bool );
+ SENF_PARSER_BITFIELD ( transport_priority, 1, bool );
+ SENF_PARSER_BITFIELD ( pid, 13, unsigned );
+ SENF_PARSER_BITFIELD ( transport_scrmbl_ctrl, 2, unsigned );
+ SENF_PARSER_BITFIELD ( adaptation_field_ctrl, 2, unsigned );
+ SENF_PARSER_BITFIELD ( continuity_counter, 4, unsigned );
+
+ SENF_PARSER_PRIVATE_VARIANT ( pointer_field_, pusi,
+ (senf::VoidPacketParser) (UInt8Parser) );
- SENF_PARSER_BITFIELD( transport_error_indicator, 1, bool );
- SENF_PARSER_BITFIELD( pusi, 1, bool );
- SENF_PARSER_BITFIELD( transport_priority, 1, bool );
- SENF_PARSER_BITFIELD( pid, 13, unsigned );
- SENF_PARSER_BITFIELD( transport_scrmbl_ctrl, 2, unsigned );
- SENF_PARSER_BITFIELD( adaptation_field_ctrl, 2, unsigned );
- SENF_PARSER_BITFIELD( continuity_counter, 4, unsigned );
-
- SENF_PARSER_FINALIZE( Parse_TransportPacket );
-
-// Parse_UInt8 payload_pointer() const {
-// return parse<Parse_UInt8>( Parse_TransportPacket::fixed_bytes );
-// }
+ SENF_PARSER_FINALIZE( TransportPacketParser );
+
+ UInt8Parser pointer_field() const;
+ void init_fields() const;
+ void setPUSI(bool pusi) const;
+
+ SENF_PARSER_INIT() {
+ defaultInit();
+ init_fields();
+ }
};
/** \brief Transport Stream packet
<td>transport_packet() {</td> <td></td>
</tr>
<tr>
- <td style="padding-left:2em">\ref Parse_TransportPacket::sync_byte() "sync_byte"</td>
+ <td style="padding-left:2em">\ref TransportPacketParser::sync_byte() "sync_byte"</td>
<td>8</td></tr>
<tr>
- <td style="padding-left:2em">\ref Parse_TransportPacket::transport_error_indicator() "transport_error_indicator"</td>
+ <td style="padding-left:2em">\ref TransportPacketParser::transport_error_indicator() "transport_error_indicator"</td>
<td>1</td></tr>
<tr>
- <td style="padding-left:2em">\ref Parse_TransportPacket::pusi() "payload_uni_start_indicator"</td>
+ <td style="padding-left:2em">\ref TransportPacketParser::pusi() "payload_uni_start_indicator"</td>
<td>1</td></tr>
<tr>
- <td style="padding-left:2em">\ref Parse_TransportPacket::transport_priority() "transport_priority"</td>
+ <td style="padding-left:2em">\ref TransportPacketParser::transport_priority() "transport_priority"</td>
<td>1</td></tr>
<tr>
- <td style="padding-left:2em">\ref Parse_TransportPacket::pid() "PID"</td>
+ <td style="padding-left:2em">\ref TransportPacketParser::pid() "PID"</td>
<td>13</td></tr>
<tr>
- <td style="padding-left:2em">\ref Parse_TransportPacket::transport_scrmbl_ctrl() "transport_scrambling_control"</td>
+ <td style="padding-left:2em">\ref TransportPacketParser::transport_scrmbl_ctrl() "transport_scrambling_control"</td>
<td>2</td></tr>
<tr>
- <td style="padding-left:2em">\ref Parse_TransportPacket::adaptation_field_ctrl() "adaptation_field_control"</td>
+ <td style="padding-left:2em">\ref TransportPacketParser::adaptation_field_ctrl() "adaptation_field_control"</td>
<td>2</td></tr>
<tr>
- <td style="padding-left:2em">\ref Parse_TransportPacket::continuity_counter() "continuity_counter"</td>
+ <td style="padding-left:2em">\ref TransportPacketParser::continuity_counter() "continuity_counter"</td>
<td>4</td></tr>
<tr>
<td>}</td> <td></td></tr>
\ref TransportPacket
\par Fields:
- \ref Parse_TransportPacket
+ \ref TransportPacketParser
\ingroup protocolbundle_mpegdvb
*/
: public PacketTypeBase,
public PacketTypeMixin<TransportPacketType>
{
+#ifndef DOXYGEN
typedef PacketTypeMixin<TransportPacketType> mixin;
- typedef ConcretePacket<TransportPacketType> packet;
- typedef Parse_TransportPacket parser;
+#endif
+ typedef ConcretePacket<TransportPacketType> packet; ///< Transport packet typedef
+ typedef TransportPacketParser parser; ///< typedef to the parser of Transport packet
using mixin::nextPacketRange;
using mixin::init;
using mixin::initSize;
+ /** \brief Dump given Transport packet in readable form to given output stream */
static void dump(packet p, std::ostream & os);
+ static const byte SYNC_BYTE = 0x47;
};
/** \brief Transport packet typedef */
- typedef TransportPacketType::packet TransportPacket;
-
- #define TRANSPORT_PACKET_SYNC_BYTE 0x47
-
+ typedef ConcretePacket<TransportPacketType> TransportPacket;
}