added link-map for the SocketPolicy overview image
[senf.git] / Packets / MPEG_DVBBundle / DSMCCSection.hh
1 // $Id$
2 //
3 // Copyright (C) 2007
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_DSMCCSection_
24 #define HH_DSMCCSection_ 1
25
26 // Custom includes
27 #include <algorithm>
28 #include "Packets/PacketType.hh"
29 #include "Packets/ParseInt.hh"
30 #include "Packets/PacketRegistry.hh"
31 #include "Packets/PacketParser.hh"
32
33 //#include "DSMCCSection.mpp"
34 ///////////////////////////////hh.p////////////////////////////////////////
35
36 namespace senf {
37
38     struct Parse_DSMCCSection : public PacketParserBase
39     {
40         SENF_PACKET_PARSER_INIT(Parse_DSMCCSection);
41
42         ///////////////////////////////////////////////////////////////////////////
43
44         typedef Parse_UInt8               Parse_table_id;
45         typedef Parse_Flag      <     0 > Parse_ssi;  // section_syntax_indicator
46         typedef Parse_Flag      <     1 > Parse_pi;   // private_indicator
47         typedef Parse_UIntField < 2,  4 > Parse_reserved_1;
48         typedef Parse_UIntField < 4, 16 > Parse_sec_length;
49         typedef Parse_UIntField < 0,  2 > Parse_reserved_2;
50         typedef Parse_UIntField < 2,  7 > Parse_version_num;
51         typedef Parse_Flag      <     7 > Parse_curr_next_indicator;
52                 
53         SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS(
54             ((Field       ) ( table_id,            Parse_table_id            )) 
55             ((OverlayField) ( ssi,                 Parse_ssi                 ))
56             ((OverlayField) ( pi,                  Parse_pi                  ))
57             ((OverlayField) ( reserved_1,          Parse_reserved_1          ))
58             ((Field       ) ( sec_length,          Parse_sec_length          ))
59             ((Field       ) ( tabel_id_extension,  Parse_UInt16              ))
60             ((OverlayField) ( reserved_2,          Parse_reserved_2          ))
61             ((OverlayField) ( version_num,         Parse_version_num         ))
62             ((Field       ) ( curr_next_indicator, Parse_curr_next_indicator ))
63             ((Field       ) ( sec_num,             Parse_UInt8               ))
64             ((Field       ) ( last_sec_num,        Parse_UInt8               ))
65         );
66         
67         Parse_UInt32 crc() const { return parse<Parse_UInt32>( data().size()-4 ); }
68     };
69
70     struct DSMCCSectionType
71         : public PacketTypeBase,
72           public PacketTypeMixin<DSMCCSectionType>
73     {
74         typedef PacketTypeMixin<DSMCCSectionType> mixin;
75         typedef ConcretePacket<DSMCCSectionType> packet;
76         typedef Parse_DSMCCSection parser;
77
78         using mixin::nextPacketRange;
79 //          using mixin::nextPacketType;
80         using mixin::init;
81         
82         static void dump(packet p, std::ostream & os);
83         
84         static PacketParserBase::size_type initSize();
85         static PacketParserBase::size_type initHeadSize();
86     };
87         
88     typedef DSMCCSectionType::packet DSMCCSection;
89 }
90
91
92 ///////////////////////////////hh.e////////////////////////////////////////
93 //#include "DSMCCSection.cci"
94 //#include "DSMCCSection.ct"
95 //#include "DSMCCSection.cti"
96 #endif
97
98 \f
99 // Local Variables:
100 // mode: c++
101 // fill-column: 100
102 // c-file-style: "senf"
103 // indent-tabs-mode: nil
104 // ispell-local-dictionary: "american"
105 // compile-command: "scons -u test"
106 // comment-column: 40
107 // End: