EmulatedWLANInterface.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 EmulatedWLANInterface internal header */
16 
17 #ifndef IH_SENF_Ext_NetEmu_WLAN_EmulatedWLANInterface_
18 #define IH_SENF_Ext_NetEmu_WLAN_EmulatedWLANInterface_ 1
19 
20 // Custom includes
21 #include <senf/Packets/80211Bundle/RadiotapPacket.hh>
22 #include <senf/Packets/80211Bundle/WLANPacket.hh>
23 #include <senf/Ext/NetEmu/Packets.hh>
24 
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 
27 namespace senf {
28 namespace emu {
29 
30  class EmulatedWLANInterface;
31 
32 namespace detail {
33 
34  /** \brief Internal: Beacon generator for emulated WLAN interface*/
35  class EmulatedWLANBeaconGenerator
36  : public ppi::module::Module
37  {
38  SENF_PPI_MODULE(EmulatedWLANBeaconGenerator);
39  public:
40  ppi::connector::ActiveOutput<> output;
41 
42  explicit EmulatedWLANBeaconGenerator(EmulatedWLANInterface & iface);
43 
44  void beaconInterval(ClockService::clock_type interval);
45  ClockService::clock_type beaconInterval();
46 
47  private:
48  void tick();
49  void init();
50 
51  ppi::IntervalTimer timer_;
52  EmulatedWLANInterface & iface_;
53  WLANPacket_MgtFrame beacon_;
54  };
55 
56  /** \brief Internal: Input filter of emulated WLAN interface */
57  class EmulatedWLANReceiveFilter
58  : public ppi::module::Module
59  {
60  SENF_PPI_MODULE(EmulatedWLANReceiveFilter);
61  public:
62  ppi::connector::PassiveInput<WLANPacketHeader> input;
63  ppi::connector::ActiveOutput<EthernetPacket> output;
64 
65  explicit EmulatedWLANReceiveFilter(EmulatedWLANInterface & iface);
66 
67  private:
68  void request();
69 
70  EmulatedWLANInterface & iface_;
71  };
72 
73  /** \brief Internal: Transmit filter of emulated WLAN interface */
74  class EmulatedWLANTransmitFilter
75  : public ppi::module::Module
76  {
77  SENF_PPI_MODULE(EmulatedWLANTransmitFilter);
78  public:
79  ppi::connector::PassiveInput<EthernetPacket> input;
80  ppi::connector::ActiveOutput<WLANPacketHeader> output;
81  ppi::connector::PassiveInput<WLANPacket_MgtFrame> beaconInput;
82 
83  explicit EmulatedWLANTransmitFilter(EmulatedWLANInterface & iface);
84 
85  private:
86  void request();
87  void beaconRequest();
88 
89  EmulatedWLANInterface & iface_;
90  };
91 
92  /** \brief Internal: Internal PPI Network of emulated WLAN interface */
93  struct EmulatedWLANInterfaceNet
94  {
95  // Input chain
96  EmulatedWLANReceiveFilter receiveFilter_;
97 
98  // Output chain
99  EmulatedWLANTransmitFilter transmitFilter_;
100  EmulatedWLANBeaconGenerator beaconGenerator_;
101 
102  //-/////////////////////////////////////////////////////////////////////////////////////////
103 
104  ppi::connector::PassiveInputJack<WLANPacketHeader> receiveInput;
105  ppi::connector::ActiveOutputJack<EthernetPacket> receiveOutput;
106 
107  ppi::connector::PassiveInputJack<EthernetPacket> transmitInput;
108  ppi::connector::ActiveOutputJack<WLANPacketHeader> transmitOutput;
109 
110  EmulatedWLANInterfaceNet();
111 
112  EmulatedWLANInterface & self();
113  EmulatedWLANInterface const & self() const;
114 
115  void beaconInterval(ClockService::clock_type interval);
116  ClockService::clock_type beaconInterval();
117  };
118 
119 }}}
120 
121 //-/////////////////////////////////////////////////////////////////////////////////////////////////
122 #endif
123 
124 
125 // Local Variables:
126 // mode: c++
127 // fill-column: 100
128 // comment-column: 40
129 // c-file-style: "senf"
130 // indent-tabs-mode: nil
131 // ispell-local-dictionary: "american"
132 // compile-command: "scons -u test"
133 // End: