HardwareEthernetInterface.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 HardwareEthernetInterface internal header */
16 
17 #ifndef IH_SENF_Ext_NetEmu_HardwareEthernetInterface_
18 #define IH_SENF_Ext_NetEmu_HardwareEthernetInterface_ 1
19 
20 // Custom includes
21 #include <senf/Socket/Protocols/Raw/MMapPacketSocketHandle.hh>
22 #include <senf/PPI/QueueSocketSourceSink.hh>
23 #include "EthernetAnnotator.hh"
24 
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 
27 namespace senf {
28 namespace emu {
29 
30  class HardwareEthernetInterface;
31 
32 namespace detail {
33 
34  /** \brief Internal: Hardware Ethernet interface PPI network */
35  struct HardwareEthernetInterfaceNet
36  {
37  ConnectedMMapPacketSocketHandle socket;
38 
39  ppi::module::ActiveQueueSocketSource<EthernetPacket> source;
40  ppi::module::PassiveQueueSocketSink<> sink;
41 
42  EthernetAnnotator annotatorRx_;
43  EthernetAnnotator annotatorTx_;
44 
45  ppi::connector::ActiveOutputJack<EthernetPacket> netOutput;
46  ppi::connector::PassiveInputJack<EthernetPacket> netInput;
47 
48  HardwareEthernetInterfaceNet();
49 
50  HardwareEthernetInterface & self();
51  HardwareEthernetInterface const & self() const;
52 
53  void assignSockets(ConnectedMMapPacketSocketHandle & socket);
54 
55  unsigned rcvBuf();
56  void rcvBuf(unsigned);
57  unsigned sndBuf();
58  void sndBuf(unsigned);
59 
60  void setupBPF(senf::MACAddress const & hwAddr, bool srcOnly = true);
61  void clearBPF();
62  };
63 
64 }}}
65 
66 //-/////////////////////////////////////////////////////////////////////////////////////////////////
67 #endif
68 
69 
70 // Local Variables:
71 // mode: c++
72 // fill-column: 100
73 // comment-column: 40
74 // c-file-style: "senf"
75 // indent-tabs-mode: nil
76 // ispell-local-dictionary: "american"
77 // compile-command: "scons -u test"
78 // End: