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