4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Philipp Batroff <pug@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #ifndef HH_SENF_Packets_DefaultBundle_ICMPv6Packet_
24 #define HH_SENF_Packets_DefaultBundle_ICMPv6Packet_ 1
27 #include "../../Packets/Packets.hh"
28 #include "../../Packets/DefaultBundle/IPv6Packet.hh"
33 struct ICMPv6PacketParser : public PacketParserBase
35 # include SENF_FIXED_PARSER()
36 SENF_PARSER_FIELD ( type, UInt8Parser );
37 SENF_PARSER_FIELD ( code, UInt8Parser );
38 SENF_PARSER_FIELD ( checksum, UInt16Parser );
40 SENF_PARSER_FINALIZE ( ICMPv6PacketParser );
42 boost::uint16_t calcChecksum() const;
47 typedef boost::uint16_t key_t;
50 struct ICMPv6PacketType
51 : public PacketTypeBase,
52 public PacketTypeMixin<ICMPv6PacketType, ICMPTypes>
54 typedef PacketTypeMixin<ICMPv6PacketType, ICMPTypes> mixin;
55 typedef ConcretePacket<ICMPv6PacketType> packet;
56 typedef ICMPv6PacketParser parser;
58 using mixin::nextPacketRange;
59 using mixin::nextPacketType;
61 using mixin::initSize;
63 static void dump(packet p, std::ostream & os);
65 static IpTypes::key_t nextPacketKey(packet p) {
69 static void finalize(packet p) {
70 p->checksum() << p->calcChecksum();
71 p->type() << key(p.next(senf::nothrow));
75 typedef ConcretePacket<ICMPv6PacketType> ICMPv6Packet;