Add #ifndef DOXYGEN directives to hide boost::enable/disable_if constructs from doxygen
[senf.git] / Packets / DefaultBundle / IpV6Packet.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 IpV6Packet public header */
23
24 #ifndef HH_IpV6Packet_
25 #define HH_IpV6Packet_ 1
26
27 // Custom includes
28 #include "Packets/Packets.hh"
29 #include "IpV4Packet.hh"
30
31 //#include "IpV6Packet.mpp"
32 ///////////////////////////////hh.p////////////////////////////////////////
33
34 namespace senf {
35
36     /** \brief Parse an IpV6 packet
37
38         Parser implementing the IpV6 header. The fields implemented are:
39
40         <table class="senf">
41             <tr><th>Field name</th><th>Parser type</th></tr>
42             <tr><td>version</td><td>\ref Parse_Version</td></tr>
43             <tr><td>trafficClass</td><td>\ref Parse_Class</td></tr>
44             <tr><td>flowLabel</td><td>\ref Parse_FlowLabel</td></tr>
45             <tr><td>length</td><td>\ref Parse_16bit</td></tr>
46             <tr><td>nextHeader</td><td>\ref Parse_8bit</td></tr>
47             <tr><td>hopLimit</td><td>\ref Parse_8bit</td></tr>
48             <tr><td>source</td><td>\ref Parse_Addr</td></tr>
49             <tr><td>destination</td><td>\ref Parse_Addr</td></tr>
50         </table>
51
52         \see IpV6PacketType \n
53             <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
54      */
55     struct Parse_IpV6 : public PacketParserBase
56     {
57         SENF_PACKET_PARSER_NO_INIT(Parse_IpV6);
58
59         ///////////////////////////////////////////////////////////////////////////
60
61         typedef Parse_UIntField <  0,  4 > Parse_Version;
62         typedef Parse_UIntField <  4, 12 > Parse_Class;
63         typedef Parse_UIntField < 12, 32 > Parse_FlowLabel;
64         typedef Parse_UInt8                Parse_8bit;
65         typedef Parse_UInt16               Parse_16bit;
66
67         typedef Parse_Array < 16, Parse_8bit > Parse_Addr;
68
69         SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS(
70             ((OverlayField)( version,      Parse_Version   ))
71             ((OverlayField)( trafficClass, Parse_Class     ))
72             ((Field       )( flowLabel,    Parse_FlowLabel ))
73             ((Field       )( length,       Parse_16bit     ))
74             ((Field       )( nextHeader,   Parse_8bit      ))
75             ((Field       )( hopLimit,     Parse_8bit      ))
76             ((Field       )( source,       Parse_Addr      ))
77             ((Field       )( destination,  Parse_Addr      )) );
78
79         void init() {
80             version() = 6;
81         }
82     };
83
84     /** \brief IpV6 packet
85
86         \par Packet type (typedef):
87             \ref IpV6Packet
88         
89         \par Fields:
90             \ref Parse_IpV6
91
92         \par Associated registries:
93             \ref IpTypes
94
95         \ingroup protocolbundle_default
96      */
97     struct IpV6PacketType
98         : public PacketTypeBase,
99           public PacketTypeMixin<IpV6PacketType, IpTypes>
100     {
101         typedef PacketTypeMixin<IpV6PacketType, IpTypes> mixin;
102         typedef ConcretePacket<IpV6PacketType> packet;
103         typedef Parse_IpV6 parser;
104
105         using mixin::nextPacketRange;
106         using mixin::nextPacketType;
107         using mixin::initSize;
108         using mixin::init;
109
110         static registry_key_t nextPacketKey(packet p) 
111             { return p->nextHeader(); }
112         
113         static void dump(packet p, std::ostream & os);
114     };
115
116     /** \brief IpV6 packet typedef */
117     typedef IpV6PacketType::packet IpV6Packet;
118
119     ///@}
120 }
121
122 ///////////////////////////////hh.e////////////////////////////////////////
123 #endif
124 #ifndef SENF_PACKETS_DECL_ONLY
125 //#include "IpV6Packet.cci"
126 //#include "IpV6Packet.ct"
127 //#include "IpV6Packet.cti"
128 #endif
129
130 \f
131 // Local Variables:
132 // mode: c++
133 // fill-column: 100
134 // c-file-style: "senf"
135 // indent-tabs-mode: nil
136 // ispell-local-dictionary: "american"
137 // compile-command: "scons -u test"
138 // comment-column: 40
139 // End: