IPv6Extensions.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Packets_DefaultBundle_IPv6Extensions_
18 #define HH_SENF_Packets_DefaultBundle_IPv6Extensions_ 1
19 
20 // Custom includes
21 #include "IPv6ExtOptions.hh"
22 #include "ListOptionTypeParser.hh"
23 #include "IPv6Packet.hh"
24 
25 //#include "IPv6Extensions.mpp"
26 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 
28 namespace senf {
29 
39  {
40 # include SENF_FIXED_PARSER()
41 
44 
45  SENF_PARSER_BITFIELD ( fragmentOffset, 13, unsigned );
48 
50 
52  };
53 
71  : public PacketTypeBase,
72  public PacketTypeMixin<IPv6FragmentPacketType, IPTypes>
73  {
79 
80  using mixin::nextPacketRange;
81  using mixin::nextPacketType;
82  using mixin::initSize;
83  using mixin::init;
84 
85  static key_t nextPacketKey(packet p)
86  { return p->nextHeader(); }
87 
89  static void dump(packet p, std::ostream & os);
90  static void finalize(packet p);
91 
92  static const IPTypes::key_t ipType = 44;
93  };
94 
99  SENF_PACKET_PREVENT_TEMPLATE_INSTANTIATION( IPv6FragmentPacket );
100 
101 // =====================================================================================================
102 
113  {
114  /*
115  The Type 0 Routing header has the following format: (RFC 2460)
116 
117  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
118  | Next Header | Hdr Ext Len | Routing Type=0| Segments Left |
119  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
120  | Reserved |
121  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
122  | |
123  +
124  | |
125  + Address[1]
126  | |
127  +
128  | |
129  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
130  . . .
131  . . .
132  . . .
133  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
134  | |
135  +
136  | |
137  + Address[n]
138  | |
139  +
140  | |
141  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
142  */
143 # include SENF_PARSER()
144 
146  SENF_PARSER_FIELD ( headerLength, UInt8Parser );
147  SENF_PARSER_FIELD ( routingType, UInt8Parser ); //set to Zero for minimal implementation
149  SENF_PARSER_FIELD ( reserved, UInt32Parser ); //set to zero by RFC
150  SENF_PARSER_VECTOR ( hopAddresses, segmentsLeft, INet6AddressParser );
151 
153 
154  //provisionary, since only type 0 is implemented
156  routingType() = 0u;
157  reserved() = 0u;
158  }
159  };
160 
178  : public PacketTypeBase,
179  public PacketTypeMixin<IPv6RoutingPacketType, IPTypes>
180  {
186 
187  using mixin::nextPacketRange;
188  using mixin::nextPacketType;
189  using mixin::init;
190  using mixin::initSize;
191 
192  static key_t nextPacketKey(packet p)
193  { return p->nextHeader(); }
194 
196  static void dump(packet p, std::ostream & os);
197  static void finalize(packet p);
198 
199  static const IPTypes::key_t ipType = 43;
200  };
201 
206  SENF_PACKET_PREVENT_TEMPLATE_INSTANTIATION( IPv6RoutingPacket );
207 
208 
209 // =====================================================================================================
210 
220  {
222  typedef detail::ListOptionTypeParser_Policy<
225 
226 # include SENF_PARSER()
227 
230  SENF_PARSER_FIELD ( options, ListOptionTypeParser );
231 
233  };
234 
252  : public PacketTypeBase,
253  public PacketTypeMixin<IPv6HopByHopOptionsPacketType, IPTypes>
254  {
260 
261  using mixin::nextPacketRange;
262  using mixin::nextPacketType;
263  using mixin::init;
264  using mixin::initSize;
265 
266  static key_t nextPacketKey(packet p) {
267  return p->nextHeader(); }
268 
270  static void dump(packet p, std::ostream & os);
271  static void finalize(packet p);
272 
273  static const IPTypes::key_t ipType = 0;
274  };
275 
280  SENF_PACKET_PREVENT_TEMPLATE_INSTANTIATION( IPv6HopByHopOptionsPacket );
281 
282 // =====================================================================================================
283 
294  {
296  typedef detail::ListOptionTypeParser_Policy<
299 
300 # include SENF_PARSER()
301 
304  SENF_PARSER_FIELD ( options, ListOptionTypeParser );
305 
307  };
308 
326  : public PacketTypeBase,
327  public PacketTypeMixin<IPv6DestinationOptionsPacketType, IPTypes>
328  {
334 
335  using mixin::nextPacketRange;
336  using mixin::nextPacketType;
337  using mixin::init;
338  using mixin::initSize;
339 
340  static key_t nextPacketKey(packet p)
341  { return p->nextHeader(); }
343  static void dump(packet p, std::ostream & os);
344  static void finalize(packet p);
345 
346  static const IPTypes::key_t ipType = 60u;
347  };
348 
353  SENF_PACKET_PREVENT_TEMPLATE_INSTANTIATION( IPv6DestinationOptionsPacket );
354 
355 }
356 
357 //-/////////////////////////////////////////////////////////////////////////////////////////////////
358 //#include "IPv6Extensions.cci"
359 //#include "IPv6Extensions.ct"
360 //#include "IPv6Extensions.cti"
361 #endif
362 
363 
364 // Local Variables:
365 // mode: c++
366 // fill-column: 100
367 // c-file-style: "senf"
368 // indent-tabs-mode: nil
369 // ispell-local-dictionary: "american"
370 // compile-command: "scons -u test"
371 // comment-column: 40
372 // End:
IPv6Packet public header.
detail::ListOptionTypeParser_Policy< IPv6GenericOptionParser, ListOptionTypeAuxPolicy > ListOptionTypePolicy
static key_t nextPacketKey(packet p)
IPv6DestinationOptionsPacketParser parser
typedef to the parser of IPv6 Destination Options extension packet
#define SENF_PARSER_BITFIELD(name, bits, type)
Define bit-field.
PacketTypeMixin< IPv6FragmentPacketType, IPTypes > mixin
GenericTLVParserBase< IPv6OptionParser > IPv6GenericOptionParser
Mixin to provide standard implementations for nextPacketRange and nextPacketType. ...
Definition: PacketType.hh:300
senf::UIntFieldParser<?,?+2 > reserved2() const
Parse 8bit unsigned byte aligned integer.
Definition: IntParser.hh:91
ConcretePacket< IPv6FragmentPacketType > packet
IPv6 fragment extension packet typedef.
IPv6 Hop-By-Hop extension.
Parse in IPv6 fragment extension header.
Parse in IPv6 Hop-By-Hop extension header.
PacketTypeMixin< IPv6DestinationOptionsPacketType, IPTypes > mixin
boost::uint8_t key_t
Definition: Registries.hh:61
#define SENF_PARSER_FIELD(name, type)
Define normal parser field.
#define SENF_PARSER_PRIVATE_FIELD(name, type)
Define parser field (private)
ConcretePacket< IPv6DestinationOptionsPacketType > packet
IPv6 Destination Options extension packet typedef.
ConcretePacket< IPv6HopByHopOptionsPacketType > IPv6HopByHopOptionsPacket
IPv6 routing Hop-By-Hop packet typedef.
#define SENF_PARSER_FINALIZE(name)
Generate parser control members.
Parse in IPv6 routing extension header.
ListOptionTypeParser public header.
IPv6HopByHopOptionsPacketParser parser
typedef to the parser of IPv6 Hop-By-Hop extension packet
void dump(std::ostream &os, DirectoryNode &dir=root())
IPv6FragmentPacketParser parser
typedef to the parser of IPv6 fragment extension packet
Protocol specific packet handle.
Definition: Packet.hh:87
Helper base-class implementing the PacketType interface.
Definition: PacketType.hh:100
#define SENF_PARSER_VECTOR(name, size, elt_type)
Define VectorParser field.
#define SENF_PARSER_INIT()
Define parser initialization routine.
UInt8Parser reserved1() const
#define SENF_PARSER_FIELD_RO(name, type)
Define parser field (read-only)
IPv6 fragment extension.
ListParser< ListOptionTypePolicy > ListOptionTypeParser
SENF_PACKET_PREVENT_TEMPLATE_INSTANTIATION(RadiotapPacket)
ConcretePacket< IPv6RoutingPacketType > packet
IPv6 routing extension packet typedef.
ConcretePacket< IPv6DestinationOptionsPacketType > IPv6DestinationOptionsPacket
IPv6 routing Destination Options packet typedef.
__u8 reserved[3]
PacketTypeMixin< IPv6RoutingPacketType, IPTypes > mixin
UInt8Parser nextHeader() const
ConcretePacket< IPv6RoutingPacketType > IPv6RoutingPacket
IPv6 routing extension packet typedef.
senf::FlagParser<?> moreFragments() const
ConcretePacket< IPv6FragmentPacketType > IPv6FragmentPacket
IPv6 fragment extension packet typedef.
Internal: Fixed distance aux-parser policy.
Definition: AuxParser.hh:56
detail::ListOptionTypeParser_Policy< IPv6GenericOptionParser, ListOptionTypeAuxPolicy > ListOptionTypePolicy
Parse in IPv6 Destination Options extension header.
Parser Base class.
Parse 32bit unsigned byte aligned integer.
Definition: IntParser.hh:310
Parse an IPv6 address.
Definition: IPv6Packet.hh:33
detail::FixedAuxParserPolicy< UInt8Parser, 1u > ListOptionTypeAuxPolicy
Arbitrary sequential element collection.
Definition: ListParser.hh:65
#define SENF_PARSER_PRIVATE_BITFIELD(name, bits, type)
Define bit-field (private)
detail::FixedAuxParserPolicy< UInt8Parser, 1u > ListOptionTypeAuxPolicy
ListParser< ListOptionTypePolicy > ListOptionTypeParser
senf::UIntFieldParser<?,?+13 > fragmentOffset() const
IPv6RoutingPacketParser parser
typedef to the parser of IPv6 routing extension packet
IPv6Extension-Options public header.
static key_t nextPacketKey(packet p)
IPv6 routing extension.
static key_t nextPacketKey(packet p)
IPv6 Destination Options extension.
ConcretePacket< IPv6HopByHopOptionsPacketType > packet
IPv6 Hop-By-Hop extension packet typedef.
PacketTypeMixin< IPv6HopByHopOptionsPacketType, IPTypes > mixin