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 /** \brief ICMP Packet for IPv6
52 \par Packet type (typedef):
56 \ref ICMPv6PacketParser
57 \image html ICMPv6Packet.png
59 \par Associated registries:
62 \ingroup protocolbundle_default
64 struct ICMPv6PacketType
65 : public PacketTypeBase,
66 public PacketTypeMixin<ICMPv6PacketType, ICMPTypes>
68 typedef PacketTypeMixin<ICMPv6PacketType, ICMPTypes> mixin;
69 typedef ConcretePacket<ICMPv6PacketType> packet;
70 typedef ICMPv6PacketParser parser;
72 using mixin::nextPacketRange;
73 using mixin::nextPacketType;
75 using mixin::initSize;
77 static void dump(packet p, std::ostream & os);
79 static IpTypes::key_t nextPacketKey(packet p) {
83 static void finalize(packet p) {
84 p->checksum() << p->calcChecksum();
85 p->type() << key(p.next(senf::nothrow));
89 typedef ConcretePacket<ICMPv6PacketType> ICMPv6Packet;
98 // c-file-style: "senf"
99 // indent-tabs-mode: nil
100 // ispell-local-dictionary: "american"
101 // compile-command: "scons -u test"
102 // comment-column: 40