SNDUPacket.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_SNDUPacket_
18 #define HH_SENF_Packets_MPEGDVBBundle_SNDUPacket_ 1
19 
20 // Custom includes
21 #include <boost/crc.hpp>
22 #include <senf/Packets/Packets.hh>
24 
25 //#include "SNDUPacket.mpp"
26 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 
28 namespace senf {
29 
37  {
38 # include SENF_PARSER()
39 
40  /* We first define the fields as they appear in the field. Some of the fields are declared
41  private. We provide custom accessors for those fields further down. */
42 
43  SENF_PARSER_PRIVATE_BITFIELD( d_bit_, 1 , unsigned );
44  SENF_PARSER_BITFIELD ( length, 15 , unsigned );
48 
50 
52  { return destination_().get<0>(); }
53 
54  bool d_bit()
55  { return d_bit_(); }
56 
58  { destination_().init<0>(); }
59 
61  { destination_().init<1>(); }
62 
64  { return parse<UInt32Parser>( data().size() - 4 ); }
65 
66  boost::uint32_t calcCrc() const;
67  };
68 
69 
71  typedef boost::uint16_t key_t;
72  };
73 
86  : public PacketTypeBase
87 // public PacketTypeMixin<SNDUPacketType, ULEExtHeaderTypes>
88  {
89 // typedef PacketTypeMixin<SNDUPacketType, ULEExtHeaderType> mixin;
92 
93 // using mixin::nextPacketRange;
94 // using mixin::nextPacketType;
95 // using mixin::init;
96 
97 // static key_t nextPacketKey(packet p);
98 
99  static void init(packet p);
100  static factory_t nextPacketType(packet p);
101  static optional_range nextPacketRange(packet p);
102  static void dump(packet p, std::ostream & os);
103  static PacketParserBase::size_type initSize();
104  static PacketParserBase::size_type initHeadSize();
105  };
106 
108 
109  typedef boost::crc_optimal<32, 0x04C11DB7, 0xFFFFFFFF, 0, false, false> ule_crc32;
110 
111 
117 # define ULE_END_INDICATOR 0xffff
118 }
119 
120 
121 //-/////////////////////////////////////////////////////////////////////////////////////////////////
122 //#include "SNDUPacket.cci"
123 //#include "SNDUPacket.ct"
124 //#include "SNDUPacket.cti"
125 #endif
126 
127 
128 // Local Variables:
129 // mode: c++
130 // fill-column: 100
131 // c-file-style: "senf"
132 // indent-tabs-mode: nil
133 // ispell-local-dictionary: "american"
134 // compile-command: "scons -u test"
135 // comment-column: 40
136 // End:
EthernetPacket public header.
senf::UIntFieldParser<?,?+1 > d_bit_() const
boost::crc_optimal< 32, 0x04C11DB7, 0xFFFFFFFF, 0, false, false > ule_crc32
Definition: SNDUPacket.hh:109
#define SENF_PARSER_BITFIELD(name, bits, type)
Define bit-field.
PacketInterpreterBase::optional_range optional_range
Definition: PacketType.hh:111
SNDUPacketType::packet SNDUPacket
Definition: SNDUPacket.hh:107
parse ULE SNDU Packet
Definition: SNDUPacket.hh:36
senf::UIntFieldParser<?,?+15 > length() const
Packets public header.
ULE SNDU Packet.
Definition: SNDUPacket.hh:85
senf::Parse_Variant_Direct< d_bit__t,?,(MACAddressParser)(VoidPacketParser) >::parser destination_() const
#define SENF_PARSER_FIELD(name, type)
Define normal parser field.
#define SENF_PARSER_PRIVATE_VARIANT(name, chooser, types)
Define private VariantParser field.
Parse an Ethernet MAC address.
SNDUPacketParser parser
Definition: SNDUPacket.hh:91
#define SENF_PARSER_FINALIZE(name)
Generate parser control members.
boost::uint16_t key_t
Definition: SNDUPacket.hh:71
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
Default parser parsing nothing.
void init() const
Default implementation.
detail::packet::size_type size_type
Unsigned integral type.
ConcretePacket< SNDUPacketType > packet
Definition: SNDUPacket.hh:90
MACAddressParser destination()
Definition: SNDUPacket.hh:51
boost::uint32_t calcCrc() const
Definition: SNDUPacket.cc:26
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)
Parse 16bit unsigned byte aligned integer.
Definition: IntParser.hh:174
UInt32Parser crc()
Definition: SNDUPacket.hh:63
UInt16Parser type() const