1 // $Id:MPESection.hh 560 2007-12-13 14:39:37Z tho $
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at
9 // http://senf.berlios.de/license.html
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on,
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
15 // Software distributed under the License is distributed on an "AS IS" basis,
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17 // for the specific language governing rights and limitations under the License.
19 // The Original Code is Fraunhofer FOKUS code.
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
26 // Thorsten Horstmann <tho@berlios.de>
29 \brief MPESection public header */
31 #ifndef HH_SENF_Packets_MPEGDVBBundle_MPESection_
32 #define HH_SENF_Packets_MPEGDVBBundle_MPESection_ 1
35 #include <boost/crc.hpp>
36 #include <senf/Packets/Packets.hh>
38 //#include "MPESection.mpp"
39 //-/////////////////////////////////////////////////////////////////////////////////////////////////
43 struct MPERealTimeParametersParser : public PacketParserBase
45 # include SENF_FIXED_PARSER()
47 SENF_PARSER_BITFIELD ( delta_t, 12, unsigned );
48 SENF_PARSER_BITFIELD ( table_boundary, 1, bool );
49 SENF_PARSER_BITFIELD ( frame_boundary, 1, bool );
50 SENF_PARSER_BITFIELD ( address, 18, unsigned );
52 SENF_PARSER_FINALIZE( MPERealTimeParametersParser );
56 /** \brief Parse a MPE Section
58 Parser implementing the header of a MPE Section
62 class MPESectionParser : public PacketParserBase
65 # include SENF_FIXED_PARSER()
67 SENF_PARSER_FIELD( table_id, UInt8Parser );
69 SENF_PARSER_BITFIELD ( section_syntax_indicator, 1, bool );
70 SENF_PARSER_BITFIELD ( private_indicator, 1, bool );
71 SENF_PARSER_PRIVATE_BITFIELD( reserved_1, 2, unsigned );
72 SENF_PARSER_BITFIELD ( section_length, 12, unsigned );
74 SENF_PARSER_FIELD( mac_addr_6, UInt8Parser );
75 SENF_PARSER_FIELD( mac_addr_5, UInt8Parser );
77 SENF_PARSER_PRIVATE_BITFIELD( reserved_2, 2, unsigned );
78 SENF_PARSER_BITFIELD ( payload_scrmbl_ctrl, 2, unsigned );
79 SENF_PARSER_BITFIELD ( addr_scrmbl_ctrl, 2, unsigned );
80 SENF_PARSER_BITFIELD ( llc_snap_flag, 1, bool );
81 SENF_PARSER_BITFIELD ( curr_next_indicator, 1, bool );
83 SENF_PARSER_FIELD( section_num, UInt8Parser );
84 SENF_PARSER_FIELD( last_section_num, UInt8Parser );
86 SENF_PARSER_FIELD( real_time_parameters, MPERealTimeParametersParser );
88 SENF_PARSER_FINALIZE( MPESectionParser );
90 SENF_PARSER_PRIVATE_BITFIELD( ip_datagram_version, 4, unsigned );
94 section_syntax_indicator() = 1;
95 private_indicator() = 0;
98 payload_scrmbl_ctrl() = 0;
99 addr_scrmbl_ctrl() = 0;
100 curr_next_indicator() = 1;
103 UInt32Parser crc() const { return parse<UInt32Parser>( data().size()-4 ); }
104 boost::uint32_t calcCrc() const;
106 friend struct MPESectionType;
109 typedef boost::crc_optimal<32, 0x04C11DB7, 0xFFFFFFFF, 0, false, false> crc32_t;
113 /** \brief MPE Section
115 \par Packet type (typedef):
119 \ref MPESectionParser
120 \image html MPESection.png
122 \ingroup protocolbundle_mpegdvb
124 struct MPESectionType
125 : public PacketTypeBase,
126 public PacketTypeMixin<MPESectionType>
129 typedef PacketTypeMixin<MPESectionType> mixin;
131 typedef ConcretePacket<MPESectionType> packet; ///< MPESection packet typedef
132 typedef MPESectionParser parser; ///< typedef to the parser of MPESection
134 using mixin::nextPacketRange;
137 /** \brief Dump given MPESection in readable form to given output stream */
138 static void dump(packet p, std::ostream & os);
140 static void finalize(packet p);
142 static factory_t nextPacketType(packet p);
144 static PacketParserBase::size_type initSize();
145 static PacketParserBase::size_type initHeadSize();
148 /** \brief MPESection packet typedef
149 \ingroup protocolbundle_mpegdvb
151 typedef ConcretePacket<MPESectionType> MPESection;
154 //-/////////////////////////////////////////////////////////////////////////////////////////////////
155 //#include "MPESection.cci"
156 //#include "MPESection.ct"
157 //#include "MPESection.cti"
164 // c-file-style: "senf"
165 // indent-tabs-mode: nil
166 // ispell-local-dictionary: "american"
167 // compile-command: "scons -u test"
168 // comment-column: 40