2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
4 // Stefan Bund <g0dil@berlios.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.
22 \brief IpV6Packet public header */
24 #ifndef HH_IpV6Packet_
25 #define HH_IpV6Packet_ 1
28 #include "Packets/Packets.hh"
29 #include "IpV4Packet.hh"
31 //#include "IpV6Packet.mpp"
32 ///////////////////////////////hh.p////////////////////////////////////////
36 /** \brief Parse an IpV6 packet
38 Parser implementing the IpV6 header. The fields implemented are:
41 <tr><th>Field name</th><th>Parser type</th></tr>
42 <tr><td>version</td><td>\ref Parse_Version</td></tr>
43 <tr><td>trafficClass</td><td>\ref Parse_Class</td></tr>
44 <tr><td>flowLabel</td><td>\ref Parse_FlowLabel</td></tr>
45 <tr><td>length</td><td>\ref Parse_16bit</td></tr>
46 <tr><td>nextHeader</td><td>\ref Parse_8bit</td></tr>
47 <tr><td>hopLimit</td><td>\ref Parse_8bit</td></tr>
48 <tr><td>source</td><td>\ref Parse_Addr</td></tr>
49 <tr><td>destination</td><td>\ref Parse_Addr</td></tr>
52 \see IpV6PacketType \n
53 <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
55 struct Parse_IpV6 : public PacketParserBase
57 SENF_PACKET_PARSER_NO_INIT(Parse_IpV6);
59 ///////////////////////////////////////////////////////////////////////////
61 typedef Parse_UIntField < 0, 4 > Parse_Version;
62 typedef Parse_UIntField < 4, 12 > Parse_Class;
63 typedef Parse_UIntField < 12, 32 > Parse_FlowLabel;
64 typedef Parse_UInt8 Parse_8bit;
65 typedef Parse_UInt16 Parse_16bit;
67 typedef Parse_Array < 16, Parse_8bit > Parse_Addr;
69 SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS(
70 ((OverlayField)( version, Parse_Version ))
71 ((OverlayField)( trafficClass, Parse_Class ))
72 ((Field )( flowLabel, Parse_FlowLabel ))
73 ((Field )( length, Parse_16bit ))
74 ((Field )( nextHeader, Parse_8bit ))
75 ((Field )( hopLimit, Parse_8bit ))
76 ((Field )( source, Parse_Addr ))
77 ((Field )( destination, Parse_Addr )) );
84 /** \brief IpV6 packet
86 \par Packet type (typedef):
92 \par Associated registries:
95 \ingroup protocolbundle_default
98 : public PacketTypeBase,
99 public PacketTypeMixin<IpV6PacketType, IpTypes>
101 typedef PacketTypeMixin<IpV6PacketType, IpTypes> mixin;
102 typedef ConcretePacket<IpV6PacketType> packet;
103 typedef Parse_IpV6 parser;
105 using mixin::nextPacketRange;
106 using mixin::nextPacketType;
107 using mixin::initSize;
110 static registry_key_t nextPacketKey(packet p)
111 { return p->nextHeader(); }
113 static void dump(packet p, std::ostream & os);
116 /** \brief IpV6 packet typedef */
117 typedef IpV6PacketType::packet IpV6Packet;
122 ///////////////////////////////hh.e////////////////////////////////////////
124 #ifndef SENF_PACKETS_DECL_ONLY
125 //#include "IpV6Packet.cci"
126 //#include "IpV6Packet.ct"
127 //#include "IpV6Packet.cti"
134 // c-file-style: "senf"
135 // indent-tabs-mode: nil
136 // ispell-local-dictionary: "american"
137 // compile-command: "scons -u test"
138 // comment-column: 40