fixed small documentation typo
[senf.git] / Packets / MPEGDVBBundle / TransportPacket.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 //     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_TransportPacket_
24 #define HH_TransportPacket_ 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 "TransportPacket.mpp"
34 ///////////////////////////////hh.p////////////////////////////////////////
35
36 namespace senf {
37
38     /** \brief Parse a UDP packet
39
40         Parser implementing the header of a MPEG Transport Stream Packet.
41         
42         \see TransportPacketType
43      */
44     struct Parse_TransportPacket : public PacketParserBase
45     {
46         typedef Parse_Flag      <     0 > Parse_tei; // transport_error_indicator
47         typedef Parse_Flag      <     1 > Parse_pusi; // payload_unit_start_indicator
48         typedef Parse_Flag      <     2 > Parse_transportPrio;  // transport_priority
49         typedef Parse_UIntField < 2, 16 > Parse_pid;
50         typedef Parse_UIntField < 0,  2 > Parse_tsc; // transport_scrambling_control
51         typedef Parse_UIntField < 2,  4 > Parse_adaptCtrl; // adaptation_field_control
52         typedef Parse_UIntField < 4,  8 > Parse_contCounter; // continuity_counter
53     
54 #       ifndef DOXYGEN
55         
56         SENF_PACKET_PARSER_INIT(Parse_TransportPacket);
57         
58         SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS(
59             ((Field       ) ( sync_byte,                 Parse_UInt8         )) 
60             ((OverlayField) ( transport_error_indicator, Parse_tei           ))
61             ((OverlayField) ( pusi,                      Parse_pusi          ))
62             ((OverlayField) ( transport_priority,        Parse_transportPrio ))
63             ((Field       ) ( pid,                       Parse_pid           ))
64             ((OverlayField) ( transport_scrmbl_ctrl,     Parse_tsc           ))
65             ((OverlayField) ( adaptation_field_ctrl,     Parse_adaptCtrl     ))
66             ((Field       ) ( continuity_counter,        Parse_contCounter   ))      
67         );
68         
69 #       else
70         
71         Parse_UInt8         sync_byte() const;
72         Parse_tei           transport_error_indicator() const;
73         Parse_pusi          pusi() const;
74         Parse_transportPrio transport_priority() const;
75         Parse_pid           pid() const;
76         Parse_tsc           transport_scrmbl_ctrl() const;
77         Parse_adaptCtrl     adaptation_field_ctrl() const;
78         Parse_contCounter   continuity_counter() const;
79
80 #       endif
81         
82 //        Parse_UInt8 payload_pointer() const {
83 //            return parse<Parse_UInt8>( Parse_TransportPacket::fixed_bytes ); 
84 //        }
85     };
86     
87     /** \brief Transport Stream packet
88         
89         \par Packet type (typedef):
90             \ref TransportPacket
91
92         \par Fields:
93             \ref Parse_TransportPacket
94
95         \ingroup protocolbundle_mpegdvb
96      */
97     struct TransportPacketType
98         : public PacketTypeBase,
99           public PacketTypeMixin<TransportPacketType>
100     {
101         typedef PacketTypeMixin<TransportPacketType> mixin;
102         typedef ConcretePacket<TransportPacketType> packet;
103         typedef Parse_TransportPacket parser;
104     
105         using mixin::nextPacketRange;
106     //          using mixin::nextPacketType;
107         using mixin::init;
108         using mixin::initSize;
109         
110         static void dump(packet p, std::ostream & os);
111     };
112     
113     /** \brief Transport packet typedef */
114     typedef TransportPacketType::packet TransportPacket;
115   
116 }
117
118
119 ///////////////////////////////hh.e////////////////////////////////////////
120 //#include "TransportPacket.cci"
121 //#include "TransportPacket.ct"
122 //#include "TransportPacket.cti"
123 #endif
124
125 \f
126 // Local Variables:
127 // mode: c++
128 // fill-column: 100
129 // c-file-style: "senf"
130 // indent-tabs-mode: nil
131 // ispell-local-dictionary: "american"
132 // compile-command: "scons -u test"
133 // comment-column: 40
134 // End: