WLANInterface.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_WLAN_WLANInterface_
18 #define HH_SENF_Ext_NetEmu_WLAN_WLANInterface_ 1
19 
20 // Custom includes
22 
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 
25 namespace senf {
26 namespace emu {
27 
28  class WLANModulationParameterRegistry;
29 
30 
32  : public ModulationParameter
33  {
34  public:
36 
38  unsigned index;
39  unsigned streams;
40  bool shortGI;
41 
42  static boost::uint16_t modulationId(Type _type, unsigned _rate, unsigned _bandwidth,
43  unsigned _index, unsigned _streams, bool _shortGI);
44 
45  private:
46  WLANModulationParameter(std::string const & _label, short _minRssi, unsigned _rate,
47  unsigned _bandwidth, Type _type, unsigned _streams=1,
48  unsigned _index=0, bool _shortGI=false);
49 
50  virtual boost::uint16_t v_modulationId() const;
51  virtual ModulationParameter * v_clone() const;
52  virtual void v_dump(std::ostream & os) const;
53  virtual void v_dumpTableHeader(std::ostream & os) const;
54  virtual void v_dumpTableRow(std::ostream & os) const;
55 
57  };
58 
60 
61 
63  : private boost::noncopyable
64  {
65  public:
67  static WLANModulationParameterRegistry _instance;
68  return _instance;
69  }
70 
71  enum GIMatch {Any, Equal, Short, Long };
72 
74  std::string coding;
75  unsigned rate;
76  short rssi;
77  };
78  static std::vector<LegacyModulationInfo> getLegacyModulationInfos11b();
79  static std::vector<LegacyModulationInfo> getLegacyModulationInfosOFDM();
80 
81  WLANModulationParameter const & findModulationById(ModulationParameter::id_t id) const;
82  ModulationParameter::id_t parameterIdByLegacyRate(unsigned rate) const;
83  ModulationParameter::id_t parameterIdByMCS_HT(unsigned htMcsIndex, unsigned bandwidth, bool shortGI) const;
84  ModulationParameter::id_t parameterIdByMCS_VHT(unsigned vhtMcsIndex, unsigned streams, unsigned bandwidth, bool shortGI) const;
85  ModulationParameter::id_t parameterIdAuto() const;
86  ModulationParameter::id_t parameterIdUnknown() const;
87 
88  std::set<ModulationParameter::id_t> parameterIdsByType(ModulationParameter::id_t id, GIMatch giMatch = Any) const;
89  ModulationParameter::id_t parameterIdAsLGI(ModulationParameter::id_t id) const;
90  ModulationParameter::id_t parameterIdAsSGI(ModulationParameter::id_t id) const;
91  ModulationParameter::id_t parameterIdLower(ModulationParameter::id_t id, unsigned diff) const;
92 
93  private:
95 
96  ModulationParameter::id_t registerModulation(WLANModulationParameter & p);
97 
98  typedef boost::unordered_map<ModulationParameter::id_t, WLANModulationParameter> Modulations;
99  Modulations modulations_;
100  boost::unordered_map<boost::uint16_t, ModulationParameter::id_t> idMap_;
101  ModulationParameter::id_t parameterIdAuto_;
102  ModulationParameter::id_t parameterIdUnknown_;
103  };
104 
105 
108  {
109  public:
110  template <class Output, class Input>
111  WLANInterface(Output & output, Input & input);
112 
113  static const boost::uint8_t linkTypeId = 19; // 802.21 link type for IEEE 802.11
114 
116  void modulation(WLANModulationParameter::Type type, unsigned index, unsigned streams);
117  void modulation(WLANModulationParameter::Type type, unsigned value);
118  void modulation(WLANModulationParameter::Type type);
119 
120  unsigned maxNSS() const;
121 
122  protected:
123  void init();
124 
125  private:
126  virtual boost::uint8_t v_linkTypeId() const;
127  };
128 
129 }}
130 
131 //-/////////////////////////////////////////////////////////////////////////////////////////////////
132 //#include "WLANInterface.cci"
133 #include "WLANInterface.ct"
134 //#include "WLANInterface.cti"
135 #endif
136 
137 
138 // Local Variables:
139 // mode: c++
140 // fill-column: 100
141 // comment-column: 40
142 // c-file-style: "senf"
143 // indent-tabs-mode: nil
144 // ispell-local-dictionary: "american"
145 // compile-command: "scons -u test"
146 // End:
WirelessInterfaceAPI public header.
void init()
static boost::uint16_t modulationId(Type _type, unsigned _rate, unsigned _bandwidth, unsigned _index, unsigned _streams, bool _shortGI)
unsigned bandwidth
Bandwidth in KHz.
Wireless modulation parameter.
SENF_CONSOLE_REGISTER_ENUM_MEMBER(DVBModulationParameter, fec_rate_t,(FEC_NONE)(FEC_1_2)(FEC_2_3)(FEC_3_4)(FEC_4_5)(FEC_5_6)(FEC_6_7)(FEC_7_8)(FEC_8_9)(FEC_AUTO)(FEC_3_5)(FEC_9_10))
Interface API base class specialization for wireless interfaces.
unsigned rate
Bitrate in kbit/s.
Receive capable wireless interface base class.
static WLANModulationParameterRegistry & instance()
Transmit capable wireless interface base class.
ModulationParameter::id_t modulation() const
Get current modulation parameter configuration id.