PPPoEPacket.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_DefaultBundle_PPPoEPacket_
18 #define HH_SENF_Packets_DefaultBundle_PPPoEPacket_ 1
19 
20 // Custom includes
21 #include <senf/Packets/Packets.hh>
22 #include "Registries.hh"
23 
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 
26 namespace senf {
27 
34  {
35 # include SENF_FIXED_PARSER()
36 
37  SENF_PARSER_BITFIELD( version, 4, unsigned );
38  SENF_PARSER_BITFIELD( type, 4, unsigned );
43 
45 
47  version() = 1;
48  type() = 1;
49  code() = 0;
50  sessionId() = 0x0000;
51  }
52  };
53 
54  template <typename PacketType>
56  : public PacketTypeBase,
57  public PacketTypeMixin<PacketType, EtherTypes>
58  {
62 
63  using mixin::nextPacketRange;
64  using mixin::initSize;
65  using mixin::init;
66 
67  static factory_t nextPacketType(packet p);
68  static void dump(packet p, std::ostream & os);
69  };
70 
71  struct PPPoEDPacketType : public PPPoEPacketTypeBase<PPPoEDPacketType> {
72  static const EtherTypes::key_t etherType = 0x8863;
73 
74  };
75  struct PPPoESPacketType : public PPPoEPacketTypeBase<PPPoESPacketType> {
76  static const EtherTypes::key_t etherType = 0x8864;
77  };
78 
81 
84 }
85 
86 
87 //-/////////////////////////////////////////////////////////////////////////////////////////////////
88 //#include "PPPoEPacket.cci"
89 //#include "PPPoEPacket.ct"
90 //#include "PPPoEPacket.cti"
91 #endif
92 
93 
94 // Local Variables:
95 // mode: c++
96 // fill-column: 100
97 // c-file-style: "senf"
98 // indent-tabs-mode: nil
99 // ispell-local-dictionary: "american"
100 // compile-command: "scons -u test"
101 // comment-column: 40
102 // End:
UInt16Parser pppProtocol() const
#define SENF_PARSER_BITFIELD(name, bits, type)
Define bit-field.
UInt16Parser sessionId() const
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.
DefaultBundle packet registries public header.
ConcretePacket< PPPoESPacketType > PPPoESPacket
Definition: PPPoEPacket.hh:80
#define SENF_PARSER_FIELD(name, type)
Define normal parser field.
#define SENF_PARSER_FINALIZE(name)
Generate parser control members.
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)
ConcretePacket< PacketType > packet
Definition: PPPoEPacket.hh:60
PacketTypeMixin< PacketType, EtherTypes > mixin
Definition: PPPoEPacket.hh:59
senf::UIntFieldParser<?,?+4 > type() const
senf::UIntFieldParser<?,?+4 > version() const
Parser Base class.
PacketInterpreterBase::factory_t factory_t
Definition: PacketType.hh:112
Parse a PPPoE header.
Definition: PPPoEPacket.hh:33
ConcretePacket< PPPoEDPacketType > PPPoEDPacket
Definition: PPPoEPacket.hh:79
Parse 16bit unsigned byte aligned integer.
Definition: IntParser.hh:174
boost::uint16_t key_t
Definition: Registries.hh:35
UInt16Parser length() const
PPPoEPacketParser parser
Definition: PPPoEPacket.hh:61
UInt8Parser code() const