GREPacket.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_GREPacket_
18 #define HH_SENF_Packets_MPEGDVBBundle_GREPacket_ 1
19 
20 // Custom includes
21 #include <senf/Packets/Packets.hh>
23 
24 //#include "GREPacket.mpp"
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 
27 namespace senf {
28 
36 # include SENF_PARSER()
40  };
41 
43  {
44 # include SENF_PARSER()
45 
46  SENF_PARSER_BITFIELD ( checksum_present, 1, bool );
47  SENF_PARSER_PRIVATE_BITFIELD( reserved0_, 12, unsigned ); // TODO: SKIP !!
48  SENF_PARSER_BITFIELD ( version_number, 3, unsigned ); // TODO: Always Zero !!
49  SENF_PARSER_FIELD ( protocol_type, UInt16Parser );
50  SENF_PARSER_PRIVATE_VARIANT ( checksum_, checksum_present,
52 
54 
55  private:
56  UInt16Parser checksum() const
57  { return checksum_().get<1>().checksum1_(); }
58  };
59 
72  : public PacketTypeBase,
73  public PacketTypeMixin<GREPacketType, EtherTypes>
74  {
78 
79  using mixin::nextPacketRange;
80  using mixin::nextPacketType;
81  using mixin::init;
82  using mixin::initSize;
83 
84  static void dump(packet p, std::ostream & os);
85  static EtherTypes::key_t nextPacketKey(packet p) {
86  return p->protocol_type();
87  }
88  static void finalize(packet p);
89 
90  static const IPTypes::key_t ipType = 47;
91  };
92 
95 
96 
97 }
98 
99 
100 //-/////////////////////////////////////////////////////////////////////////////////////////////////
101 //#include "TransportPacket.cci"
102 //#include "TransportPacket.ct"
103 //#include "TransportPacket.cti"
104 #endif
105 
106 
107 // Local Variables:
108 // mode: c++
109 // fill-column: 100
110 // c-file-style: "senf"
111 // indent-tabs-mode: nil
112 // ispell-local-dictionary: "american"
113 // compile-command: "scons -u test"
114 // comment-column: 40
115 // End:
#define SENF_PARSER_BITFIELD(name, bits, type)
Define bit-field.
Mixin to provide standard implementations for nextPacketRange and nextPacketType. ...
Definition: PacketType.hh:300
Packets public header.
DefaultBundle packet registries public header.
boost::uint8_t key_t
Definition: Registries.hh:61
#define SENF_PARSER_FIELD(name, type)
Define normal parser field.
#define SENF_PARSER_PRIVATE_VARIANT(name, chooser, types)
Define private VariantParser field.
#define SENF_PARSER_PRIVATE_FIELD(name, type)
Define parser field (private)
ConcretePacket< GREPacketType > packet
Definition: GREPacket.hh:76
#define SENF_PARSER_FINALIZE(name)
Generate parser control members.
UInt16Parser reserved1_() const
GREPacketParser parser
Definition: GREPacket.hh:77
Parse a GRE packet.
Definition: GREPacket.hh:35
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.
PacketTypeMixin< GREPacketType, EtherTypes > mixin
Definition: GREPacket.hh:75
UInt16Parser checksum1_() const
GRE packet.
Definition: GREPacket.hh:71
Parser Base class.
GREPacketType::packet GREPacket
GRE packet typedef.
Definition: GREPacket.hh:94
static EtherTypes::key_t nextPacketKey(packet p)
Definition: GREPacket.hh:85
#define SENF_PARSER_PRIVATE_BITFIELD(name, bits, type)
Define bit-field (private)
Parse 16bit unsigned byte aligned integer.
Definition: IntParser.hh:174
boost::uint16_t key_t
Definition: Registries.hh:35