TAPEthernetInterface.hh
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 
17 #ifndef HH_SENF_Ext_NetEmu_TAP_TAPEthernetInterface_
18 #define HH_SENF_Ext_NetEmu_TAP_TAPEthernetInterface_ 1
19 
20 // Custom includes
26 
27 #include "TAPEthernetInterface.ih"
28 //-/////////////////////////////////////////////////////////////////////////////////////////////////
29 
30 namespace senf {
31 namespace emu {
32 
42  : private detail::TAPEthernetInterfaceNet,
43  public EthernetInterface,
44  public HardwareInterface
45  {
46  public:
49 
50  TAPEthernetInterface(std::string const & name);
52 
53  std::string const & v_device() const override;
54 
55  unsigned maxBurst() const;
56  void maxBurst(unsigned maxBurst);
57 
58  VLanId const & pvid() const;
59  bool pvid(VLanId const & p, bool accessMode);
60  std::uint32_t vlanMismatchRx();
61  std::uint32_t vlanMismatchTx();
62 
63  protected:
65 
66  virtual void v_enable() override;
67  virtual void v_disable() override;
68 
69  virtual unsigned v_mtu() const override;
70  virtual void v_mtu(unsigned v) override;
71 
72  private:
73  VLanId pvid_;
74  bool accessMode_;
75 
76  void init_sockets();
77  void close_sockets();
78 
79  // interface
80  virtual bool v_enabled() const override;
81  virtual void v_id(MACAddress const & id) override;
82  virtual bool v_annotationMode() const override;
83  virtual void v_annotationMode(bool a) override;
84  virtual bool v_promisc() const override;
85  virtual void v_promisc(bool v) override;
86  virtual void v_mcAdd(MACAddress const & address) override;
87  virtual void v_mcDrop(MACAddress const & address) override;
88  virtual void v_flushRxQueues() override;
89 
90  virtual MACAddress v_id() const override;
91 
92  void dumpMmapStats(std::ostream & os);
93 
94  friend struct detail::TAPEthernetInterfaceNet;
95  friend class TAPAnnotator;
96  };
97 
98 }}
99 
100 //-/////////////////////////////////////////////////////////////////////////////////////////////////
101 #include "TAPEthernetInterface.cci"
102 //#include "TAPEthernetInterface.ct"
103 //#include "TAPEthernetInterface.cti"
104 #endif
105 
106 
107 // Local Variables:
108 // mode: c++
109 // fill-column: 100
110 // comment-column: 40
111 // c-file-style: "senf"
112 // indent-tabs-mode: nil
113 // ispell-local-dictionary: "american"
114 // compile-command: "scons -u test"
115 // End:
std::string const & v_device() const override
WLANController public header.
Hardware Ethernet Interface.
TypedInterfaceDecorator< TAPEthernetInterface, Interface::Decorator > Decorator
virtual void v_disable() override
Called to disable interface.
InterfaceAPIBase public header.
EthernetController & ethController()
Hardware interface base class.
virtual void v_enable() override
Called to enable interface.
TAPEthernetInterface(std::string const &name)
virtual unsigned v_mtu() const override
Called to get interface MTU.
Specialized Interface decorator base-class.
VLanId const & pvid() const
Generic Interface decorator base-class.
Control ethernet interfaces.
EthernetInterface public header.