EmulatedEthernetInterface.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 EmulatedEthernetInterface internal header */
16 
17 #ifndef IH_SENF_Ext_NetEmu_Ethernet_EmulatedEthernetInterface_
18 #define IH_SENF_Ext_NetEmu_Ethernet_EmulatedEthernetInterface_ 1
19 
20 // Custom includes
21 #include <senf/Ext/NetEmu/Packets.hh>
22 
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 
25 namespace senf {
26 namespace emu {
27 
28  class EmulatedEthernetInterface;
29 
30 namespace detail {
31 
32 
33  /** \brief Internal: Input filter of emulated Ethernet interface */
34  class EmulatedEthernetReceiveFilter
35  : public ppi::module::Module
36  {
37  SENF_PPI_MODULE(EmulatedEthernetReceiveFilter);
38  public:
39  ppi::connector::PassiveInput<EthernetPacketHeader> input;
40  ppi::connector::ActiveOutput<EthernetPacket> output;
41 
42  explicit EmulatedEthernetReceiveFilter(EmulatedEthernetInterface & iface);
43 
44  private:
45  void request();
46  EmulatedEthernetInterface & iface_;
47  };
48 
49  /** \brief Internal: Transmit filter of emulated Ethernet interface */
50  class EmulatedEthernetTransmitFilter
51  : public ppi::module::Module
52  {
53  SENF_PPI_MODULE(EmulatedEthernetTransmitFilter);
54  public:
55  ppi::connector::PassiveInput<EthernetPacket> input;
56  ppi::connector::ActiveOutput<EthernetPacketHeader> output;
57 
58  explicit EmulatedEthernetTransmitFilter(EmulatedEthernetInterface & iface);
59 
60  private:
61  void request();
62 
63  EmulatedEthernetInterface & iface_;
64  };
65 
66  /** \brief Internal: Internal PPI Network of emulated Ethernet interface */
67  struct EmulatedEthernetInterfaceNet
68  {
69  // Input chain
70  EmulatedEthernetReceiveFilter receiveFilter_;
71 
72  // Output chain
73  EmulatedEthernetTransmitFilter transmitFilter_;
74 
75  //-/////////////////////////////////////////////////////////////////////////////////////////
76 
77  ppi::connector::PassiveInputJack<EthernetPacketHeader> receiveInput;
78  ppi::connector::ActiveOutputJack<EthernetPacket> receiveOutput;
79 
80  ppi::connector::PassiveInputJack<EthernetPacket> transmitInput;
81  ppi::connector::ActiveOutputJack<EthernetPacketHeader> transmitOutput;
82 
83  EmulatedEthernetInterfaceNet();
84 
85  EmulatedEthernetInterface & self();
86  EmulatedEthernetInterface const & self() const;
87 
88  };
89 
90 }}}
91 
92 //-/////////////////////////////////////////////////////////////////////////////////////////////////
93 #endif
94 
95 
96 // Local Variables:
97 // mode: c++
98 // fill-column: 100
99 // comment-column: 40
100 // c-file-style: "senf"
101 // indent-tabs-mode: nil
102 // ispell-local-dictionary: "american"
103 // compile-command: "scons -u test"
104 // End: