Packets: BUGFIX: ensure complete interpreter chain in finalize()
[senf.git] / Packets / DefaultBundle / IpV6Extensions.hh
1 // Copyright (C) 2007
2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
4 //     Stefan Bund <g0dil@berlios.de>
5 //
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.
10 //
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.
15 //
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.
20
21 /** \file
22     \brief IpV6Extensions public header */
23
24 #ifndef HH_IpV6Extensions_
25 #define HH_IpV6Extensions_ 1
26
27 // Custom includes
28 #include "IpV6Packet.hh"
29
30 //#include "IpV6Extensions.mpp"
31 ///////////////////////////////hh.p////////////////////////////////////////
32
33 namespace senf {
34
35     ///\addtogroup protocolbundle_default
36     ///@{
37
38     // See RFC2460
39     struct Parse_IpV6Extension_Fragment : public PacketParserBase
40     {
41         SENF_PACKET_PARSER_INIT(Parse_IpV6Extension_Fragment);
42
43         ///////////////////////////////////////////////////////////////////////////
44
45         typedef Parse_UInt8                Parse_8bit;
46         typedef Parse_UIntField <  0, 13 > Parse_Offset;
47         typedef Parse_UIntField < 13, 15 > Parse_Reserved;
48         typedef Parse_Flag      < 15     > Parse_More;
49         typedef Parse_UInt32               Parse_32bit;
50
51         SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS(
52             ((Field       )( nextHeader     , Parse_8bit     ))
53             ((Field       )( reserved1      , Parse_8bit     ))
54             ((OverlayField)( fragmentOffset , Parse_Offset   ))
55             ((OverlayField)( reserved2      , Parse_Reserved ))
56             ((Field       )( moreFragments  , Parse_More     ))
57             ((Field       )( id             , Parse_32bit    )) );
58     };
59
60     struct IpV6ExtensionType_Fragment
61         : public PacketTypeBase,
62           public PacketTypeMixin<IpV6ExtensionType_Fragment, IpTypes>
63     {
64         typedef PacketTypeMixin<IpV6ExtensionType_Fragment, IpTypes> mixin;
65         typedef ConcretePacket<IpV6ExtensionType_Fragment> packet;
66         typedef Parse_IpV6Extension_Fragment parser;
67
68         using mixin::nextPacketRange;
69         using mixin::nextPacketType;
70         using mixin::initSize;
71         using mixin::init;
72
73         static registry_key_t nextPacketKey(packet p) 
74             { return p->nextHeader(); }
75         
76         static void dump(packet p, std::ostream & os);
77     };
78
79     typedef IpV6ExtensionType_Fragment::packet IpV6Extension_Fragment;
80
81     ///@}
82 }
83
84 ///////////////////////////////hh.e////////////////////////////////////////
85 //#include "IpV6Extensions.cci"
86 //#include "IpV6Extensions.ct"
87 //#include "IpV6Extensions.cti"
88 #endif
89
90 \f
91 // Local Variables:
92 // mode: c++
93 // fill-column: 100
94 // c-file-style: "senf"
95 // indent-tabs-mode: nil
96 // ispell-local-dictionary: "american"
97 // compile-command: "scons -u test"
98 // comment-column: 40
99 // End: