4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
7 // Philipp Batroff <philipp.batroff@fokus.fraunhofer.de>
9 // This program is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 2 of the License, or
12 // (at your option) any later version.
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the
21 // Free Software Foundation, Inc.,
22 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 \brief IPv6Extensions public header */
27 #ifndef HH_SENF_Packets_DefaultBundle_IPv6Extensions_
28 #define HH_SENF_Packets_DefaultBundle_IPv6Extensions_ 1
31 #include "IPv6ExtOptions.hh"
32 #include "ListOptionTypeParser.hh"
33 #include "IPv6Packet.hh"
35 //#include "IPv6Extensions.mpp"
36 ///////////////////////////////hh.p////////////////////////////////////////
40 /** \brief Parse in IPv6 fragment extension header
42 Parser implementing the IPv6 fragment extension. The fields implemented are:
43 \image html IPv6FragmentPacket.png
45 \see IPv6ExtensionType_Fragment \n
46 <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
48 struct IPv6FragmentPacketParser : public PacketParserBase
50 # include SENF_FIXED_PARSER()
52 SENF_PARSER_FIELD ( nextHeader , UInt8Parser );
53 SENF_PARSER_PRIVATE_FIELD ( reserved1 , UInt8Parser );
54 SENF_PARSER_BITFIELD ( fragmentOffset , 13, unsigned );
55 SENF_PARSER_PRIVATE_BITFIELD ( reserved2 , 2, unsigned );
56 SENF_PARSER_BITFIELD ( moreFragments , 1, bool );
57 SENF_PARSER_FIELD ( id , UInt32Parser );
59 SENF_PARSER_FINALIZE(IPv6FragmentPacketParser);
62 /** \brief IPv6 fragment extension
64 \par Packet type (typedef):
65 \ref IPv6FragmentPacket
68 \ref IPv6FragmentPacketParser
70 \par Associated registries:
74 Set \a nextHeader from type of next packet if found in \ref IpTypes
76 \ingroup protocolbundle_default
78 struct IPv6FragmentPacketType
79 : public PacketTypeBase,
80 public PacketTypeMixin<IPv6FragmentPacketType, IpTypes>
83 typedef PacketTypeMixin<IPv6FragmentPacketType, IpTypes> mixin;
85 /** \brief IPv6 fragment extension packet typedef */
86 typedef ConcretePacket<IPv6FragmentPacketType> packet;
87 /** \brief typedef to the parser of IPv6 fragment extension packet */
88 typedef IPv6FragmentPacketParser parser;
90 using mixin::nextPacketRange;
91 using mixin::nextPacketType;
92 using mixin::initSize;
95 static key_t nextPacketKey(packet p)
96 { return p->nextHeader(); }
98 /** \brief Dump given IPv6FragmentPacket in readable form to given output stream */
99 static void dump(packet p, std::ostream & os);
101 static void finalize(packet p);
104 /** \brief IPv6 fragment extension packet typedef
105 \ingroup protocolbundle_default
107 typedef ConcretePacket<IPv6FragmentPacketType> IPv6FragmentPacket;
109 // =====================================================================================================
111 /** \brief Parse in IPv6 routing extension header
113 Parser implementing the IPv6 routing Header extension (type 0 only).
114 The fields implemented are:
115 \image html IPv6RoutingPacket.png
117 \see IPv6ExtensionType_Routing \n
118 <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
120 struct IPv6RoutingPacketParser : public PacketParserBase
123 The Type 0 Routing header has the following format: (RFC 2460)
125 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
126 | Next Header | Hdr Ext Len | Routing Type=0| Segments Left |
127 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
129 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
137 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
141 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
149 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
151 # include SENF_PARSER()
153 SENF_PARSER_FIELD ( nextHeader, UInt8Parser );
154 SENF_PARSER_FIELD ( headerLength, UInt8Parser );
155 SENF_PARSER_FIELD ( routingType, UInt8Parser ); //set to Zero for minimal implementation
156 SENF_PARSER_FIELD_RO ( segmentsLeft, UInt8Parser );
157 SENF_PARSER_FIELD ( reserved, UInt32Parser ); //set to zero by RFC
158 SENF_PARSER_VECTOR ( hopAddresses, segmentsLeft, INet6AddressParser );
160 SENF_PARSER_FINALIZE ( IPv6RoutingPacketParser );
162 //provisionary, since only type 0 is implemented
169 /** \brief IPv6 routing extension
171 \par Packet type (typedef):
172 \ref IPv6RoutingPacket
175 \ref IPv6RoutingPacketParser
177 \par Associated registries:
180 \par Finalize action:
181 Set \a nextHeader from type of next packet if found in \ref IpTypes
183 \ingroup protocolbundle_default
185 struct IPv6RoutingPacketType
186 : public PacketTypeBase,
187 public PacketTypeMixin<IPv6RoutingPacketType, IpTypes>
190 typedef PacketTypeMixin<IPv6RoutingPacketType, IpTypes> mixin;
192 /** \brief IPv6 routing extension packet typedef */
193 typedef ConcretePacket<IPv6RoutingPacketType> packet;
194 /** \brief typedef to the parser of IPv6 routing extension packet */
195 typedef IPv6RoutingPacketParser parser;
197 using mixin::nextPacketRange;
198 using mixin::nextPacketType;
200 using mixin::initSize;
202 static key_t nextPacketKey(packet p)
203 { return p->nextHeader(); }
205 /** \brief Dump given IPv6RoutingPacket in readable form to given output stream */
206 static void dump(packet p, std::ostream & os);
208 static void finalize(packet p);
211 /** \brief IPv6 routing extension packet typedef
212 \ingroup protocolbundle_default
214 typedef ConcretePacket<IPv6RoutingPacketType> IPv6RoutingPacket;
217 // =====================================================================================================
219 /** \brief Parse in IPv6 Hop-By-Hop extension header
221 Parser implementing the IPv6 routing Header extension. The fields implemented are:
222 \image html IPv6HopByHopOptionsPacket.png
224 \see IPv6ExtensionType_HopByHop \n
225 <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
227 struct IPv6HopByHopOptionsPacketParser : public PacketParserBase
229 # include SENF_PARSER()
231 SENF_PARSER_FIELD ( nextHeader, UInt8Parser );
232 SENF_PARSER_FIELD_RO ( headerLength, UInt8Parser );
234 typedef detail::FixedAuxParserPolicy<UInt8Parser, 1u> ListOptionTypeAuxPolicy;
235 typedef detail::ListOptionTypeParser_Policy<
236 IPv6GenericOptionParser, ListOptionTypeAuxPolicy> ListOptionTypePolicy;
237 typedef ListParser<ListOptionTypePolicy> ListOptionTypeParser;
239 SENF_PARSER_FIELD ( options, ListOptionTypeParser);
241 SENF_PARSER_FINALIZE ( IPv6HopByHopOptionsPacketParser );
244 /** \brief IPv6 Hop-By-Hop extension
246 \par Packet type (typedef):
247 \ref IPv6HopByHopOptionsPacket
250 \ref IPv6HopByHopOptionsPacketParser
252 \par Associated registries:
255 \par Finalize action:
256 Set \a nextHeader from type of next packet if found in \ref IpTypes
258 \ingroup protocolbundle_default
260 struct IPv6HopByHopOptionsPacketType
261 : public PacketTypeBase,
262 public PacketTypeMixin<IPv6HopByHopOptionsPacketType, IpTypes>
265 typedef PacketTypeMixin<IPv6HopByHopOptionsPacketType, IpTypes> mixin;
267 /** \brief IPv6 Hop-By-Hop extension packet typedef */
268 typedef ConcretePacket<IPv6HopByHopOptionsPacketType> packet;
269 /** \brief typedef to the parser of IPv6 Hop-By-Hop extension packet */
270 typedef IPv6HopByHopOptionsPacketParser parser;
272 using mixin::nextPacketRange;
273 using mixin::nextPacketType;
275 using mixin::initSize;
277 static key_t nextPacketKey(packet p) {
278 return p->nextHeader(); }
280 /** \brief Dump given IPv6HopByHopOptionsPacket in readable form to given output stream */
281 static void dump(packet p, std::ostream & os);
283 static void finalize(packet p);
286 /** \brief IPv6 routing Hop-By-Hop packet typedef
287 \ingroup protocolbundle_default
289 typedef ConcretePacket<IPv6HopByHopOptionsPacketType> IPv6HopByHopOptionsPacket;
291 // =====================================================================================================
293 /** \brief Parse in IPv6 Destination Options extension header
295 Parser implementing the IPv6 Destination Options Header extension.
296 The fields implemented are:
297 \image html IPv6DestinationOptionsPacket.png
299 \see IPv6ExtensionType_Destination \n
300 <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
302 struct IPv6DestinationOptionsPacketParser : public PacketParserBase
304 # include SENF_PARSER()
305 SENF_PARSER_FIELD ( nextHeader, UInt8Parser );
306 SENF_PARSER_FIELD_RO ( headerLength, UInt8Parser );
307 typedef detail::FixedAuxParserPolicy<UInt8Parser, 1u> ListOptionTypeAuxPolicy;
308 typedef detail::ListOptionTypeParser_Policy<
309 IPv6GenericOptionParser, ListOptionTypeAuxPolicy> ListOptionTypePolicy;
310 typedef ListParser<ListOptionTypePolicy> ListOptionTypeParser;
312 SENF_PARSER_FIELD ( options, ListOptionTypeParser);
314 SENF_PARSER_FINALIZE ( IPv6DestinationOptionsPacketParser );
317 /** \brief IPv6 Destination Options extension
319 \par Packet type (typedef):
320 \ref IPv6DestinationOptionsPacket
323 \ref IPv6DestinationOptionsPacketParser
325 \par Associated registries:
328 \par Finalize action:
329 Set \a nextHeader from type of next packet if found in \ref IpTypes
331 \ingroup protocolbundle_default
333 struct IPv6DestinationOptionsPacketType
334 : public PacketTypeBase,
335 public PacketTypeMixin<IPv6DestinationOptionsPacketType, IpTypes>
338 typedef PacketTypeMixin<IPv6DestinationOptionsPacketType, IpTypes> mixin;
340 /** \brief IPv6 Destination Options extension packet typedef */
341 typedef ConcretePacket<IPv6DestinationOptionsPacketType> packet;
342 /** \brief typedef to the parser of IPv6 Destination Options extension packet */
343 typedef IPv6DestinationOptionsPacketParser parser;
345 using mixin::nextPacketRange;
346 using mixin::nextPacketType;
348 using mixin::initSize;
350 static key_t nextPacketKey(packet p)
351 { return p->nextHeader(); }
352 /** \brief Dump given IPv6DestinationOptionsPacket in readable form to given output stream */
353 static void dump(packet p, std::ostream & os);
355 static void finalize(packet p);
358 /** \brief IPv6 routing Destination Options packet typedef
359 \ingroup protocolbundle_default
361 typedef ConcretePacket<IPv6DestinationOptionsPacketType> IPv6DestinationOptionsPacket;
365 ///////////////////////////////hh.e////////////////////////////////////////
366 //#include "IPv6Extensions.cci"
367 //#include "IPv6Extensions.ct"
368 //#include "IPv6Extensions.cti"
375 // c-file-style: "senf"
376 // indent-tabs-mode: nil
377 // ispell-local-dictionary: "american"
378 // compile-command: "scons -u test"
379 // comment-column: 40