Packets documentation updates
[senf.git] / Packets / DefaultBundle / IPv6Extensions.hh
1 // $Id$
2 //
3 // Copyright (C) 2007
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief IPv6Extensions public header */
25
26 #ifndef HH_SENF_Packets_DefaultBundle_IPv6Extensions_
27 #define HH_SENF_Packets_DefaultBundle_IPv6Extensions_ 1
28
29 // Custom includes
30 #include "IPv6Packet.hh"
31
32 //#include "IPv6Extensions.mpp"
33 ///////////////////////////////hh.p////////////////////////////////////////
34
35 namespace senf {
36
37     /** \brief Parse in IPv6 fragment extension header
38         
39         Parser implementing the IPv6 fragment extension. The fields implemented are:
40         \image html IPv6Extensions_Fragment.png
41
42         \see IPv6ExtensionType_Fragment \n
43             <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
44      */
45     struct IPv6PacketParserExtension_Fragment : public PacketParserBase
46     {
47 #       include SENF_FIXED_PARSER()
48
49         SENF_PARSER_FIELD( nextHeader     , UInt8Parser );
50         SENF_PARSER_FIELD( reserved1      , UInt8Parser );
51
52         SENF_PARSER_BITFIELD( fragmentOffset, 13, unsigned );
53         SENF_PARSER_BITFIELD( reserved2,       2, unsigned );
54         SENF_PARSER_BITFIELD( moreFragments,   1, bool     );
55
56         SENF_PARSER_FIELD( id             , UInt32Parser   );
57
58         SENF_PARSER_FINALIZE(IPv6PacketParserExtension_Fragment);
59     };
60
61     /** \brief IPv6 fragment extension
62
63         \par Packet type (typedef):
64             \ref IPv6Extension_Fragment
65
66         \par Fields:
67             \ref IPv6PacketParserExtension_Fragment
68         
69         \par Associated registries:
70             \ref IpTypes
71         
72         \par Finalize action:
73             Set \a nextHeader from type of next packet if found in \ref IpTypes
74
75         \ingroup protocolbundle_default
76      */
77     struct IPv6ExtensionType_Fragment
78         : public PacketTypeBase,
79           public PacketTypeMixin<IPv6ExtensionType_Fragment, IpTypes>
80     {
81 #ifndef DOXYGEN
82         typedef PacketTypeMixin<IPv6ExtensionType_Fragment, IpTypes> mixin;
83 #endif
84         /** \brief IPv6 fragment extension packet typedef */
85         typedef ConcretePacket<IPv6ExtensionType_Fragment> packet; 
86         /** \brief typedef to the parser of IPv6 fragment extension packet */
87         typedef IPv6PacketParserExtension_Fragment parser;
88
89         using mixin::nextPacketRange;
90         using mixin::nextPacketType;
91         using mixin::initSize;
92         using mixin::init;
93
94         static key_t nextPacketKey(packet p) 
95             { return p->nextHeader(); }
96         
97         /** \brief Dump given IPv6Extension_Fragment in readable form to given output stream */
98         static void dump(packet p, std::ostream & os); 
99
100         static void finalize(packet p) { 
101             p->nextHeader() << key(p.next(nothrow)); }
102     };
103
104     /** \brief IPv6 fragment extension packet typedef */
105     typedef ConcretePacket<IPv6ExtensionType_Fragment> IPv6Extension_Fragment;
106 }
107
108 ///////////////////////////////hh.e////////////////////////////////////////
109 #endif
110 #ifndef SENF_PACKETS_DECL_ONLY
111 //#include "IPv6Extensions.cci"
112 //#include "IPv6Extensions.ct"
113 //#include "IPv6Extensions.cti"
114 #endif
115
116 \f
117 // Local Variables:
118 // mode: c++
119 // fill-column: 100
120 // c-file-style: "senf"
121 // indent-tabs-mode: nil
122 // ispell-local-dictionary: "american"
123 // compile-command: "scons -u test"
124 // comment-column: 40
125 // End: