senf::DVBDemuxSectionHandle handle;
public:
- MySniffer()
+ MySniffer(unsigned short adapter=0, unsigned short device=0)
+ : handle( adapter, device )
{
struct dmx_sct_filter_params sec_filter;
memset(&sec_filter, 0, sizeof (struct dmx_sct_filter_params));
#include "ULEdec.hh"
+#include <linux/dvb/dmx.h>
#include "Packets/PacketData.hh"
#include "Utils/hexdump.hh"
#include "Utils/membind.hh"
#define PID 271
-#define TS_SYNC 0x47
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
-ULEdec::ULEdec()
+ULEdec::ULEdec(unsigned short adapter, unsigned short device)
+ : demuxHandle( adapter, device ), dvrHandle( adapter, device )
{
struct dmx_pes_filter_params pes_filter;
memset(&pes_filter, 0, sizeof (struct dmx_pes_filter_params));
dvrHandle.read( ts_packet.data() );
// Check TS error conditions: sync_byte, transport_error_indicator, scrambling_control.
- if ( (ts_packet->sync_byte() != TS_SYNC) ||
+ if ( (ts_packet->sync_byte() != TRANSPORT_PACKET_SYNC_BYTE) ||
(ts_packet->transport_error_indicator() == true) ||
(ts_packet->transport_scrmbl_ctrl() != 0))
{
// Definition of non-inline non-template functions
-#include <string>
-#include <iostream>
-#include <iomanip>
-#include <sys/ioctl.h>
-#include <linux/dvb/dmx.h>
-
#include "Scheduler/Scheduler.hh"
#include "Packets/MPEGDVBBundle/TransportPacket.hh"
#include "Packets/MPEGDVBBundle/SNDUPacket.hh"
class ULEdec
{
public:
- ULEdec();
+ ULEdec(unsigned short adapter=0, unsigned short device=0);
private:
typedef senf::PacketData::iterator iterator;
BOOST_AUTO_UNIT_TEST(transportPacket_packet)
{
- // TransportStream-Packet containing a MPE encoded section with an IPv6 ping packet,
+ // TransportStream-Packet containing a ULE encoded IPv6 ping packet,
// captured with dvbsnoop
unsigned char data[] = {
0x47, 0x41, 0x0f, 0x1e, 0x00, 0x80, 0x4c, 0x86,
//#include "DVBDemuxHandles.ih"
// Custom includes
-#include <sys/types.h>
+#include <boost/format.hpp>
#include <sys/socket.h>
-#include <iostream>
-#include <string>
#include <sys/ioctl.h>
-#include <linux/sockios.h>
-#include <stdio.h>
#include <fcntl.h>
-
#include "Utils/Exception.hh"
//#include "DVBDemuxHandles.mpp"
///////////////////////////////////////////////////////////////////////////
// senf::DVBDemuxHandles
-prefix_ void senf::DVBDemuxSectionProtocol::init_client()
+prefix_ void senf::DVBDemuxSectionProtocol::init_client(unsigned short adapter, unsigned short device)
const
{
- int fd = open("/dev/dvb/adapter0/demux0", O_RDONLY | O_NONBLOCK);
+ std::string devDemux = str( boost::format(
+ "/dev/dvb/adapter%d/demux%d") % adapter % device);
+ int fd = open(devDemux.c_str(), O_RDONLY | O_NONBLOCK);
if (fd < 0)
throw SystemException(errno);
body().fd(fd);
// ----------------------------------------------------------------
-prefix_ void senf::DVBDemuxPESProtocol::init_client()
+prefix_ void senf::DVBDemuxPESProtocol::init_client(unsigned short adapter, unsigned short device)
const
{
- int fd = open("/dev/dvb/adapter0/demux0", O_RDONLY | O_NONBLOCK);
+ std::string devDemux = str( boost::format(
+ "/dev/dvb/adapter%d/demux%d") % adapter % device);
+ int fd = open(devDemux.c_str(), O_RDONLY | O_NONBLOCK);
if (fd < 0)
throw SystemException(errno);
body().fd(fd);
// ----------------------------------------------------------------
-prefix_ void senf::DVBDvrProtocol::init_client()
+prefix_ void senf::DVBDvrProtocol::init_client(unsigned short adapter, unsigned short device)
const
{
- int fd = open("/dev/dvb/adapter0/dvr0", O_RDONLY | O_NONBLOCK);
+ std::string devDvr = str( boost::format(
+ "/dev/dvb/adapter%d/dvr%d") % adapter % device);
+ int fd = open(devDvr.c_str(), O_RDONLY | O_NONBLOCK);
if (fd < 0)
throw SystemException(errno);
body().fd(fd);
///\name Constructors
///@{
- void init_client() const; ///< xxx
+ void init_client(unsigned short adapter=0, unsigned short device=0) const; ///< xxx
/**< \note This member is implicitly called from the
ProtocolClientSocketHandle::ProtocolClientSocketHandle()
constructor */
///\name Constructors
///@{
- void init_client() const; ///< xxx
+ void init_client(unsigned short adapter=0, unsigned short device=0) const; ///< xxx
/**< \note This member is implicitly called from the
ProtocolClientSocketHandle::ProtocolClientSocketHandle()
constructor */
///\name Constructors
///@{
- void init_client() const; ///< xxx
+ void init_client(unsigned short adapter=0, unsigned short device=0) const; ///< xxx
/**< \note This member is implicitly called from the
ProtocolClientSocketHandle::ProtocolClientSocketHandle()
constructor */
//#include "DVBFrontendHandle.ih"
// Custom includes
-#include <sys/types.h>
+#include <boost/format.hpp>
#include <sys/socket.h>
-#include <iostream>
-#include <string>
#include <sys/ioctl.h>
-#include <linux/sockios.h>
-#include <stdio.h>
#include <fcntl.h>
-#include "Socket/SocketHandle.hh"
-
#include "Utils/Exception.hh"
//#include "DVBFrontendHandle.mpp"
///////////////////////////////////////////////////////////////////////////
// senf::DVBFrontendHandle
-prefix_ void senf::DVBFrontendProtocol::init_client()
+prefix_ void senf::DVBFrontendProtocol::init_client(uint8_t adapter, boost::uint8_t device)
const
{
- int fd = open("/dev/dvb/adapter0/frontend0", O_RDONLY | O_NONBLOCK);
+ std::string devFrontend = str( boost::format(
+ "/dev/dvb/adapter%d/frontend%d") % adapter % device);
+ int fd = open(devFrontend.c_str(), O_RDONLY | O_NONBLOCK);
if (fd < 0)
throw SystemException(errno);
body().fd(fd);
#define HH_DVBFrontendHandle_ 1
// Custom includes
+#include <boost/cstdint.hpp>
+#include <linux/dvb/frontend.h>
#include "Socket/BufferingPolicy.hh"
#include "Socket/FramingPolicy.hh"
#include "Socket/CommunicationPolicy.hh"
#include "Socket/ProtocolClientSocketHandle.hh"
#include "Socket/SocketProtocol.hh"
-#include <linux/dvb/frontend.h>
-
//#include "DVBFrontendHandle.mpp"
///////////////////////////////hh.p////////////////////////////////////////
///\name Constructors
///@{
- void init_client() const; ///< xxx
+ void init_client(boost::uint8_t adapter=0, boost::uint8_t device=0) const; ///< xxx
/**< \note This member is implicitly called from the
ProtocolClientSocketHandle::ProtocolClientSocketHandle()
constructor */