From: tho Date: Thu, 19 Jul 2007 15:57:15 +0000 (+0000) Subject: changed API for DVB (likely not the last time ;) X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=3b44557da0af28f1e0e3b8c0e0fb03de6b0d18c7;p=senf.git changed API for DVB (likely not the last time ;) git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@323 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Examples/DVBdec/MPEdec.cc b/Examples/DVBdec/MPEdec.cc new file mode 100644 index 0000000..ee8f8be --- /dev/null +++ b/Examples/DVBdec/MPEdec.cc @@ -0,0 +1,145 @@ +// $Id: Sniffer.cc 296 2007-07-10 20:39:34Z g0dil $ +// +// Copyright (C) 2006 +// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) +// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// Stefan Bund +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// Definition of non-inline non-template functions + +#include +#include +#include +#include +#include +#include + +#include "Scheduler/Scheduler.hh" +#include "Packets/DefaultBundle/EthernetPacket.hh" +#include "Packets/MPEG_DVBBundle/DatagramSection.hh" +#include "Utils/membind.hh" +#include "Socket/DVBDemuxHandles.hh" +#include "Packets/ParseInt.hh" +#include "Packets/Packet.hh" +#include "Packets/PacketData.hh" + +#define PID 500 + +#define prefix_ +///////////////////////////////cc.p//////////////////////////////////////// + +namespace { + + static const unsigned BLOCK_SIZE = 16; + + template + void hexdump(Iterator i, Iterator const & i_end, std::ostream& stream) + { + unsigned offset (0); + std::string ascii; + for (; i != i_end; ++i, ++offset) { + switch (offset % BLOCK_SIZE) { + case 0: + if (!ascii.empty()) { + stream << " " << ascii << "\n"; + ascii = ""; + } + stream << " " + << std::hex << std::setw(4) << std::setfill('0') + << offset << ' '; + break; + case BLOCK_SIZE/2: + stream << " "; + ascii += ' '; + break; + } + stream << ' ' << std::hex << std::setw(2) << std::setfill('0') + << unsigned(*i); + ascii += (*i >= ' ' && *i < 126) ? *i : '.'; + } + if (!ascii.empty()) { + for (; (offset % BLOCK_SIZE) != 0; ++offset) { + if ((offset % BLOCK_SIZE) == BLOCK_SIZE/2) + stream << " "; + stream << " "; + } + stream << " " << ascii << "\n"; + } + stream << std::dec; + } +} + + +class MySniffer +{ + senf::DVBDemuxSectionHandle handle; + +public: + MySniffer() + { + struct dmx_sct_filter_params sec_filter; + memset(&sec_filter, 0, sizeof (struct dmx_sct_filter_params)); + sec_filter.pid = PID; + sec_filter.filter.filter[0] = 62; + sec_filter.filter.mask[0] = 0xff; + sec_filter.flags = DMX_IMMEDIATE_START; + sec_filter.flags |= DMX_CHECK_CRC; + + handle.protocol().setSectionFilter( &sec_filter ); + + senf::Scheduler::instance().add( + handle, senf::membind(&MySniffer::dumpSection, this)); + } + +private: + void dumpSection(senf::FileHandle /* ignored */, senf::Scheduler::EventId event) + { + std::string data (handle.read()); + senf::DatagramSection section (senf::DatagramSection::create(data)); + section.dump(std::cout); + senf::PacketData & datagramData (section.last().data()); + hexdump(datagramData.begin(), datagramData.end(), std::cout); + } +}; + +int main(int argc, char const * argv[]) +{ + try { + MySniffer sniffer; + senf::Scheduler::instance().process(); + } + catch (std::exception const & ex) { + std::cerr << senf::prettyName(typeid(ex)) << ": " << ex.what() << "\n"; + } + return 0; +} + + +///////////////////////////////cc.e//////////////////////////////////////// +#undef prefix_ + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 +// End: diff --git a/Examples/DVBdec/SConscript b/Examples/DVBdec/SConscript new file mode 100644 index 0000000..5f69e84 --- /dev/null +++ b/Examples/DVBdec/SConscript @@ -0,0 +1,12 @@ +Import('env') +import SENFSCons + +########################################################################### + +SENFSCons.Binary(env, 'uledec', 'ULEdec.cc', + LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Utils' ], + OBJECTS = [ '#/Packets/MPEG_DVBBundle/MPEG_DVBBundle.o' ]); + +SENFSCons.Binary(env, 'mpedec', 'MPEdec.cc', + LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Utils' ], + OBJECTS = [ '#/Packets/MPEG_DVBBundle/MPEG_DVBBundle.o' ]); diff --git a/Examples/DVBdec/ULEdec.cc b/Examples/DVBdec/ULEdec.cc new file mode 100644 index 0000000..1cc4eec --- /dev/null +++ b/Examples/DVBdec/ULEdec.cc @@ -0,0 +1,147 @@ +// $Id: Sniffer.cc 296 2007-07-10 20:39:34Z g0dil $ +// +// Copyright (C) 2006 +// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) +// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// Stefan Bund +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// Definition of non-inline non-template functions + +#include +#include +#include +#include +#include +#include + +#include "Scheduler/Scheduler.hh" +#include "Packets/DefaultBundle/EthernetPacket.hh" +#include "Packets/MPEG_DVBBundle/DatagramSection.hh" +#include "Utils/membind.hh" +#include "Socket/DVBDemuxHandles.hh" +#include "Packets/ParseInt.hh" +#include "Packets/Packet.hh" +#include "Packets/PacketData.hh" + +#define PID 271 + +#define prefix_ +///////////////////////////////cc.p//////////////////////////////////////// + +namespace { + + static const unsigned BLOCK_SIZE = 16; + + template + void hexdump(Iterator i, Iterator const & i_end, std::ostream& stream) + { + unsigned offset (0); + std::string ascii; + for (; i != i_end; ++i, ++offset) { + switch (offset % BLOCK_SIZE) { + case 0: + if (!ascii.empty()) { + stream << " " << ascii << "\n"; + ascii = ""; + } + stream << " " + << std::hex << std::setw(4) << std::setfill('0') + << offset << ' '; + break; + case BLOCK_SIZE/2: + stream << " "; + ascii += ' '; + break; + } + stream << ' ' << std::hex << std::setw(2) << std::setfill('0') + << unsigned(*i); + ascii += (*i >= ' ' && *i < 126) ? *i : '.'; + } + if (!ascii.empty()) { + for (; (offset % BLOCK_SIZE) != 0; ++offset) { + if ((offset % BLOCK_SIZE) == BLOCK_SIZE/2) + stream << " "; + stream << " "; + } + stream << " " << ascii << "\n"; + } + stream << std::dec; + } +} + + +class MySniffer +{ + senf::DVBDemuxPESHandle demuxHandle; + senf::DVBDvrHandle dvrHandle; + +public: + MySniffer() + { + struct dmx_pes_filter_params pes_filter; + memset(&pes_filter, 0, sizeof (struct dmx_pes_filter_params)); + pes_filter.pid = PID; + pes_filter.input = DMX_IN_FRONTEND; + pes_filter.output = DMX_OUT_TS_TAP; + pes_filter.pes_type = DMX_PES_OTHER; + pes_filter.flags = DMX_IMMEDIATE_START; + + demuxHandle.protocol().setPESFilter( &pes_filter ); + + senf::Scheduler::instance().add( + dvrHandle, senf::membind(&MySniffer::dumpSection, this)); + } + +private: + void dumpSection(senf::FileHandle /* ignored */, senf::Scheduler::EventId event) + { + std::string data (dvrHandle.read()); + std::cout << data.length() << "\n"; + //senf::DatagramSection section (senf::DatagramSection::create(data)); + //section.dump(std::cout); + //senf::PacketData & datagramData (section.last().data()); + //hexdump(datagramData.begin(), datagramData.end(), std::cout); + } +}; + +int main(int argc, char const * argv[]) +{ + try { + MySniffer sniffer; + senf::Scheduler::instance().process(); + } + catch (std::exception const & ex) { + std::cerr << senf::prettyName(typeid(ex)) << ": " << ex.what() << "\n"; + } + return 0; +} + + +///////////////////////////////cc.e//////////////////////////////////////// +#undef prefix_ + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 +// End: diff --git a/Examples/DVBdec/mpedec b/Examples/DVBdec/mpedec new file mode 100755 index 0000000..3e1ac33 Binary files /dev/null and b/Examples/DVBdec/mpedec differ diff --git a/Examples/DVBdec/uledec b/Examples/DVBdec/uledec new file mode 100755 index 0000000..0978ba2 Binary files /dev/null and b/Examples/DVBdec/uledec differ diff --git a/Examples/Sniffer/Sniffer.cc b/Examples/Sniffer/Sniffer.cc index fc9c674..a3234e8 100644 --- a/Examples/Sniffer/Sniffer.cc +++ b/Examples/Sniffer/Sniffer.cc @@ -84,7 +84,7 @@ int loop_main (int argc, char const * argv[]) { try { senf::PacketSocketHandle sock; - sock.bind(senf::LLSocketAddress("eth0")); + sock.bind(senf::LLSocketAddress("eth1")); // sock.protocol().promisc("eth0",senf::PacketProtocol::Promiscuous); while (true) { // forever @@ -136,7 +136,7 @@ private: int scheduler_main(int argc, char const * argv[]) { try { - Sniffer sniffer ("eth0"); + Sniffer sniffer ("eth1"); sniffer.run(); } catch (std::exception const & ex) { diff --git a/Socket/DVBSectionHandle.cc b/Socket/DVBDemuxHandles.cc similarity index 52% rename from Socket/DVBSectionHandle.cc rename to Socket/DVBDemuxHandles.cc index ad938a7..d449a62 100644 --- a/Socket/DVBSectionHandle.cc +++ b/Socket/DVBDemuxHandles.cc @@ -1,4 +1,4 @@ -// $Id$ +// $Id: DVBSectionHandle.cc 321 2007-07-19 09:00:23Z tho $ // // Copyright (C) 2007 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) @@ -24,8 +24,8 @@ \brief xxx */ -#include "DVBSectionHandle.hh" -//#include "DVBSectionHandle.ih" +#include "DVBDemuxHandles.hh" +//#include "DVBDemuxHandles.ih" // Custom includes #include @@ -39,14 +39,14 @@ #include "Utils/Exception.hh" -//#include "DVBSectionHandle.mpp" +//#include "DVBDemuxHandles.mpp" #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// -// senf::DVBSectionProtocol +// senf::DVBDemuxHandles -prefix_ void senf::DVBSectionProtocol::init_client() +prefix_ void senf::DVBDemuxSectionProtocol::init_client() const { int fd = open("/dev/dvb/adapter0/demux0", O_RDONLY | O_NONBLOCK); @@ -55,45 +55,81 @@ prefix_ void senf::DVBSectionProtocol::init_client() body().fd(fd); } -prefix_ unsigned senf::DVBSectionProtocol::available() +prefix_ unsigned senf::DVBDemuxSectionProtocol::available() const { return 4096; } -prefix_ std::auto_ptr senf::DVBSectionProtocol::clone() +prefix_ std::auto_ptr senf::DVBDemuxSectionProtocol::clone() const { - return std::auto_ptr(new DVBSectionProtocol()); + return std::auto_ptr(new DVBDemuxSectionProtocol()); } +prefix_ void senf::DVBDemuxSectionProtocol::setSectionFilter(struct dmx_sct_filter_params *filter) + const +{ + if (::ioctl(body().fd(), DMX_SET_FILTER, filter) < 0) + throw SystemException(errno); +} -prefix_ void senf::DVBSectionProtocol::setSectionFilter( - unsigned short pid, - unsigned char table_id) +// ---------------------------------------------------------------- + +prefix_ void senf::DVBDemuxPESProtocol::init_client() const { - struct dmx_sct_filter_params sec_filter; - memset(&sec_filter, 0, sizeof (struct dmx_sct_filter_params)); - sec_filter.pid = pid; - sec_filter.filter.filter[0] = table_id; - sec_filter.filter.mask[0] = 0xff; - sec_filter.flags = DMX_IMMEDIATE_START; - sec_filter.flags |= DMX_CHECK_CRC; - setSectionFilter( &sec_filter ); + int fd = open("/dev/dvb/adapter0/demux0", O_RDONLY | O_NONBLOCK); + if (fd < 0) + throw SystemException(errno); + body().fd(fd); } +prefix_ unsigned senf::DVBDemuxPESProtocol::available() + const +{ + return 4096; //??? +} -prefix_ void senf::DVBSectionProtocol::setSectionFilter(struct dmx_sct_filter_params *filter) +prefix_ std::auto_ptr senf::DVBDemuxPESProtocol::clone() const { - if (::ioctl(body().fd(), DMX_SET_FILTER, filter) < 0) + return std::auto_ptr(new DVBDemuxPESProtocol()); +} + +prefix_ void senf::DVBDemuxPESProtocol::setPESFilter(struct dmx_pes_filter_params *filter) + const +{ + if (::ioctl(body().fd(), DMX_SET_PES_FILTER, filter) < 0) throw SystemException(errno); } +// ---------------------------------------------------------------- + +prefix_ void senf::DVBDvrProtocol::init_client() + const +{ + int fd = open("/dev/dvb/adapter0/dvr0", O_RDONLY | O_NONBLOCK); + if (fd < 0) + throw SystemException(errno); + body().fd(fd); +} + +prefix_ unsigned senf::DVBDvrProtocol::available() + const +{ + return 188; +} + +prefix_ std::auto_ptr senf::DVBDvrProtocol::clone() + const +{ + return std::auto_ptr(new DVBDvrProtocol()); +} + ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_ -//#include "DVBSectionHandle.mpp" +//#include "DVBDemuxHandles.mpp" // Local Variables: diff --git a/Socket/DVBDemuxHandles.hh b/Socket/DVBDemuxHandles.hh new file mode 100644 index 0000000..40665e5 --- /dev/null +++ b/Socket/DVBDemuxHandles.hh @@ -0,0 +1,174 @@ +// $Id: DVBDemuxSectionHandle.hh 321 2007-07-19 09:00:23Z tho $ +// +// Copyright (C) 2007 +// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) +// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// Stefan Bund +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +/** \file + \brief DVBHandles + */ + +#ifndef HH_DVBDemuxHandles_ +#define HH_DVBDemuxHandles_ 1 + +// Custom includes +#include "BSDSocketProtocol.hh" +#include "FramingPolicy.hh" +#include "CommunicationPolicy.hh" +#include "ReadWritePolicy.hh" +#include "BufferingPolicy.hh" +#include "ProtocolClientSocketHandle.hh" +#include "DVBDemuxProtocol.hh" + +//#include "DVBDemuxHandles.mpp" +///////////////////////////////hh.p//////////////////////////////////////// + +namespace senf { + + /// \addtogroup concrete_protocol_group + /// @{ + + typedef MakeSocketPolicy< + NoAddressingPolicy, + DatagramFramingPolicy, + UnconnectedCommunicationPolicy, + ReadablePolicy, + NotWriteablePolicy, + SocketBufferingPolicy + >::policy DVBDemux_Policy; ///< Socket Policy for xxxx + + /** \brief xxx + */ + class DVBDemuxSectionProtocol + : public ConcreteSocketProtocol, + public DVBDemuxProtocol + { + public: + /////////////////////////////////////////////////////////////////////////// + // internal interface + + ///\name Constructors + ///@{ + + void init_client() const; ///< xxx + /**< \note This member is implicitly called from the + ProtocolClientSocketHandle::ProtocolClientSocketHandle() + constructor */ + + ///@} + ///\name Abstract Interface Implementation + + unsigned available() const; + + std::auto_ptr clone() const; + + ///@} + + void setSectionFilter(struct dmx_sct_filter_params *filter) const; + }; + + typedef ProtocolClientSocketHandle DVBDemuxSectionHandle; + + // ---------------------------------------------------------------- + + /** \brief xxx + */ + class DVBDemuxPESProtocol + : public ConcreteSocketProtocol, + public DVBDemuxProtocol + { + public: + /////////////////////////////////////////////////////////////////////////// + // internal interface + + ///\name Constructors + ///@{ + + void init_client() const; ///< xxx + /**< \note This member is implicitly called from the + ProtocolClientSocketHandle::ProtocolClientSocketHandle() + constructor */ + + ///@} + ///\name Abstract Interface Implementation + + unsigned available() const; + + std::auto_ptr clone() const; + + ///@} + + void setPESFilter(struct dmx_pes_filter_params *filter) const; + }; + + typedef ProtocolClientSocketHandle DVBDemuxPESHandle; + + + // ---------------------------------------------------------------- + + + /** \brief xxx + */ + class DVBDvrProtocol + : public ConcreteSocketProtocol, + public DVBDemuxProtocol + { + public: + /////////////////////////////////////////////////////////////////////////// + // internal interface + + ///\name Constructors + ///@{ + + void init_client() const; ///< xxx + /**< \note This member is implicitly called from the + ProtocolClientSocketHandle::ProtocolClientSocketHandle() + constructor */ + + ///@} + ///\name Abstract Interface Implementation + + unsigned available() const; + + std::auto_ptr clone() const; + + ///@} + + }; + + typedef ProtocolClientSocketHandle DVBDvrHandle; + +} + +///////////////////////////////hh.e//////////////////////////////////////// +//#include "DVBDemuxHandles.cci" +//#include "DVBDemuxHandles.ct" +//#include "DVBDemuxHandles.cti" +#endif + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 +// End: diff --git a/Socket/DVBProtocol.cc b/Socket/DVBDemuxProtocol.cc similarity index 81% rename from Socket/DVBProtocol.cc rename to Socket/DVBDemuxProtocol.cc index 65a3045..f1f0ef1 100644 --- a/Socket/DVBProtocol.cc +++ b/Socket/DVBDemuxProtocol.cc @@ -1,4 +1,4 @@ -// $Id$ +// $Id: DVBProtocol.cc 321 2007-07-19 09:00:23Z tho $ // // Copyright (C) 2007 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) @@ -24,8 +24,8 @@ \brief xxx */ -#include "DVBProtocol.hh" -//#include "DVBProtocol.ih" +#include "DVBDemuxProtocol.hh" +//#include "DVBDemuxProtocol.ih" // Custom includes #include @@ -35,34 +35,34 @@ #include #include "SocketHandle.hh" -//#include "DVBProtocol.mpp" +//#include "DVBDemuxProtocol.mpp" #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// -prefix_ void senf::DVBProtocol::setBufferSize(unsigned long size) +prefix_ void senf::DVBDemuxProtocol::setBufferSize(unsigned long size) const { if (::ioctl(body().fd(), DMX_SET_BUFFER_SIZE, size) < 0) throw SystemException(errno); } -prefix_ void senf::DVBProtocol::startFiltering() +prefix_ void senf::DVBDemuxProtocol::startFiltering() const { if (::ioctl(body().fd(), DMX_START) < 0) throw SystemException(errno); } -prefix_ void senf::DVBProtocol::stopFiltering() +prefix_ void senf::DVBDemuxProtocol::stopFiltering() const { if (::ioctl(body().fd(), DMX_STOP) < 0) throw SystemException(errno); } -prefix_ bool senf::DVBProtocol::eof() +prefix_ bool senf::DVBDemuxProtocol::eof() const { return false; @@ -70,7 +70,7 @@ prefix_ bool senf::DVBProtocol::eof() ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_ -//#include "DVBProtocol.mpp" +//#include "DVBDemuxProtocol.mpp" // Local Variables: diff --git a/Socket/DVBProtocol.hh b/Socket/DVBDemuxProtocol.hh similarity index 88% rename from Socket/DVBProtocol.hh rename to Socket/DVBDemuxProtocol.hh index 747d5d4..8281cc8 100644 --- a/Socket/DVBProtocol.hh +++ b/Socket/DVBDemuxProtocol.hh @@ -1,4 +1,4 @@ -// $Id$ +// $Id: DVBProtocol.hh 321 2007-07-19 09:00:23Z tho $ // // Copyright (C) 2007 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) @@ -24,8 +24,8 @@ \brief DVBProtocol public header */ -#ifndef HH_DVBProtocol_ -#define HH_DVBProtocol_ 1 +#ifndef HH_DVBDemuxProtocol_ +#define HH_DVBDemuxProtocol_ 1 #include @@ -43,7 +43,7 @@ namespace senf { /** xxx */ - class DVBProtocol + class DVBDemuxProtocol : public virtual SocketProtocol { public: @@ -66,9 +66,9 @@ namespace senf { } ///////////////////////////////hh.e//////////////////////////////////////// -//#include "DVBProtocol.cci" -//#include "DVBProtocol.ct" -//#include "DVBProtocol.cti" +//#include "DVBDemuxProtocol.cci" +//#include "DVBDemuxProtocol.ct" +//#include "DVBDemuxProtocol.cti" #endif diff --git a/Socket/DVBSectionHandle.hh b/Socket/DVBSectionHandle.hh deleted file mode 100644 index dd9a280..0000000 --- a/Socket/DVBSectionHandle.hh +++ /dev/null @@ -1,110 +0,0 @@ -// $Id$ -// -// Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) -// Stefan Bund -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the -// Free Software Foundation, Inc., -// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -/** \file - \brief DVBSectionHandle - */ - -#ifndef HH_DVBSectionHandle_ -#define HH_DVBSectionHandle_ 1 - -// Custom includes -#include "BSDSocketProtocol.hh" -#include "FramingPolicy.hh" -#include "CommunicationPolicy.hh" -#include "ReadWritePolicy.hh" -#include "BufferingPolicy.hh" -#include "ProtocolClientSocketHandle.hh" -#include "DVBProtocol.hh" - -//#include "DVBSocketHandle.mpp" -///////////////////////////////hh.p//////////////////////////////////////// - -namespace senf { - - /// \addtogroup concrete_protocol_group - /// @{ - - typedef MakeSocketPolicy< - NoAddressingPolicy, - DatagramFramingPolicy, - UnconnectedCommunicationPolicy, - ReadablePolicy, - NotWriteablePolicy, - SocketBufferingPolicy - >::policy DVBSection_Policy; ///< Socket Policy for DVBSection - - /** \brief xxx - */ - class DVBSectionProtocol - : public ConcreteSocketProtocol, - public DVBProtocol - { - public: - /////////////////////////////////////////////////////////////////////////// - // internal interface - - ///\name Constructors - ///@{ - - void init_client() const; ///< xxx - /**< \note This member is implicitly called from the - ProtocolClientSocketHandle::ProtocolClientSocketHandle() - constructor */ - - ///@} - ///\name Abstract Interface Implementation - - unsigned available() const; - - std::auto_ptr clone() const; - - ///@} - - void setSectionFilter(unsigned short pid, unsigned char table_id) const; - - private: - void setSectionFilter(struct dmx_sct_filter_params *filter) const; - - }; - - typedef ProtocolClientSocketHandle DVBSectionHandle; - - -} - -///////////////////////////////hh.e//////////////////////////////////////// -//#include "DVBSectionHandle.cci" -//#include "DVBSectionHandle.ct" -//#include "DVBSectionHandle.cti" -#endif - - -// Local Variables: -// mode: c++ -// fill-column: 100 -// c-file-style: "senf" -// indent-tabs-mode: nil -// ispell-local-dictionary: "american" -// compile-command: "scons -u test" -// comment-column: 40 -// End: