2 // Fraunhofer Institute for Open Communication Systems (FOKUS)
3 // Competence Center NETwork research (NET), St. Augustin, GERMANY
4 // Philipp Batroff <Philipp.Batroff@fokus.fraunhofer.de>
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #ifndef HH_ICMPV6Packet
22 #define HH_ICMPV6Packet
25 #include "../../Packets/Packets.hh"
26 #include "../../Packets/DefaultBundle/IPv6Packet.hh"
29 struct ICMPV6PacketParser : public senf::PacketParserBase
31 # include SENF_FIXED_PARSER()
32 SENF_PARSER_FIELD ( type, senf::UInt8Parser );
33 SENF_PARSER_FIELD ( code, senf::UInt8Parser );
34 SENF_PARSER_PRIVATE_FIELD ( checksum, senf::UInt16Parser);
36 SENF_PARSER_FINALIZE ( ICMPV6PacketParser );
38 void calcChecksum() const;
39 boost::uint16_t checksumOutput() const
40 { return this->checksum();}
45 typedef boost::uint16_t key_t;
48 struct ICMPV6PacketType
49 : public senf::PacketTypeBase,
50 public senf::PacketTypeMixin<ICMPV6PacketType, ICMPTypes>
52 typedef senf::PacketTypeMixin<ICMPV6PacketType, ICMPTypes> mixin;
53 typedef senf::ConcretePacket<ICMPV6PacketType> packet;
54 typedef ICMPV6PacketParser parser;
56 using mixin::nextPacketRange;
57 using mixin::nextPacketType;
59 using mixin::initSize;
61 static void dump(packet p, std::ostream & os);
62 static senf::IpTypes::key_t nextPacketKey(packet p) {
65 static void finalize(packet p) {
67 p->type() << key(p.next(senf::nothrow));
71 typedef ICMPV6PacketType::packet ICMPv6Packet;