From: tho Date: Thu, 19 Jul 2007 08:36:43 +0000 (+0000) Subject: first small steps to MPEG/DVB support... X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=83df9651fac5af034774ff9314ee18eeb8a5ec2a;p=senf.git first small steps to MPEG/DVB support... git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@320 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Packets/Doxyfile b/Packets/Doxyfile index 0bacd5b..86ce327 100644 --- a/Packets/Doxyfile +++ b/Packets/Doxyfile @@ -1,6 +1,8 @@ -@INCLUDE = "$(TOPDIR)/doclib/Doxyfile.global" +@INCLUDE = "$(TOPDIR)/doclib/Doxyfile.global" -PROJECT_NAME = libPackets -TAGFILES = "$(TOPDIR)/Utils/doc/Utils.tag" +PROJECT_NAME = libPackets +TAGFILES = "$(TOPDIR)/Utils/doc/Utils.tag" GENERATE_TAGFILE = doc/Packets.tag -INPUT = . DefaultBundle +INPUT = . DefaultBundle MPEG_DVBBundle + +EXAMPLE_PATH = . DefaultBundle diff --git a/Packets/MPEG_DVBBundle/DSMCCSection.cc b/Packets/MPEG_DVBBundle/DSMCCSection.cc new file mode 100644 index 0000000..0a4b6a2 --- /dev/null +++ b/Packets/MPEG_DVBBundle/DSMCCSection.cc @@ -0,0 +1,83 @@ +// $Id: EthernetPacket.cc 299 2007-07-10 21:23:49Z g0dil $ +// +// 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. + +// Definition of non-inline non-template functions + +#include "DSMCCSection.hh" +//#include "DSMCCSection.ih" + +// Custom includes +#include + +#define prefix_ +///////////////////////////////cc.p//////////////////////////////////////// + +//namespace { +// senf::PacketRegistry::RegistrationProxy +// registerEthVLanPacket(0x8100); +//} + + +prefix_ void senf::DSMCCSectionType::dump(packet p, std::ostream & os) +{ + os << "DSMCC Section:\n" + << std::hex + << " table_id: 0x" << unsigned(p->table_id()) << "\n" + << " section_syntax_indicator: " << p->ssi() << "\n" + << " private_indicator: " << p->pi() << "\n" + << " reserved_1: " << p->reserved_1() << "\n" + << std::dec + << " section_length: " << p->sec_length() << "\n" + << std::hex + << " table_id_extension: " << p->tabel_id_extension() << "\n" + << " reserved_2: " << p->reserved_2() << "\n" + << " version_number: " << p->version_num() << "\n" + << " current_next_indicator: " << p->curr_next_indicator() << "\n" + << " section_number: " << unsigned(p->sec_num()) << "\n" + << " last_section_number: " << unsigned(p->last_sec_num()) << "\n" + << std::dec + << " CRC: " << unsigned(p->crc()) << "\n"; +} + +prefix_ senf::PacketParserBase::size_type senf::DSMCCSectionType::initSize() +{ + return initHeadSize() + 32/8; +} + +prefix_ senf::PacketParserBase::size_type senf::DSMCCSectionType::initHeadSize() +{ + return (8+1+1+2+12+16+2+5+1+8+8) / 8; +} + +///////////////////////////////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/Packets/MPEG_DVBBundle/DSMCCSection.hh b/Packets/MPEG_DVBBundle/DSMCCSection.hh new file mode 100644 index 0000000..66c231e --- /dev/null +++ b/Packets/MPEG_DVBBundle/DSMCCSection.hh @@ -0,0 +1,107 @@ +// $Id: EthernetPacket.hh 299 2007-07-10 21:23:49Z g0dil $ +// +// 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. + +#ifndef HH_DSMCCSection_ +#define HH_DSMCCSection_ 1 + +// Custom includes +#include +#include "Packets/PacketType.hh" +#include "Packets/ParseInt.hh" +#include "Packets/PacketRegistry.hh" +#include "Packets/PacketParser.hh" + +//#include "DSMCCSection.mpp" +///////////////////////////////hh.p//////////////////////////////////////// + +namespace senf { + + struct Parse_DSMCCSection : public PacketParserBase + { + SENF_PACKET_PARSER_INIT(Parse_DSMCCSection); + + /////////////////////////////////////////////////////////////////////////// + + typedef Parse_UInt8 Parse_table_id; + typedef Parse_Flag < 0 > Parse_ssi; // section_syntax_indicator + typedef Parse_Flag < 1 > Parse_pi; // private_indicator + typedef Parse_UIntField < 2, 4 > Parse_reserved_1; + typedef Parse_UIntField < 4, 16 > Parse_sec_length; + typedef Parse_UIntField < 0, 2 > Parse_reserved_2; + typedef Parse_UIntField < 2, 7 > Parse_version_num; + typedef Parse_Flag < 7 > Parse_curr_next_indicator; + + SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS( + ((Field ) ( table_id, Parse_table_id )) + ((OverlayField) ( ssi, Parse_ssi )) + ((OverlayField) ( pi, Parse_pi )) + ((OverlayField) ( reserved_1, Parse_reserved_1 )) + ((Field ) ( sec_length, Parse_sec_length )) + ((Field ) ( tabel_id_extension, Parse_UInt16 )) + ((OverlayField) ( reserved_2, Parse_reserved_2 )) + ((OverlayField) ( version_num, Parse_version_num )) + ((Field ) ( curr_next_indicator, Parse_curr_next_indicator )) + ((Field ) ( sec_num, Parse_UInt8 )) + ((Field ) ( last_sec_num, Parse_UInt8 )) + ); + + Parse_UInt32 crc() const { return parse( data().size()-4 ); } + }; + + struct DSMCCSectionType + : public PacketTypeBase, + public PacketTypeMixin + { + typedef PacketTypeMixin mixin; + typedef ConcretePacket packet; + typedef Parse_DSMCCSection parser; + + using mixin::nextPacketRange; +// using mixin::nextPacketType; + using mixin::init; + + static void dump(packet p, std::ostream & os); + + static PacketParserBase::size_type initSize(); + static PacketParserBase::size_type initHeadSize(); + }; + + typedef DSMCCSectionType::packet DSMCCSection; +} + + +///////////////////////////////hh.e//////////////////////////////////////// +//#include "DSMCCSection.cci" +//#include "DSMCCSection.ct" +//#include "DSMCCSection.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/Packets/MPEG_DVBBundle/DatagramSection.cc b/Packets/MPEG_DVBBundle/DatagramSection.cc new file mode 100644 index 0000000..40b9d8e --- /dev/null +++ b/Packets/MPEG_DVBBundle/DatagramSection.cc @@ -0,0 +1,90 @@ +// $Id: EthernetPacket.cc 299 2007-07-10 21:23:49Z g0dil $ +// +// 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. + +// Definition of non-inline non-template functions + +#include "DatagramSection.hh" +//#include "DatagramSection.ih" + +// Custom includes +#include + +#define prefix_ +///////////////////////////////cc.p//////////////////////////////////////// + +//namespace { +// senf::PacketRegistry::RegistrationProxy +// registerEthVLanPacket(0x8100); +//} + + +prefix_ void senf::DatagramSectionType::dump(packet p, std::ostream & os) +{ + os << "Datagram Section (MPE):\n" + << std::hex + << " table_id: 0x" << unsigned(p->table_id()) << "\n" + << " section_syntax_indicator: " << p->ssi() << "\n" + << " private_indicator: " << p->pi() << "\n" + << " reserved_1: " << p->reserved_1() << "\n" + << std::dec + << " section_length: " << p->sec_length() << "\n" + << std::hex + << " MAC_address_6: " << unsigned(p->mac_addr_6()) << "\n" + << " MAC_address_5: " << unsigned(p->mac_addr_5()) << "\n" + << " reserved_2: " << p->reserved_2() << "\n" + << " payload_scrambling_control: " << p->payload_scrmbl_ctrl() << "\n" + << " address_scrambling_control: " << p-> addr_scrmbl_ctrl() << "\n" + << " LLC_SNAP_flag: " << p->llc_snap_flag() << "\n" + << " current_next_indicator: " << p->curr_next_indicator() << "\n" + << " section_number: " << unsigned(p->sec_num()) << "\n" + << " last_section_number: " << unsigned(p->last_sec_num()) << "\n" + << " MAC_address_4: " << unsigned(p->mac_addr_4()) << "\n" + << " MAC_address_3: " << unsigned(p->mac_addr_3()) << "\n" + << " MAC_address_2: " << unsigned(p->mac_addr_2()) << "\n" + << " MAC_address_1: " << unsigned(p->mac_addr_1()) << "\n" + << std::dec + << " CRC: " << unsigned(p->crc()) << "\n"; +} + +prefix_ senf::PacketParserBase::size_type senf::DatagramSectionType::initSize() +{ + return initHeadSize() + 32/8; +} + +prefix_ senf::PacketParserBase::size_type senf::DatagramSectionType::initHeadSize() +{ + return (8+1+1+2+12+8+8+2+2+2+1+1+8+8+8+8+8+8) / 8; +} + +///////////////////////////////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/Packets/MPEG_DVBBundle/DatagramSection.hh b/Packets/MPEG_DVBBundle/DatagramSection.hh new file mode 100644 index 0000000..69bf4ca --- /dev/null +++ b/Packets/MPEG_DVBBundle/DatagramSection.hh @@ -0,0 +1,115 @@ +// $Id: EthernetPacket.hh 299 2007-07-10 21:23:49Z g0dil $ +// +// 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. + +#ifndef HH_DatagramSection_ +#define HH_DatagramSection_ 1 + +// Custom includes +#include +#include "Packets/PacketType.hh" +#include "Packets/ParseInt.hh" +#include "Packets/PacketRegistry.hh" +#include "Packets/PacketParser.hh" +#include "Packets/MPEG_DVBBundle/DSMCCSection.hh" + + +//#include "DatagramSection.mpp" +///////////////////////////////hh.p//////////////////////////////////////// + +namespace senf { + + struct Parse_DatagramSection : public Parse_DSMCCSection + { + //SENF_PACKET_PARSER_NO_INIT(Parse_DatagramSection); + Parse_DatagramSection(data_iterator i, state_type s) : senf::Parse_DSMCCSection(i,s) {} + + /////////////////////////////////////////////////////////////////////////// + + typedef Parse_UIntField < 2, 4 > Parse_payload_scrmbl_ctrl; + typedef Parse_UIntField < 4, 6 > Parse_addr_scrmbl_ctrl; + typedef Parse_Flag < 6 > Parse_llc_snap_flag; + + SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS_OFFSET(Parse_DSMCCSection::fixed_bytes, + ((Field ) ( mac_addr_4, Parse_UInt8 )) + ((Field ) ( mac_addr_3, Parse_UInt8 )) + ((Field ) ( mac_addr_2, Parse_UInt8 )) + ((Field ) ( mac_addr_1, Parse_UInt8 )) + ); + + Parse_UInt8 mac_addr_6() const { return parse( 3 ); } + Parse_UInt8 mac_addr_5() const { return parse( 4 ); } + Parse_payload_scrmbl_ctrl payload_scrmbl_ctrl() const { + return parse( 5 ); + } + Parse_addr_scrmbl_ctrl addr_scrmbl_ctrl() const { + return parse( 5 ); + } + Parse_llc_snap_flag llc_snap_flag() const { + return parse( 5 ); + } + + void init() + { + Parse_DSMCCSection::init(); + defaultInit(); + } + }; + + struct DatagramSectionType + : public DSMCCSectionType, + public PacketTypeMixin + { + typedef PacketTypeMixin mixin; + typedef ConcretePacket packet; + typedef Parse_DatagramSection parser; + + using mixin::nextPacketRange; +// using mixin::nextPacketType; + //using mixin::initSize; + using mixin::init; + + static void dump(packet p, std::ostream & os); + + static PacketParserBase::size_type initSize(); + static PacketParserBase::size_type initHeadSize(); + }; + + typedef DatagramSectionType::packet DatagramSection; +} + + +///////////////////////////////hh.e//////////////////////////////////////// +//#include "DatagramSection.cci" +//#include "DatagramSection.ct" +//#include "DatagramSection.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/Packets/MPEG_DVBBundle/SConscript b/Packets/MPEG_DVBBundle/SConscript new file mode 100644 index 0000000..fde1e8c --- /dev/null +++ b/Packets/MPEG_DVBBundle/SConscript @@ -0,0 +1,14 @@ +# -*- python -*- + +Import('env') +import SENFSCons, glob + +########################################################################### + +sources = SENFSCons.GlobSources() + +SENFSCons.StandardTargets(env) + +SENFSCons.Object(env, target = 'MPEG_DVBBundle', sources=sources, + LIBS = ['Packets', 'Socket', 'Utils']) + diff --git a/Packets/PacketParser.hh b/Packets/PacketParser.hh index 21858ba..6c40b2f 100644 --- a/Packets/PacketParser.hh +++ b/Packets/PacketParser.hh @@ -325,27 +325,11 @@ namespace senf { These macros simplify providing the above defined interface. A typical packet declaration using these macros has the following form (This is a concrete example from the definition of - the ethernet packet in DefaultBundle//EthernetPacket.hh) - \code - struct Parse_EthVLan : public senf::PacketParserBase - { - SENF_PACKET_PARSER_INIT(Parse_EthVLan); - - // //////////////////////////////////////////////////////////////////////// - - typedef senf::Parse_UIntField < 0, 3 > Parse_Priority; - typedef senf::Parse_Flag < 3 > Parse_CFI; - typedef senf::Parse_UIntField < 4, 16 > Parse_VLanId; - typedef senf::Parse_UInt16 Parse_Type; - - SENF_PACKET_PARSER_DEFINE_FIXED_FIELDS( - ((OverlayField)( priority, Parse_Priority )) - ((OverlayField)( cfi, Parse_CFI )) - ((Field )( vlanId, Parse_VLanId )) - ((Field )( type, Parse_Type )) - ); - }; - \endcode + the ethernet packet in DefaultBundle/EthernetPacket.hh) + + \dontinclude EthernetPacket.hh + \skipline struct Parse_EthVLan : public PacketParserBase + \until }; The macros take care of the following: \li They define the accessor functions returning parsers of the given type. diff --git a/Socket/DVBProtocol.cc b/Socket/DVBProtocol.cc new file mode 100644 index 0000000..4a018be --- /dev/null +++ b/Socket/DVBProtocol.cc @@ -0,0 +1,84 @@ +// $Id: UDPProtocol.cc 296 2007-07-10 20:39:34Z g0dil $ +// +// 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 xxx + */ + +#include "DVBProtocol.hh" +//#include "DVBProtocol.ih" + +// Custom includes +#include +#include +#include +#include +#include +#include "SocketHandle.hh" + +//#include "DVBProtocol.mpp" +#define prefix_ +///////////////////////////////cc.p//////////////////////////////////////// + + + +prefix_ void senf::DVBProtocol::setBufferSize(unsigned long size) + const +{ + if (::ioctl(body().fd(), DMX_SET_BUFFER_SIZE, size) < 0) + throw SystemException(errno); +} + +prefix_ void senf::DVBProtocol::startFiltering() + const +{ + if (::ioctl(body().fd(), DMX_START) < 0) + throw SystemException(errno); +} + +prefix_ void senf::DVBProtocol::stopFiltering() + const +{ + if (::ioctl(body().fd(), DMX_STOP) < 0) + throw SystemException(errno); +} + +prefix_ bool senf::DVBProtocol::eof() + const +{ + return false; +} + +///////////////////////////////cc.e//////////////////////////////////////// +#undef prefix_ +//#include "DVBProtocol.mpp" + + +// 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.hh b/Socket/DVBProtocol.hh new file mode 100644 index 0000000..d6ab916 --- /dev/null +++ b/Socket/DVBProtocol.hh @@ -0,0 +1,83 @@ +// $Id: DVBProtocol.hh 296 2007-07-10 20:39:34Z g0dil $ +// +// 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 DVBProtocol public header + */ + +#ifndef HH_DVBProtocol_ +#define HH_DVBProtocol_ 1 + +#include + +// Custom includes +#include "SocketProtocol.hh" +#include "INetAddressing.hh" + +//#include "DVBProtocol.mpp" +///////////////////////////////hh.p//////////////////////////////////////// + +namespace senf { + + /// \addtogroup protocol_facets_group + /// @{ + + /** xxx + */ + class DVBProtocol + : public virtual SocketProtocol + { + public: + void setBufferSize(unsigned long size) const; + + void startFiltering() const; + void stopFiltering() const; + + ///\name Abstract Interface Implementation + ///@{ + + //unsigned available() const; + bool eof() const; + + ///@} + + + }; + +} + +///////////////////////////////hh.e//////////////////////////////////////// +//#include "DVBProtocol.cci" +//#include "DVBProtocol.ct" +//#include "DVBProtocol.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/DVBSectionHandle.cc b/Socket/DVBSectionHandle.cc new file mode 100644 index 0000000..a5dce92 --- /dev/null +++ b/Socket/DVBSectionHandle.cc @@ -0,0 +1,107 @@ +// $Id: UDPSocketHandle.cc 296 2007-07-10 20:39:34Z g0dil $ +// +// 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 xxx + */ + +#include "DVBSectionHandle.hh" +//#include "DVBSectionHandle.ih" + +// Custom includes +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Utils/Exception.hh" + +//#include "DVBSectionHandle.mpp" +#define prefix_ +///////////////////////////////cc.p//////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////// +// senf::DVBSectionProtocol + +prefix_ void senf::DVBSectionProtocol::init_client() + const +{ + int fd = open("/dev/dvb/adapter0/demux0", O_RDONLY | O_NONBLOCK); + if (fd < 0) + throw SystemException(errno); + body().fd(fd); +} + +prefix_ unsigned senf::DVBSectionProtocol::available() + const +{ + return 4096; +} + +prefix_ std::auto_ptr senf::DVBSectionProtocol::clone() + const +{ + return std::auto_ptr(new DVBSectionProtocol()); +} + + +prefix_ void senf::DVBSectionProtocol::setSectionFilter( + unsigned short pid, + unsigned char table_id) + 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 ); +} + + +prefix_ void senf::DVBSectionProtocol::setSectionFilter(struct dmx_sct_filter_params *filter) + const +{ + if (::ioctl(body().fd(), DMX_SET_FILTER, filter) < 0) + throw SystemException(errno); +} + +///////////////////////////////cc.e//////////////////////////////////////// +#undef prefix_ +//#include "DVBSectionHandle.mpp" + + +// 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/DVBSectionHandle.hh b/Socket/DVBSectionHandle.hh new file mode 100644 index 0000000..2fdf84c --- /dev/null +++ b/Socket/DVBSectionHandle.hh @@ -0,0 +1,110 @@ +// $Id: UDPSocketHandle.hh 296 2007-07-10 20:39:34Z g0dil $ +// +// 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: diff --git a/senfscons/SENFSCons.py b/senfscons/SENFSCons.py index 9e8313b..de0dbb6 100644 --- a/senfscons/SENFSCons.py +++ b/senfscons/SENFSCons.py @@ -343,7 +343,7 @@ def Objects(env, sources, testSources = None, LIBS = [], OBJECTS = []): # generated) by the given XSLT stylesheet. Since the HTML # generated by doxygen is broken, we first filter the code through # HTML-\c tidy and filter out some error messages. -# \li If xml output is generatedwe create files \c bug.xmli and \c +# \li If xml output is generated we create files \c bug.xmli and \c # todo.xmli which contain all bugs and todo items specified in the # sources. The format of these files is much more suited to # postprocessing and is a more database like format as the doxygen