PPI: Checkin of first compiling (yet not working) version
[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     /** \brief Parse in IpV6 fragment extension header
36         
37         Parser implementing the IpV6 fragment extension. The fields implemented are:
38
39         \see IpV6ExtensionType_Fragment \n
40             <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
41      */
42     struct Parse_IpV6Extension_Fragment : public PacketParserBase
43     {
44         typedef Parse_UInt8                Parse_8bit;
45         typedef Parse_UIntField <  0, 13 > Parse_Offset;
46         typedef Parse_UIntField < 13, 15 > Parse_Reserved;
47         typedef Parse_Flag      < 15     > Parse_More;
48         typedef Parse_UInt32               Parse_32bit;
49
50 #       ifndef DOXYGEN
51
52         SENF_PACKET_PARSER_INIT(Parse_IpV6Extension_Fragment);
53
54         SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS(
55             ((Field       )( nextHeader     , Parse_8bit     ))
56             ((Field       )( reserved1      , Parse_8bit     ))
57             ((OverlayField)( fragmentOffset , Parse_Offset   ))
58             ((OverlayField)( reserved2      , Parse_Reserved ))
59             ((Field       )( moreFragments  , Parse_More     ))
60             ((Field       )( id             , Parse_32bit    )) );
61
62 #       else
63
64         Parse_8bit nextHeader();
65         Parse_8bit reserved1();
66         Parse_Offset fragmentOffset();
67         Parse_Reserved reserved2();
68         Parse_More moreFragments();
69         Parse_32bit id();
70
71 #       endif
72     };
73
74     /** \brief IpV6 fragment extension
75
76         \par Packet type (typedef):
77             \ref IpV6Extension_Fragment
78
79         \par Fields:
80             \ref Parse_IpV6Extension_Fragment
81         
82         \par Associated registries:
83             \par IpTypes
84         
85         \ingroup protocolbundle_default
86      */
87     struct IpV6ExtensionType_Fragment
88         : public PacketTypeBase,
89           public PacketTypeMixin<IpV6ExtensionType_Fragment, IpTypes>
90     {
91         typedef PacketTypeMixin<IpV6ExtensionType_Fragment, IpTypes> mixin;
92         typedef ConcretePacket<IpV6ExtensionType_Fragment> packet;
93         typedef Parse_IpV6Extension_Fragment parser;
94
95         using mixin::nextPacketRange;
96         using mixin::nextPacketType;
97         using mixin::initSize;
98         using mixin::init;
99
100         static registry_key_t nextPacketKey(packet p) 
101             { return p->nextHeader(); }
102         
103         static void dump(packet p, std::ostream & os);
104     };
105
106     /** \brief IpV6 fragment extension packet typedef */
107     typedef IpV6ExtensionType_Fragment::packet IpV6Extension_Fragment;
108 }
109
110 ///////////////////////////////hh.e////////////////////////////////////////
111 #endif
112 #ifndef SENF_PACKETS_DECL_ONLY
113 //#include "IpV6Extensions.cci"
114 //#include "IpV6Extensions.ct"
115 //#include "IpV6Extensions.cti"
116 #endif
117
118 \f
119 // Local Variables:
120 // mode: c++
121 // fill-column: 100
122 // c-file-style: "senf"
123 // indent-tabs-mode: nil
124 // ispell-local-dictionary: "american"
125 // compile-command: "scons -u test"
126 // comment-column: 40
127 // End: