EthernetAnnotator.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 IH_SENF_Ext_NetEmu_Ethernet_EthernetAnnotator_
18 #define IH_SENF_Ext_NetEmu_Ethernet_EthernetAnnotator_ 1
19 
20 // Custom includes
23 
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 
26 namespace senf {
27 namespace emu {
28 
29  typedef std::function<void (senf::EthernetPacket const & eth)> HandleEthPkt;
30 
33  {
35 
36  public:
39 
40  EthernetAnnotator(bool rxMode, bool mmapMode, senf::MACAddress const & id_ = senf::MACAddress::None);
41 
42  void id(MACAddress const & id);
43  MACAddress const & id() const;
44 
45  void promisc(bool p);
46  void insertTag(VLanId const & pvid);
47  void removeTag(VLanId const & pvid);
48  void clearTag();
49  void annotate(bool a);
50  bool annotate() const;
51 
52  std::uint32_t vlanMismatch();
53 
54  private:
55  void requestRx();
56  void requestRxMMAP();
57  void requestRxMMAPpromisc();
58  void requestTx();
59 
60  void netemu_annotations(senf::EthernetPacket const & eth);
61 
62  void handle_pkt_dummy(senf::EthernetPacket const & eth);
63  void handle_pkt_dummy_annotate(senf::EthernetPacket const & eth);
64  void handle_pkt_insert_tag(senf::EthernetPacket const & eth);
65  void handle_pkt_remove_tag(senf::EthernetPacket const & eth);
66 
67  MACAddress id_;
68  VLanId pvid_;
69  std::uint32_t vlanMismatch_;
70  HandleEthPkt handle_pkt;
71  bool annotate_;
72  bool rxMode_;
73  bool mmapMode_;
74  };
75 }}
76 
77 //-/////////////////////////////////////////////////////////////////////////////////////////////////
78 #endif
79 
80 
81 // Local Variables:
82 // mode: c++
83 // fill-column: 100
84 // comment-column: 40
85 // c-file-style: "senf"
86 // indent-tabs-mode: nil
87 // ispell-local-dictionary: "american"
88 // compile-command: "scons -u test"
89 // End:
static MACAddress const None
EthernetAnnotator(bool rxMode, bool mmapMode, senf::MACAddress const &id_=senf::MACAddress::None)
ppi::connector::ActiveOutput< senf::EthernetPacket > output
void insertTag(VLanId const &pvid)
MACAddress const & id() const
ppi::connector::PassiveInput< senf::EthernetPacket > input
void removeTag(VLanId const &pvid)
#define SENF_PPI_MODULE(name)
std::function< void(senf::EthernetPacket const &eth)> HandleEthPkt
ConcretePacket< EthernetPacketType > EthernetPacket