4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at
9 // http://senf.berlios.de/license.html
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on,
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
15 // Software distributed under the License is distributed on an "AS IS" basis,
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17 // for the specific language governing rights and limitations under the License.
19 // The Original Code is Fraunhofer FOKUS code.
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
26 // Stefan Bund <g0dil@berlios.de>
27 // Philipp Batroff <pug@berlios.de>
29 \brief IPv6Extensions public header */
31 #ifndef HH_SENF_Packets_DefaultBundle_IPv6Extensions_
32 #define HH_SENF_Packets_DefaultBundle_IPv6Extensions_ 1
35 #include "IPv6ExtOptions.hh"
36 #include "ListOptionTypeParser.hh"
37 #include "IPv6Packet.hh"
39 //#include "IPv6Extensions.mpp"
40 //-/////////////////////////////////////////////////////////////////////////////////////////////////
44 /** \brief Parse in IPv6 fragment extension header
46 Parser implementing the IPv6 fragment extension. The fields implemented are:
47 \image html IPv6FragmentPacket.png
49 \see IPv6ExtensionType_Fragment \n
50 <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
52 struct IPv6FragmentPacketParser : public PacketParserBase
54 # include SENF_FIXED_PARSER()
56 SENF_PARSER_FIELD ( nextHeader , UInt8Parser );
57 SENF_PARSER_PRIVATE_FIELD ( reserved1 , UInt8Parser );
58 SENF_PARSER_BITFIELD ( fragmentOffset , 13, unsigned );
59 SENF_PARSER_PRIVATE_BITFIELD ( reserved2 , 2, unsigned );
60 SENF_PARSER_BITFIELD ( moreFragments , 1, bool );
61 SENF_PARSER_FIELD ( id , UInt32Parser );
63 SENF_PARSER_FINALIZE(IPv6FragmentPacketParser);
66 /** \brief IPv6 fragment extension
68 \par Packet type (typedef):
69 \ref IPv6FragmentPacket
72 \ref IPv6FragmentPacketParser
74 \par Associated registries:
78 Set \a nextHeader from type of next packet if found in \ref IpTypes
80 \ingroup protocolbundle_default
82 struct IPv6FragmentPacketType
83 : public PacketTypeBase,
84 public PacketTypeMixin<IPv6FragmentPacketType, IpTypes>
87 typedef PacketTypeMixin<IPv6FragmentPacketType, IpTypes> mixin;
89 /** \brief IPv6 fragment extension packet typedef */
90 typedef ConcretePacket<IPv6FragmentPacketType> packet;
91 /** \brief typedef to the parser of IPv6 fragment extension packet */
92 typedef IPv6FragmentPacketParser parser;
94 using mixin::nextPacketRange;
95 using mixin::nextPacketType;
96 using mixin::initSize;
99 static key_t nextPacketKey(packet p)
100 { return p->nextHeader(); }
102 /** \brief Dump given IPv6FragmentPacket in readable form to given output stream */
103 static void dump(packet p, std::ostream & os);
105 static void finalize(packet p);
108 /** \brief IPv6 fragment extension packet typedef
109 \ingroup protocolbundle_default
111 typedef ConcretePacket<IPv6FragmentPacketType> IPv6FragmentPacket;
113 // =====================================================================================================
115 /** \brief Parse in IPv6 routing extension header
117 Parser implementing the IPv6 routing Header extension (type 0 only).
118 The fields implemented are:
119 \image html IPv6RoutingPacket.png
121 \see IPv6ExtensionType_Routing \n
122 <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
124 struct IPv6RoutingPacketParser : public PacketParserBase
127 The Type 0 Routing header has the following format: (RFC 2460)
129 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
130 | Next Header | Hdr Ext Len | Routing Type=0| Segments Left |
131 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
133 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
141 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
145 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
153 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
155 # include SENF_PARSER()
157 SENF_PARSER_FIELD ( nextHeader, UInt8Parser );
158 SENF_PARSER_FIELD ( headerLength, UInt8Parser );
159 SENF_PARSER_FIELD ( routingType, UInt8Parser ); //set to Zero for minimal implementation
160 SENF_PARSER_FIELD_RO ( segmentsLeft, UInt8Parser );
161 SENF_PARSER_FIELD ( reserved, UInt32Parser ); //set to zero by RFC
162 SENF_PARSER_VECTOR ( hopAddresses, segmentsLeft, INet6AddressParser );
164 SENF_PARSER_FINALIZE ( IPv6RoutingPacketParser );
166 //provisionary, since only type 0 is implemented
173 /** \brief IPv6 routing extension
175 \par Packet type (typedef):
176 \ref IPv6RoutingPacket
179 \ref IPv6RoutingPacketParser
181 \par Associated registries:
184 \par Finalize action:
185 Set \a nextHeader from type of next packet if found in \ref IpTypes
187 \ingroup protocolbundle_default
189 struct IPv6RoutingPacketType
190 : public PacketTypeBase,
191 public PacketTypeMixin<IPv6RoutingPacketType, IpTypes>
194 typedef PacketTypeMixin<IPv6RoutingPacketType, IpTypes> mixin;
196 /** \brief IPv6 routing extension packet typedef */
197 typedef ConcretePacket<IPv6RoutingPacketType> packet;
198 /** \brief typedef to the parser of IPv6 routing extension packet */
199 typedef IPv6RoutingPacketParser parser;
201 using mixin::nextPacketRange;
202 using mixin::nextPacketType;
204 using mixin::initSize;
206 static key_t nextPacketKey(packet p)
207 { return p->nextHeader(); }
209 /** \brief Dump given IPv6RoutingPacket in readable form to given output stream */
210 static void dump(packet p, std::ostream & os);
212 static void finalize(packet p);
215 /** \brief IPv6 routing extension packet typedef
216 \ingroup protocolbundle_default
218 typedef ConcretePacket<IPv6RoutingPacketType> IPv6RoutingPacket;
221 // =====================================================================================================
223 /** \brief Parse in IPv6 Hop-By-Hop extension header
225 Parser implementing the IPv6 routing Header extension. The fields implemented are:
226 \image html IPv6HopByHopOptionsPacket.png
228 \see IPv6ExtensionType_HopByHop \n
229 <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
231 struct IPv6HopByHopOptionsPacketParser : public PacketParserBase
233 # include SENF_PARSER()
235 SENF_PARSER_FIELD ( nextHeader, UInt8Parser );
236 SENF_PARSER_FIELD_RO ( headerLength, UInt8Parser );
238 typedef detail::FixedAuxParserPolicy<UInt8Parser, 1u> ListOptionTypeAuxPolicy;
239 typedef detail::ListOptionTypeParser_Policy<
240 IPv6GenericOptionParser, ListOptionTypeAuxPolicy> ListOptionTypePolicy;
241 typedef ListParser<ListOptionTypePolicy> ListOptionTypeParser;
243 SENF_PARSER_FIELD ( options, ListOptionTypeParser);
245 SENF_PARSER_FINALIZE ( IPv6HopByHopOptionsPacketParser );
248 /** \brief IPv6 Hop-By-Hop extension
250 \par Packet type (typedef):
251 \ref IPv6HopByHopOptionsPacket
254 \ref IPv6HopByHopOptionsPacketParser
256 \par Associated registries:
259 \par Finalize action:
260 Set \a nextHeader from type of next packet if found in \ref IpTypes
262 \ingroup protocolbundle_default
264 struct IPv6HopByHopOptionsPacketType
265 : public PacketTypeBase,
266 public PacketTypeMixin<IPv6HopByHopOptionsPacketType, IpTypes>
269 typedef PacketTypeMixin<IPv6HopByHopOptionsPacketType, IpTypes> mixin;
271 /** \brief IPv6 Hop-By-Hop extension packet typedef */
272 typedef ConcretePacket<IPv6HopByHopOptionsPacketType> packet;
273 /** \brief typedef to the parser of IPv6 Hop-By-Hop extension packet */
274 typedef IPv6HopByHopOptionsPacketParser parser;
276 using mixin::nextPacketRange;
277 using mixin::nextPacketType;
279 using mixin::initSize;
281 static key_t nextPacketKey(packet p) {
282 return p->nextHeader(); }
284 /** \brief Dump given IPv6HopByHopOptionsPacket in readable form to given output stream */
285 static void dump(packet p, std::ostream & os);
287 static void finalize(packet p);
290 /** \brief IPv6 routing Hop-By-Hop packet typedef
291 \ingroup protocolbundle_default
293 typedef ConcretePacket<IPv6HopByHopOptionsPacketType> IPv6HopByHopOptionsPacket;
295 // =====================================================================================================
297 /** \brief Parse in IPv6 Destination Options extension header
299 Parser implementing the IPv6 Destination Options Header extension.
300 The fields implemented are:
301 \image html IPv6DestinationOptionsPacket.png
303 \see IPv6ExtensionType_Destination \n
304 <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
306 struct IPv6DestinationOptionsPacketParser : public PacketParserBase
308 # include SENF_PARSER()
309 SENF_PARSER_FIELD ( nextHeader, UInt8Parser );
310 SENF_PARSER_FIELD_RO ( headerLength, UInt8Parser );
311 typedef detail::FixedAuxParserPolicy<UInt8Parser, 1u> ListOptionTypeAuxPolicy;
312 typedef detail::ListOptionTypeParser_Policy<
313 IPv6GenericOptionParser, ListOptionTypeAuxPolicy> ListOptionTypePolicy;
314 typedef ListParser<ListOptionTypePolicy> ListOptionTypeParser;
316 SENF_PARSER_FIELD ( options, ListOptionTypeParser);
318 SENF_PARSER_FINALIZE ( IPv6DestinationOptionsPacketParser );
321 /** \brief IPv6 Destination Options extension
323 \par Packet type (typedef):
324 \ref IPv6DestinationOptionsPacket
327 \ref IPv6DestinationOptionsPacketParser
329 \par Associated registries:
332 \par Finalize action:
333 Set \a nextHeader from type of next packet if found in \ref IpTypes
335 \ingroup protocolbundle_default
337 struct IPv6DestinationOptionsPacketType
338 : public PacketTypeBase,
339 public PacketTypeMixin<IPv6DestinationOptionsPacketType, IpTypes>
342 typedef PacketTypeMixin<IPv6DestinationOptionsPacketType, IpTypes> mixin;
344 /** \brief IPv6 Destination Options extension packet typedef */
345 typedef ConcretePacket<IPv6DestinationOptionsPacketType> packet;
346 /** \brief typedef to the parser of IPv6 Destination Options extension packet */
347 typedef IPv6DestinationOptionsPacketParser parser;
349 using mixin::nextPacketRange;
350 using mixin::nextPacketType;
352 using mixin::initSize;
354 static key_t nextPacketKey(packet p)
355 { return p->nextHeader(); }
356 /** \brief Dump given IPv6DestinationOptionsPacket in readable form to given output stream */
357 static void dump(packet p, std::ostream & os);
359 static void finalize(packet p);
362 /** \brief IPv6 routing Destination Options packet typedef
363 \ingroup protocolbundle_default
365 typedef ConcretePacket<IPv6DestinationOptionsPacketType> IPv6DestinationOptionsPacket;
369 //-/////////////////////////////////////////////////////////////////////////////////////////////////
370 //#include "IPv6Extensions.cci"
371 //#include "IPv6Extensions.ct"
372 //#include "IPv6Extensions.cti"
379 // c-file-style: "senf"
380 // indent-tabs-mode: nil
381 // ispell-local-dictionary: "american"
382 // compile-command: "scons -u test"
383 // comment-column: 40