TAPEthernetInterface.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 TAPEthernetInterface internal header */
16 
17 #ifndef IH_SENF_Ext_NetEmu_TAPEthernetInterface_
18 #define IH_SENF_Ext_NetEmu_TAPEthernetInterface_ 1
19 
20 // Custom includes
21 #include <senf/Socket/Protocols/Raw/TunTapSocketHandle.hh>
22 #include <senf/PPI/SocketSink.hh>
23 #include <senf/PPI/Jack.hh>
24 #include <senf/Ext/NetEmu/config.hh>
25 #include <senf/Ext/NetEmu/Ethernet/EthernetAnnotator.hh>
26 
27 //-/////////////////////////////////////////////////////////////////////////////////////////////////
28 
29 namespace senf {
30 namespace emu {
31 
32  class TAPEthernetInterface;
33 
34 namespace detail {
35 
36  /** \brief Internal: Hardware Ethernet interface PPI network */
37  struct TAPEthernetInterfaceNet
38  {
39  TapSocketHandle socket;
40  senf::ppi::module::ActiveSocketSource<senf::ppi::DgramReader<EthernetPacket, SENF_EMU_MAXMTU> > source;
41  senf::ppi::module::PassiveSocketSink<> sink;
42  std::string dev_;
43  EthernetController ctrl_;
44 
45  EthernetAnnotator annotatorRx_;
46  EthernetAnnotator annotatorTx_;
47 
48  ppi::connector::ActiveOutputJack<EthernetPacket> netOutput;
49  ppi::connector::PassiveInputJack<EthernetPacket> netInput;
50 
51  TAPEthernetInterfaceNet(std::string const & device);
52 
53  TAPEthernetInterface & self();
54  TAPEthernetInterface const & self() const;
55 
56  void assignSockets(bool on);
57  };
58 
59 }}}
60 
61 //-/////////////////////////////////////////////////////////////////////////////////////////////////
62 #endif
63 
64 
65 // Local Variables:
66 // mode: c++
67 // fill-column: 100
68 // comment-column: 40
69 // c-file-style: "senf"
70 // indent-tabs-mode: nil
71 // ispell-local-dictionary: "american"
72 // compile-command: "scons -u test"
73 // End: