Documentation updates
[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 #       include SENF_FIXED_PARSER()
45
46         SENF_PARSER_FIELD( nextHeader     , Parse_UInt8 );
47         SENF_PARSER_FIELD( reserved1      , Parse_UInt8 );
48
49         SENF_PARSER_BITFIELD( fragmentOffset, 13, unsigned );
50         SENF_PARSER_BITFIELD( reserved2,       2, unsigned );
51         SENF_PARSER_BITFIELD( moreFragments,   1, bool     );
52
53         SENF_PARSER_FIELD( id             , Parse_UInt32   );
54
55         SENF_PARSER_FINALIZE(Parse_IPv6Extension_Fragment);
56     };
57
58     /** \brief IPv6 fragment extension
59
60         \par Packet type (typedef):
61             \ref IPv6Extension_Fragment
62
63         \par Fields:
64             \ref Parse_IPv6Extension_Fragment
65         
66         \par Associated registries:
67             \par IpTypes
68         
69         \par Finalize action:
70             Set \a nextHeader from type of next packet if found in \ref IpTypes
71
72         \ingroup protocolbundle_default
73      */
74     struct IPv6ExtensionType_Fragment
75         : public PacketTypeBase,
76           public PacketTypeMixin<IPv6ExtensionType_Fragment, IpTypes>
77     {
78 #ifndef DOXYGEN
79         typedef PacketTypeMixin<IPv6ExtensionType_Fragment, IpTypes> mixin;
80         typedef ConcretePacket<IPv6ExtensionType_Fragment> packet;
81         typedef Parse_IPv6Extension_Fragment parser;
82 #endif
83         using mixin::nextPacketRange;
84         using mixin::nextPacketType;
85         using mixin::initSize;
86         using mixin::init;
87
88         static registry_key_t nextPacketKey(packet p) 
89             { return p->nextHeader(); }
90         
91         static void dump(packet p, std::ostream & os);
92
93         static void finalize(packet p)
94             { p->nextHeader() << key(p.next()); }
95     };
96
97     /** \brief IPv6 fragment extension packet typedef */
98     typedef ConcretePacket<IPv6ExtensionType_Fragment> IPv6Extension_Fragment;
99 }
100
101 ///////////////////////////////hh.e////////////////////////////////////////
102 #endif
103 #ifndef SENF_PACKETS_DECL_ONLY
104 //#include "IPv6Extensions.cci"
105 //#include "IPv6Extensions.ct"
106 //#include "IPv6Extensions.cti"
107 #endif
108
109 \f
110 // Local Variables:
111 // mode: c++
112 // fill-column: 100
113 // c-file-style: "senf"
114 // indent-tabs-mode: nil
115 // ispell-local-dictionary: "american"
116 // compile-command: "scons -u test"
117 // comment-column: 40
118 // End: