Move include files in debian packge into 'senf' subdirectory
[senf.git] / Packets / DefaultBundle / UDPPacket.hh
1 // $Id$
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 /** \file
24     \brief UDPPacket public header */
25
26 #ifndef HH_UDPPacket_
27 #define HH_UDPPacket_ 1
28
29 // Custom includes
30 #include "../../Packets/Packets.hh"
31
32 //#include "UDPPacket.mpp"
33 ///////////////////////////////hh.p////////////////////////////////////////
34
35 namespace senf {
36
37     /** \brief Parse a UDP packet
38
39         Parser implementing the UDP header. The fields implemented are:
40
41         \see UDPPacketType
42             <a href="http://tools.ietf.org/html/rfc768">RFC 768</a>
43      */
44     struct Parse_UDP : public PacketParserBase
45     {
46         typedef Parse_UInt16 Parse_16bit;
47
48 #       ifndef DOXYGEN
49
50         SENF_PACKET_PARSER_INIT(Parse_UDP);
51
52         SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS(
53             ((Field)( source,      Parse_16bit ))
54             ((Field)( destination, Parse_16bit ))
55             ((Field)( length,      Parse_16bit ))
56             ((Field)( crc,         Parse_16bit )) );
57
58 #       else
59
60         Parse_16bit source();
61         Parse_16bit destination();
62         Parse_16bit length();
63         Parse_16bit crc();
64
65 #       endif
66     };
67
68     /** \brief UDP packet
69         
70         \par Packet type (typedef):
71             \ref UDPPacket
72
73         \par Fields:
74             \ref Parse_UDP
75
76         \ingroup protocolbundle_default
77      */
78     struct UDPPacketType
79         : public PacketTypeBase,
80           public PacketTypeMixin<UDPPacketType>
81     {
82         typedef PacketTypeMixin<UDPPacketType> mixin;
83         typedef ConcretePacket<UDPPacketType> packet;
84         typedef Parse_UDP parser;
85
86         using mixin::nextPacketRange;
87         using mixin::initSize;
88         using mixin::init;
89
90         static void dump(packet p, std::ostream & os);
91     };
92
93     /** \brief UDP packet typedef */
94     typedef UDPPacketType::packet UDPPacket;
95 }
96
97
98 ///////////////////////////////hh.e////////////////////////////////////////
99 #endif
100 #ifndef SENF_PACKETS_DECL_ONLY
101 //#include UDPPacket.cci"
102 //#include "UDPPacket.ct"
103 //#include "UDPPacket.cti"
104 #endif
105
106 \f
107 // Local Variables:
108 // mode: c++
109 // fill-column: 100
110 // c-file-style: "senf"
111 // indent-tabs-mode: nil
112 // ispell-local-dictionary: "american"
113 // compile-command: "scons -u test"
114 // comment-column: 40
115 // End: