MPESection.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Packets_MPEGDVBBundle_MPESection_
18 #define HH_SENF_Packets_MPEGDVBBundle_MPESection_ 1
19 
20 // Custom includes
21 #include <boost/crc.hpp>
22 #include <senf/Packets/Packets.hh>
23 
24 //#include "MPESection.mpp"
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 
27 namespace senf {
28 
30  {
31 # include SENF_FIXED_PARSER()
32 
33  SENF_PARSER_BITFIELD( delta_t, 12, unsigned );
36  SENF_PARSER_BITFIELD( address, 18, unsigned );
37 
39  };
40 
41 
49  {
50  public:
51 # include SENF_FIXED_PARSER()
52 
54 
55  SENF_PARSER_BITFIELD ( section_syntax_indicator, 1, bool );
56  SENF_PARSER_BITFIELD ( private_indicator, 1, bool );
57  SENF_PARSER_PRIVATE_BITFIELD( reserved_1, 2, unsigned );
58  SENF_PARSER_BITFIELD ( section_length, 12, unsigned );
59 
62 
63  SENF_PARSER_PRIVATE_BITFIELD( reserved_2, 2, unsigned );
64  SENF_PARSER_BITFIELD ( payload_scrmbl_ctrl, 2, unsigned );
65  SENF_PARSER_BITFIELD ( addr_scrmbl_ctrl, 2, unsigned );
66  SENF_PARSER_BITFIELD ( llc_snap_flag, 1, bool );
67  SENF_PARSER_BITFIELD ( curr_next_indicator, 1, bool );
68 
69  SENF_PARSER_FIELD( section_num, UInt8Parser );
70  SENF_PARSER_FIELD( last_section_num, UInt8Parser );
71 
73 
75 
76  SENF_PARSER_PRIVATE_BITFIELD( ip_datagram_version, 4, unsigned );
77 
79  table_id() = 0x3e;
80  section_syntax_indicator() = 1;
81  private_indicator() = 0;
82  reserved_1() = 3;
83  reserved_2() = 3;
84  payload_scrmbl_ctrl() = 0;
85  addr_scrmbl_ctrl() = 0;
86  curr_next_indicator() = 1;
87  }
88 
89  UInt32Parser crc() const { return parse<UInt32Parser>( data().size()-4 ); }
90  boost::uint32_t calcCrc() const;
91 
92  friend struct MPESectionType;
93 
94  private:
95  typedef boost::crc_optimal<32, 0x04C11DB7, 0xFFFFFFFF, 0, false, false> crc32_t;
96  };
97 
98 
111  : public PacketTypeBase,
112  public PacketTypeMixin<MPESectionType>
113  {
117 
118  using mixin::nextPacketRange;
119  using mixin::init;
120 
122  static void dump(packet p, std::ostream & os);
123 
124  static void finalize(packet p);
125 
126  static factory_t nextPacketType(packet p);
127 
128  static PacketParserBase::size_type initSize();
129  static PacketParserBase::size_type initHeadSize();
130  };
131 
137 }
138 
139 //-/////////////////////////////////////////////////////////////////////////////////////////////////
140 //#include "MPESection.cci"
141 //#include "MPESection.ct"
142 //#include "MPESection.cti"
143 #endif
144 
145 
146 // Local Variables:
147 // mode: c++
148 // fill-column: 100
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
154 // End:
ConcretePacket< MPESectionType > packet
MPESection packet typedef.
Definition: MPESection.hh:115
senf::FlagParser<?> frame_boundary() const
PacketTypeMixin< MPESectionType > mixin
Definition: MPESection.hh:114
#define SENF_PARSER_BITFIELD(name, bits, type)
Define bit-field.
Parse a MPE Section.
Definition: MPESection.hh:48
Mixin to provide standard implementations for nextPacketRange and nextPacketType. ...
Definition: PacketType.hh:300
Parse 8bit unsigned byte aligned integer.
Definition: IntParser.hh:91
Packets public header.
#define SENF_PARSER_FIELD(name, type)
Define normal parser field.
MPE Section.
Definition: MPESection.hh:110
#define SENF_PARSER_FINALIZE(name)
Generate parser control members.
senf::UIntFieldParser<?,?+12 > delta_t() const
MPESectionParser parser
typedef to the parser of MPESection
Definition: MPESection.hh:116
void dump(std::ostream &os, DirectoryNode &dir=root())
Protocol specific packet handle.
Definition: Packet.hh:87
Helper base-class implementing the PacketType interface.
Definition: PacketType.hh:100
#define SENF_PARSER_INIT()
Define parser initialization routine.
SENF_PACKET_PREVENT_TEMPLATE_INSTANTIATION(RadiotapPacket)
detail::packet::size_type size_type
Unsigned integral type.
senf::FlagParser<?> table_boundary() const
senf::UIntFieldParser<?,?+18 > address() const
size_type size() const
Returns the number of bytes in the packet data.
Parser Base class.
PacketData & data() const
Access the packets raw data container.
Parse 32bit unsigned byte aligned integer.
Definition: IntParser.hh:310
PacketInterpreterBase::factory_t factory_t
Definition: PacketType.hh:112
#define SENF_PARSER_PRIVATE_BITFIELD(name, bits, type)
Define bit-field (private)
ConcretePacket< MPESectionType > MPESection
MPESection packet typedef.
Definition: MPESection.hh:135
UInt32Parser crc() const
Definition: MPESection.hh:89