Packets: BUGFIX: ensure complete interpreter chain in finalize()
[senf.git] / Packets / DefaultBundle / UDPPacket.hh
1 // $Id: UDPPacket.hh 308 2007-07-14 22:31:20Z g0dil $
2 //
3 // Copyright (C) 2006
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 //     Stefan Bund <stefan.bund@fokus.fraunhofer.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 #ifndef HH_UDPPacket_
24 #define HH_UDPPacket_ 1
25
26 // Custom includes
27 #include "Packets/PacketType.hh"
28 #include "Packets/ParseInt.hh"
29 #include "Packets/PacketRegistry.hh"
30 #include "Packets/PacketParser.hh"
31
32 //#include "UDPPacket.mpp"
33 ///////////////////////////////hh.p////////////////////////////////////////
34
35 namespace senf {
36
37     ///\addtogroup protocolbundle_default
38     ///@{
39
40     // See RFC768
41     struct Parse_UDP : public PacketParserBase
42     {
43         SENF_PACKET_PARSER_INIT(Parse_UDP);
44
45         ///////////////////////////////////////////////////////////////////////////
46
47         typedef Parse_UInt16 Parse_16bit;
48
49         SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS(
50             ((Field)( source,      Parse_16bit ))
51             ((Field)( destination, Parse_16bit ))
52             ((Field)( length,      Parse_16bit ))
53             ((Field)( crc,         Parse_16bit )) );
54     };
55
56     struct UDPPacketType
57         : public PacketTypeBase,
58           public PacketTypeMixin<UDPPacketType>
59     {
60         typedef PacketTypeMixin<UDPPacketType> mixin;
61         typedef ConcretePacket<UDPPacketType> packet;
62         typedef Parse_UDP parser;
63
64         using mixin::nextPacketRange;
65         using mixin::initSize;
66         using mixin::init;
67
68         static void dump(packet p, std::ostream & os);
69     };
70
71     typedef UDPPacketType::packet UDPPacket;
72
73     ///@}
74 }
75
76
77 ///////////////////////////////hh.e////////////////////////////////////////
78 //#include UDPPacket.cci"
79 //#include "UDPPacket.ct"
80 //#include "UDPPacket.cti"
81 #endif
82
83 \f
84 // Local Variables:
85 // mode: c++
86 // fill-column: 100
87 // c-file-style: "senf"
88 // indent-tabs-mode: nil
89 // ispell-local-dictionary: "american"
90 // compile-command: "scons -u test"
91 // comment-column: 40
92 // End: