Added $Id$, hope, this works
[senf.git] / Packets / MPEGDVBBundle / DatagramSection.hh
1 // $Id:DatagramSection.hh 327 2007-07-20 10:03:44Z tho $
2 //
3 // Copyright (C) 2007
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 //     Thorsten Horstmann <thorsten.horstmann@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 /** \brief
24     \file DatagramSection public header */
25
26 #ifndef HH_DatagramSection_
27 #define HH_DatagramSection_ 1
28
29 // Custom includes
30 #include <algorithm>
31 #include "../../Packets/Packets.hh"
32 #include "DSMCCSection.hh"
33
34
35 //#include "DatagramSection.mpp"
36 ///////////////////////////////hh.p////////////////////////////////////////
37
38 namespace senf {
39
40     /** \brief Parse a Datagram Section
41     
42         Parser implementing the Datagram Section.
43     
44         \see DatagramSectionType
45      */
46     struct Parse_DatagramSection : public Parse_DSMCCSection
47     {
48 #       include SENF_FIXED_PARSER()
49
50         SENF_PARSER_INHERIT( Parse_DSMCCSection );
51
52         SENF_PARSER_FIELD    ( mac_addr_4          , Parse_UInt8  );
53         SENF_PARSER_FIELD    ( mac_addr_3          , Parse_UInt8  );
54         SENF_PARSER_FIELD    ( mac_addr_2          , Parse_UInt8  );
55         SENF_PARSER_FIELD    ( mac_addr_1          , Parse_UInt8  );
56
57         SENF_PARSER_FINALIZE( Parse_DatagramSection );
58
59         // Parse table_id_extension as two bytes
60         SENF_PARSER_GOTO( table_id_extension );
61         SENF_PARSER_FIELD    ( mac_addr_6          , Parse_UInt8  );
62         SENF_PARSER_FIELD    ( mac_addr_5          , Parse_UInt8  );
63
64         // Divide 5 bit version_num field into several subfields.
65         SENF_PARSER_SKIP_BITS( 2 );
66         SENF_PARSER_BITFIELD ( payload_scrmbl_ctrl ,  2, unsigned );
67         SENF_PARSER_BITFIELD ( addr_scrmbl_ctrl    ,  2, unsigned );
68         SENF_PARSER_BITFIELD ( llc_snap_flag       ,  1, bool     );
69     };
70
71     /** \brief Datagram Section
72         
73         \par Packet type (typedef):
74             \ref DatagramSection
75
76         \par Fields:
77             \ref Parse_DatagramSection
78
79         \ingroup protocolbundle_mpegdvb
80      */
81     struct DatagramSectionType
82         : public DSMCCSectionType,
83           public PacketTypeMixin<DatagramSectionType>
84     {
85         typedef PacketTypeMixin<DatagramSectionType> mixin;
86         typedef ConcretePacket<DatagramSectionType> packet;
87         typedef Parse_DatagramSection parser;
88
89         using mixin::nextPacketRange;
90         using mixin::init;
91         
92         static void dump(packet p, std::ostream & os);
93         
94         static PacketParserBase::size_type initSize();
95         static PacketParserBase::size_type initHeadSize();
96     };
97         
98     typedef DatagramSectionType::packet DatagramSection;
99 }
100
101
102 ///////////////////////////////hh.e////////////////////////////////////////
103 //#include "DatagramSection.cci"
104 //#include "DatagramSection.ct"
105 //#include "DatagramSection.cti"
106 #endif
107
108 \f
109 // Local Variables:
110 // mode: c++
111 // fill-column: 100
112 // c-file-style: "senf"
113 // indent-tabs-mode: nil
114 // ispell-local-dictionary: "american"
115 // compile-command: "scons -u test"
116 // comment-column: 40
117 // End: