1 // $Id:DSMCCSection.hh 327 2007-07-20 10:03:44Z tho $
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Thorsten Horstmann <thorsten.horstmann@fokus.fraunhofer.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief MPESection public header */
26 #ifndef HH_MPESection_
27 #define HH_MPESection_ 1
30 #include <boost/crc.hpp>
32 #include "../../Packets/Packets.hh"
34 //#include "MPESection.mpp"
35 ///////////////////////////////hh.p////////////////////////////////////////
39 struct Parse_MPERealTimeParameters : public PacketParserBase
41 # include SENF_FIXED_PARSER()
43 SENF_PARSER_BITFIELD ( delta_t, 12, unsigned );
44 SENF_PARSER_BITFIELD ( table_boundary, 1, bool );
45 SENF_PARSER_BITFIELD ( frame_boundary, 1, bool );
46 SENF_PARSER_BITFIELD ( address, 18, unsigned );
48 SENF_PARSER_FINALIZE( Parse_MPERealTimeParameters );
52 /** \brief Parse a MPE Section
54 Parser implementing the header of a MPE Section
58 struct Parse_MPESection : public PacketParserBase
60 # include SENF_FIXED_PARSER()
62 SENF_PARSER_FIELD( table_id, Parse_UInt8 );
64 SENF_PARSER_BITFIELD ( section_syntax_indicator, 1, bool );
65 SENF_PARSER_BITFIELD ( private_indicator, 1, bool );
66 SENF_PARSER_PRIVATE_BITFIELD( reserved_1, 2, unsigned );
67 SENF_PARSER_BITFIELD ( section_length, 12, unsigned );
69 SENF_PARSER_FIELD( mac_addr_6, Parse_UInt8 );
70 SENF_PARSER_FIELD( mac_addr_5, Parse_UInt8 );
72 SENF_PARSER_PRIVATE_BITFIELD( reserved_2, 2, unsigned );
73 SENF_PARSER_BITFIELD ( payload_scrmbl_ctrl, 2, unsigned );
74 SENF_PARSER_BITFIELD ( addr_scrmbl_ctrl, 2, unsigned );
75 SENF_PARSER_BITFIELD ( llc_snap_flag, 1, bool );
76 SENF_PARSER_BITFIELD ( curr_next_indicator, 1, bool );
78 SENF_PARSER_FIELD( section_num, Parse_UInt8 );
79 SENF_PARSER_FIELD( last_section_num, Parse_UInt8 );
81 SENF_PARSER_FIELD( real_time_parameters, Parse_MPERealTimeParameters );
83 SENF_PARSER_FINALIZE( Parse_MPESection );
85 SENF_PARSER_PRIVATE_BITFIELD( ip_datagram_version, 4, unsigned );
89 section_syntax_indicator() = 1;
90 private_indicator() = 0;
93 payload_scrmbl_ctrl() = 0;
94 addr_scrmbl_ctrl() = 0;
95 curr_next_indicator() = 1;
98 Parse_UInt32 crc() const { return parse<Parse_UInt32>( data().size()-4 ); }
100 // typedef boost::crc_optimal<32, 0x04C11DB7, 0xFFFFFFFF, 0, false, false> crc32_t;
101 // boost::uint32_t calcCrc() const;
103 friend class MPESectionType;
107 /** \brief MPE Section
109 \par Packet type (typedef):
113 \ref Parse_MPESection
115 \ingroup protocolbundle_mpegdvb
117 struct MPESectionType
118 : public PacketTypeBase,
119 public PacketTypeMixin<MPESectionType>
121 typedef PacketTypeMixin<MPESectionType> mixin;
122 typedef ConcretePacket<MPESectionType> packet;
123 typedef Parse_MPESection parser;
125 using mixin::nextPacketRange;
128 static void dump(packet p, std::ostream & os);
129 static void finalize(packet p);
130 static factory_t nextPacketType(packet p);
131 static PacketParserBase::size_type initSize();
132 static PacketParserBase::size_type initHeadSize();
135 typedef ConcretePacket<MPESectionType> MPESection;
139 ///////////////////////////////hh.e////////////////////////////////////////
140 //#include "MPESection.cci"
141 //#include "MPESection.ct"
142 //#include "MPESection.cti"
149 // c-file-style: "senf"
150 // indent-tabs-mode: nil
151 // ispell-local-dictionary: "american"
152 // compile-command: "scons -u test"
153 // comment-column: 40