Fix documentation build under maverick (doxygen 1.7.1)
[senf.git] / senf / Packets / 80221Bundle / MIHPacket.hh
1 // $Id$
2 //
3 // Copyright (C) 2009
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Thorsten Horstmann <tho@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 MIH protocol public header */
25
26 #ifndef HH_SENF_Packets_80221Bundle_MIHPacket_
27 #define HH_SENF_Packets_80221Bundle_MIHPacket_ 1
28
29 // Custom includes
30 #include <senf/Packets/Packets.hh>
31 #include "TLVParser.hh"
32 #include "MIHMessageRegistry.hh"
33
34 //#include "MIHPacket.mpp"
35 //-/////////////////////////////////////////////////////////////////////////////////////////////////
36
37 namespace senf {
38
39     /** \brief Parse a MIH packet
40
41         Parser implementing the MIH header. The fields implemented are:
42         \image html MIHPacket.png
43
44         \see MIHPacketType
45      */
46     struct MIHPacketParser : public PacketParserBase
47     {
48     #   include SENF_PARSER()
49
50         SENF_PARSER_BITFIELD_RO ( version,       4,  unsigned );
51         SENF_PARSER_BITFIELD    ( ackRequest,    1,  bool     );
52         SENF_PARSER_BITFIELD    ( ackResponse,   1,  bool     );
53         SENF_PARSER_BITFIELD    ( uir,           1,  bool     );
54         SENF_PARSER_BITFIELD    ( moreFragment,  1,  bool     );
55         SENF_PARSER_BITFIELD    ( fragmentNr,    7,  unsigned );
56         SENF_PARSER_SKIP_BITS   ( 1                           );
57
58         // MIH message ID (MID)
59         SENF_PARSER_FIELD    ( messageId, UInt16Parser ); //<pkgdraw:hide
60         SENF_PARSER_GOTO     ( messageId               );
61         SENF_PARSER_BITFIELD ( sid,     4,  unsigned   );
62         SENF_PARSER_BITFIELD ( opcode,  2,  unsigned   );
63         SENF_PARSER_BITFIELD ( aid,    10,  unsigned   );
64
65         SENF_PARSER_SKIP_BITS ( 4                           );
66         SENF_PARSER_BITFIELD  ( transactionId, 12, unsigned );
67         SENF_PARSER_FIELD_RO  ( payloadLength, UInt16Parser );
68
69         SENF_PARSER_GOTO_OFFSET( 8, 8); // just to limit the offset calculation
70
71         // Source MIHF Id
72         SENF_PARSER_FIELD ( src_mihfId, MIHFSrcIdTLVParser );
73         // Destination MIHF Id
74         SENF_PARSER_FIELD ( dst_mihfId, MIHFDstIdTLVParser );
75
76         SENF_PARSER_FINALIZE ( MIHPacketParser );
77
78         SENF_PARSER_INIT() {
79             defaultInit();
80             version_() = 1;
81         }
82
83         friend class MIHPacketType;
84     };
85
86     /** \brief MIH packet
87
88         \par Packet type (typedef):
89             \ref MIHPacket
90
91         \par Fields:
92             \ref MIHPacketParser
93
94         \ingroup protocolbundle_80221
95      */
96     struct MIHPacketType
97         : public PacketTypeBase,
98           public PacketTypeMixin<MIHPacketType, MIHMessageRegistry>
99     {
100 #ifndef DOXYGEN
101         typedef PacketTypeMixin<MIHPacketType, MIHMessageRegistry> mixin;
102 #endif
103         typedef ConcretePacket<MIHPacketType> packet; ///< MIH packet typedef
104         typedef MIHPacketParser parser;               ///< typedef to the parser of MIH packet
105
106         using mixin::nextPacketRange;
107         using mixin::init;
108         using mixin::initSize;
109
110         /** \brief Dump given MIH packet in readable form to given output stream */
111         static void dump(packet p, std::ostream &os);
112         static void finalize(packet p);
113         static factory_t nextPacketType(packet p);
114     };
115
116     /** \brief MIH packet typedef
117         \ingroup protocolbundle_80221
118      */
119     typedef ConcretePacket<MIHPacketType> MIHPacket;
120
121
122     struct MIHGenericPayloadPacketParser : public PacketParserBase
123     {
124     #   include SENF_PARSER()
125         SENF_PARSER_LIST ( tlvList, packetSize(), MIHGenericTLVParser );
126         SENF_PARSER_FINALIZE ( MIHGenericPayloadPacketParser );
127     };
128
129     struct MIHGenericPayloadPacketType
130         : public PacketTypeBase,
131           public PacketTypeMixin<MIHGenericPayloadPacketType>
132     {
133 #ifndef DOXYGEN
134         typedef PacketTypeMixin<MIHGenericPayloadPacketType> mixin;
135 #endif
136         typedef ConcretePacket<MIHGenericPayloadPacketType> packet; ///< MIH Payload packet typedef
137         typedef MIHGenericPayloadPacketParser parser; ///< typedef to the parser of MIH Payload packet
138
139         using mixin::nextPacketRange;
140         using mixin::init;
141         using mixin::initSize;
142
143         /** \brief Dump given MIHGenericPayload in readable form to given output stream */
144         static void dump(packet p, std::ostream &os);
145         static void finalize(packet p);
146     };
147
148      /** \brief MIH Payload packet typedef
149          \ingroup protocolbundle_80221
150       */
151     typedef ConcretePacket<MIHGenericPayloadPacketType> MIHGenericPayloadPacket;
152 }
153
154
155 //-/////////////////////////////////////////////////////////////////////////////////////////////////
156 //#include "MIHPacket.cci"
157 //#include "MIHPacket.ct"
158 //#include "MIHPacket.cti"
159 #endif
160
161
162 \f
163 // Local Variables:
164 // mode: c++
165 // fill-column: 100
166 // c-file-style: "senf"
167 // indent-tabs-mode: nil
168 // ispell-local-dictionary: "american"
169 // compile-command: "scons -u test"
170 // comment-column: 40
171 // End: