first steps to a MIHPacket
[senf.git] / 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 "../../Packets/Packets.hh"
31
32 //#include "MIHPacket.mpp"
33 ///////////////////////////////hh.p////////////////////////////////////////
34
35 namespace senf {
36
37     struct MIHPacketParser : public senf::PacketParserBase
38     {
39     #   include SENF_PARSER()
40         
41         SENF_PARSER_BITFIELD  ( version,       4,  unsigned );
42         SENF_PARSER_BITFIELD  ( ackRequest,    1,  bool     );
43         SENF_PARSER_BITFIELD  ( ackResponse,   1,  bool     );
44         SENF_PARSER_BITFIELD  ( uir,           1,  bool     );
45         SENF_PARSER_BITFIELD  ( moreFragment,  1,  bool     );
46         SENF_PARSER_BITFIELD  ( fragmentNr,    7,  unsigned );
47         SENF_PARSER_SKIP_BITS ( 1                           );
48         
49         // MIH message ID (MID)
50         SENF_PARSER_BITFIELD  ( sid,           4,  unsigned );
51         SENF_PARSER_BITFIELD  ( opcode,        2,  unsigned );
52         SENF_PARSER_BITFIELD  ( aid,           10, unsigned );
53         
54         SENF_PARSER_SKIP_BITS ( 4                           );
55         SENF_PARSER_BITFIELD  ( transactionId, 12, unsigned );
56         SENF_PARSER_FIELD_RO  ( payloadLength, UInt16Parser );
57         
58         SENF_PARSER_FINALIZE ( MIHPacketParser );
59     };
60     
61     
62     struct MIHPacketType
63         : public PacketTypeBase,
64           public PacketTypeMixin<MIHPacketType>
65     {
66         typedef PacketTypeMixin<MIHPacketType> mixin;
67         typedef ConcretePacket<MIHPacketType> packet;
68         typedef MIHPacketParser parser;
69
70         using mixin::nextPacketRange;
71         using mixin::init;
72         using mixin::initSize;
73
74         static void dump(packet p, std::ostream &os);
75 //        static void finalize(packet p);
76     };
77
78     typedef ConcretePacket<MIHPacketType> MIHPacket;
79 }
80
81
82 ///////////////////////////////hh.e////////////////////////////////////////
83 #endif
84 #ifndef SENF_PACKETS_DECL_ONLY
85 //#include "MIHPacket.cci"
86 //#include "MIHPacket.ct"
87 //#include "MIHPacket.cti"
88 #endif
89
90 \f
91 // Local Variables:
92 // mode: c++
93 // fill-column: 100
94 // c-file-style: "senf"
95 // indent-tabs-mode: nil
96 // ispell-local-dictionary: "american"
97 // compile-command: "scons -u test"
98 // comment-column: 40
99 // End: