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