Merged revisions 262,264-265,267-282,284-298,300-311 via svnmerge from
[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     // See RFC2460
36     struct Parse_IpV6Extension_Fragment : public PacketParserBase
37     {
38         SENF_PACKET_PARSER_INIT(Parse_IpV6Extension_Fragment);
39
40         ///////////////////////////////////////////////////////////////////////////
41
42         typedef Parse_UInt8                Parse_8bit;
43         typedef Parse_UIntField <  0, 13 > Parse_Offset;
44         typedef Parse_UIntField < 13, 15 > Parse_Reserved;
45         typedef Parse_Flag      < 15     > Parse_More;
46         typedef Parse_UInt32               Parse_32bit;
47
48         SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS(
49             ((Field       )( nextHeader     , Parse_8bit     ))
50             ((Field       )( reserved1      , Parse_8bit     ))
51             ((OverlayField)( fragmentOffset , Parse_Offset   ))
52             ((OverlayField)( reserved2      , Parse_Reserved ))
53             ((Field       )( moreFragments  , Parse_More     ))
54             ((Field       )( id             , Parse_32bit    )) );
55     };
56
57     struct IpV6ExtensionType_Fragment
58         : public PacketTypeBase,
59           public PacketTypeMixin<IpV6ExtensionType_Fragment, IpTypes>
60     {
61         typedef PacketTypeMixin<IpV6ExtensionType_Fragment, IpTypes> mixin;
62         typedef ConcretePacket<IpV6ExtensionType_Fragment> packet;
63         typedef Parse_IpV6Extension_Fragment parser;
64
65         using mixin::nextPacketRange;
66         using mixin::nextPacketType;
67         using mixin::initSize;
68         using mixin::init;
69
70         static registry_key_t nextPacketKey(packet p) 
71             { return p->nextHeader(); }
72         
73         static void dump(packet p, std::ostream & os);
74     };
75
76     typedef IpV6ExtensionType_Fragment::packet IpV6Extension_Fragment;
77 }
78
79 ///////////////////////////////hh.e////////////////////////////////////////
80 //#include "IpV6Extensions.cci"
81 //#include "IpV6Extensions.ct"
82 //#include "IpV6Extensions.cti"
83 #endif
84
85 \f
86 // Local Variables:
87 // mode: c++
88 // fill-column: 100
89 // c-file-style: "senf"
90 // indent-tabs-mode: nil
91 // ispell-local-dictionary: "american"
92 // compile-command: "scons -u test"
93 // comment-column: 40
94 // End: