added consolewrapper vor DVB-Demuxfilter
[senf.git] / Socket / Protocols / DVB / DVBDemuxHandles.hh
1 // $Id$
2 //
3 // Copyright (C) 2007
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Thorsten Horstmann <tho@berlios.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 DVBDemuxHandles public header */
25
26 #ifndef HH_SENF_Socket_Protocols_DVB_DVBDemuxHandles_
27 #define HH_SENF_Socket_Protocols_DVB_DVBDemuxHandles_ 1
28
29 // Custom includes
30 #include "../../../Socket/FramingPolicy.hh"
31 #include "../../../Socket/CommunicationPolicy.hh"
32 #include "../../../Socket/ReadWritePolicy.hh"
33 #include "../../../Socket/ProtocolClientSocketHandle.hh"
34 #include "DVBDemuxSocketProtocol.hh"
35
36 //#include "DVBDemuxHandles.mpp"
37 #include <boost/enable_shared_from_this.hpp>
38 #include <boost/shared_ptr.hpp>
39 #include <iostream>
40 ///////////////////////////////hh.p////////////////////////////////////////
41
42 namespace senf {
43
44     /// \addtogroup concrete_protocol_group
45     /// @{
46
47     typedef MakeSocketPolicy<
48         NoAddressingPolicy,
49         DatagramFramingPolicy,
50         UnconnectedCommunicationPolicy,
51         ReadablePolicy,
52         NotWriteablePolicy
53         >::policy DVBDemux_Policy;   ///< Socket Policy for xxxx
54
55     /** \brief xxx
56      */
57     class DVBPrococolWrapper :public boost::enable_shared_from_this<DVBPrococolWrapper> {
58         public:
59             DVBPrococolWrapper(){}
60             virtual ~DVBPrococolWrapper(){}
61     };
62     
63     class DVBSocketProtocol : public virtual SocketProtocol {
64 private:
65         boost::shared_ptr<DVBPrococolWrapper> wrap_;
66 public:
67         DVBSocketProtocol() {}
68         ~DVBSocketProtocol() {}
69
70         void addWrapper(boost::shared_ptr<DVBPrococolWrapper> wrap) {
71             wrap_ = wrap;
72         }
73         virtual void close(){
74             wrap_.reset();
75             SocketProtocol::close();
76
77         }
78     };
79     
80     
81     class DVBDemuxSectionSocketProtocol
82         : public ConcreteSocketProtocol<DVBDemux_Policy, DVBDemuxSectionSocketProtocol>,
83           public DVBDemuxSocketProtocol, 
84           public DVBSocketProtocol
85     {
86     
87     public:
88         ///////////////////////////////////////////////////////////////////////////
89         // internal interface
90
91         ///\name Constructors
92         ///@{
93
94         void init_client(unsigned short adapter=0, unsigned short device=0) const;       ///< xxx
95                                         /**< \note This member is implicitly called from the
96                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
97                                              constructor */
98
99         ///@}
100         ///\name Abstract Interface Implementation
101         ///@{
102         
103         unsigned available() const;
104
105         ///@}
106         
107         void setSectionFilter(unsigned short int pid, 
108                 unsigned char filter= 0x3e,
109                 unsigned int flags= DMX_IMMEDIATE_START | DMX_CHECK_CRC, 
110                 unsigned char mask = 0xff, 
111                 unsigned char mode =0x00,
112                 unsigned int timeout =0x00) const;
113         
114     };
115
116     typedef ProtocolClientSocketHandle<DVBDemuxSectionSocketProtocol> DVBDemuxSectionHandle;
117     
118     // ----------------------------------------------------------------
119     
120     /** \brief xxx
121      */
122     class DVBDemuxPESSocketProtocol
123         : public ConcreteSocketProtocol<DVBDemux_Policy,DVBDemuxPESSocketProtocol>,
124           public DVBDemuxSocketProtocol,
125           public DVBSocketProtocol
126     {
127     public:
128         ///////////////////////////////////////////////////////////////////////////
129         // internal interface
130
131         ///\name Constructors
132         ///@{
133
134         void init_client(unsigned short adapter=0, unsigned short device=0) const;       ///< xxx
135                                         /**< \note This member is implicitly called from the
136                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
137                                              constructor */
138
139         ///@}
140         ///\name Abstract Interface Implementation
141         ///@{
142         
143         unsigned available() const;
144
145         ///@}
146         
147         void setPESFilter(unsigned short int pid, dmx_input_t input, dmx_output_t output, dmx_pes_type_t pesType, unsigned int flags)const;    
148     };
149
150     typedef ProtocolClientSocketHandle<DVBDemuxPESSocketProtocol> DVBDemuxPESHandle;
151
152     
153     // ----------------------------------------------------------------
154     
155     
156     /** \brief xxx
157          */
158     class DVBDvrSocketProtocol
159         : public ConcreteSocketProtocol<DVBDemux_Policy, DVBDvrSocketProtocol>,
160           public DVBDemuxSocketProtocol
161     {
162     public:
163         ///////////////////////////////////////////////////////////////////////////
164         // internal interface
165
166         ///\name Constructors
167         ///@{
168
169         void init_client(unsigned short adapter=0, unsigned short device=0) const;       ///< xxx
170                                         /**< \note This member is implicitly called from the
171                                              ProtocolClientSocketHandle::ProtocolClientSocketHandle()
172                                              constructor */
173
174         ///@}
175         ///\name Abstract Interface Implementation
176         ///@{
177         
178         unsigned available() const;
179
180         ///@}
181      };
182
183      typedef ProtocolClientSocketHandle<DVBDvrSocketProtocol> DVBDvrHandle;
184
185     ///@}
186     
187 }
188
189 ///////////////////////////////hh.e////////////////////////////////////////
190 //#include "DVBDemuxHandles.cci"
191 //#include "DVBDemuxHandles.ct"
192 //#include "DVBDemuxHandles.cti"
193 #endif
194
195 \f
196 // Local Variables:
197 // mode: c++
198 // fill-column: 100
199 // c-file-style: "senf"
200 // indent-tabs-mode: nil
201 // ispell-local-dictionary: "american"
202 // compile-command: "scons -u test"
203 // comment-column: 40
204 // End: