ICMPv6Packet.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_ICMPv6Packet_
18 #define HH_SENF_Packets_DefaultBundle_ICMPv6Packet_ 1
19 
20 // Custom includes
21 #include <senf/Packets/Packets.hh>
22 #include "Registries.hh"
23 
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 namespace senf
26 {
28  {
29 # include SENF_FIXED_PARSER()
33 
35 
36  boost::uint16_t calcChecksum() const;
37  };
38 
54  : public PacketTypeBase,
55  public PacketTypeMixin<ICMPv6PacketType, ICMPTypes>
56  {
60 
61  using mixin::nextPacketRange;
62  using mixin::nextPacketType;
63  using mixin::init;
64  using mixin::initSize;
65 
66  static void dump(packet p, std::ostream & os);
67 
68  static key_t nextPacketKey(packet p) {
69  return p->type();
70  }
71 
72  static void finalize(packet p) {
73  p->type() << key(p.next(senf::nothrow));
74  p->checksum() << p->calcChecksum();
75  }
76 
77  static const IPTypes::key_t ipType = 58;
78  };
79 
85 }
86 
87 //-/////////////////////////////////////////////////////////////////////////////////////////////////
88 //#include "IPv4Packet.cci"
89 //#include "IPv4Packet.ct"
90 //#include "IPv4Packet.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:
103 
PacketTypeMixin< ICMPv6PacketType, ICMPTypes > mixin
Definition: ICMPv6Packet.hh:57
ICMPv6PacketParser parser
Definition: ICMPv6Packet.hh:59
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.
boost::uint8_t key_t
Definition: Registries.hh:61
#define SENF_PARSER_FIELD(name, type)
Define normal parser field.
ConcretePacket< ICMPv6PacketType > packet
Definition: ICMPv6Packet.hh:58
#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
Packet next() const
Get next packet in chain.
SENF_PACKET_PREVENT_TEMPLATE_INSTANTIATION(RadiotapPacket)
static void finalize(packet p)
Definition: ICMPv6Packet.hh:72
nothrow
ICMP Packet for IPv6.
Definition: ICMPv6Packet.hh:53
UInt16Parser checksum() const
UInt8Parser code() const
boost::uint16_t calcChecksum() const
Definition: ICMPv6Packet.cc:32
Parser Base class.
static key_t nextPacketKey(packet p)
Definition: ICMPv6Packet.hh:68
Parse 16bit unsigned byte aligned integer.
Definition: IntParser.hh:174
UInt8Parser type() const
ConcretePacket< ICMPv6PacketType > ICMPv6Packet
ICMPv6 packet typedef.
Definition: ICMPv6Packet.hh:83