HardwareDVBInterface.ih
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
14 /** \file
15  \brief HardwareDVBInterface internal header */
16 
17 #ifndef IH_SENF_Ext_NetEmu_Ethernet_HardwareDVBInterface_
18 #define IH_SENF_Ext_NetEmu_Ethernet_HardwareDVBInterface_ 1
19 
20 // Custom includes
21 #include <senf/Socket/Protocols/Raw/PacketSocketHandle.hh>
22 #include <senf/Socket/Protocols/DVB.hh>
23 #include <senf/Packets/MPEGDVBBundle/MPESection.hh>
24 #include <senf/PPI/SocketSource.hh>
25 #include <senf/PPI/SocketSink.hh>
26 #include "ForwardSwitch.hh"
27 
28 //-/////////////////////////////////////////////////////////////////////////////////////////////////
29 
30 namespace senf {
31 namespace emu {
32 
33  class HardwareDVBSenderInterface;
34  class HardwareDVBReceiverInterface;
35 
36 namespace detail {
37 
38  struct HardwareDVBSenderInterfaceNet
39  {
40  HardwareDVBSenderInterfaceNet(std::string const & iface);
41 
42  PacketSocketHandle socket;
43  ppi::module::PassiveSocketSink<ppi::TargetDgramWriter<PacketSocketHandle> > sink;
44  ForwardSwitch forwardSwitch;
45  };
46 
47 
48  class ActiveDVBSocketSource
49  : public ppi::module::Module
50  {
51  SENF_PPI_MODULE( ActiveDVBSocketSource );
52  SENF_LOG_CLASS_AREA();
53 
54  public:
55  ppi::connector::ActiveOutput<EthernetPacket> output;
56 
57  typedef ppi::DgramReader<MPESection> Reader;
58  typedef Reader::Handle Handle;
59 
60  ActiveDVBSocketSource(Handle handle);
61 
62  private:
63  void read(ppi::IOEvent::Event event);
64  void outputMPE2Eth(MPESection mpei);
65 
66  Handle handle_;
67  Reader reader_;
68  ppi::IOEvent event_;
69  };
70 
71  class DVBReceiverInterfaceAnnotator
72  : public senf::ppi::module::Module
73  {
74  SENF_PPI_MODULE(DVBReceiverInterfaceAnnotator);
75 
76  public:
77  ppi::connector::PassiveInput<> input;
78  ppi::connector::ActiveOutput<> output;
79 
80  explicit DVBReceiverInterfaceAnnotator(HardwareDVBReceiverInterface const & interface, DVBSocketController const & dvbSocketCtrl);
81 
82  private:
83  void request();
84 
85  HardwareDVBReceiverInterface const & interface_;
86  DVBSocketController const & dvbSocketCtrl_;
87  senf::ClockService::clock_type lastSNRUpdate_;
88  unsigned snr_;
89  };
90 
91 
92  struct HardwareDVBReceiverInterfaceNet
93  {
94  HardwareDVBReceiverInterfaceNet();
95  void initHandle();
96 
97  HardwareDVBReceiverInterface const & self() const;
98 
99  DVBDemuxSectionHandle dvbSourceHandle;
100  DVBDemuxPESHandle dvbControlHandle;
101  DVBDvrHandle dvbStuffingHandle;
102  ActiveDVBSocketSource dvbSource;
103  DVBReceiverInterfaceAnnotator annotator;
104  ForwardSwitch forwardSwitch;
105  };
106 
107 
108 }}}
109 
110 //-/////////////////////////////////////////////////////////////////////////////////////////////////
111 #endif