MCSInfo.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 
14 #ifndef HH_SENF_Packets_80211Bundle_MCSInfo_
15 #define HH_SENF_Packets_80211Bundle_MCSInfo_ 1
16 
17 // Custom includes
18 #include <string>
19 #include <vector>
20 #include <boost/cstdint.hpp>
21 
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
23 namespace senf {
24 
25  // http://mcsindex.com/
26  struct WLAN_MCSInfo
27  {
28  static constexpr unsigned NUM_STREAMS = 4;
29  static constexpr unsigned NUM_HT_INDEX = 8;
30  static constexpr unsigned NUM_VHT_INDEX = 10;
31  static constexpr unsigned MAX_INDEX = 12;
32 
33  struct Info
34  {
35  std::string coding;
36  unsigned rate[8];
37  short rssi[4];
38  std::uint8_t index;
39  std::uint8_t streams;
40  };
41 
42  static std::vector<Info> getInfos();
43  static unsigned getRate(std::uint8_t mcsIndex, unsigned bandwidth, bool shortGI);
44  static unsigned getRate(std::uint8_t index, std::uint8_t streams, unsigned bandwidth, bool shortGI);
45 
46  static std::uint8_t toHTIndex(std::uint8_t index, std::uint8_t streams);
47  static std::pair<std::uint8_t,std::uint8_t> fromHTIndex(std::uint8_t mcsIndex);
48  static std::uint8_t toBandwidthIndex(unsigned bandwidth, bool shortGI = false);
49  static unsigned fromBandwidthIndex(std::uint8_t bandwidthIndex);
50 
51  };
52 }
53 
54 //-/////////////////////////////////////////////////////////////////////////////////////////////////
55 //#include "MCSInfo.cci"
56 //#include "MCSInfo.ct"
57 //#include "MCSInfo.cti"
58 #endif
static unsigned getRate(std::uint8_t mcsIndex, unsigned bandwidth, bool shortGI)
Definition: MCSInfo.cc:89
static constexpr unsigned NUM_HT_INDEX
Definition: MCSInfo.hh:29
std::uint8_t index
Definition: MCSInfo.hh:38
static std::pair< std::uint8_t, std::uint8_t > fromHTIndex(std::uint8_t mcsIndex)
Definition: MCSInfo.cc:111
static constexpr unsigned MAX_INDEX
Definition: MCSInfo.hh:31
std::string coding
Definition: MCSInfo.hh:35
static constexpr unsigned NUM_STREAMS
Definition: MCSInfo.hh:28
std::uint8_t streams
Definition: MCSInfo.hh:39
static std::uint8_t toHTIndex(std::uint8_t index, std::uint8_t streams)
Definition: MCSInfo.cc:104
static std::vector< Info > getInfos()
Definition: MCSInfo.cc:84
static constexpr unsigned NUM_VHT_INDEX
Definition: MCSInfo.hh:30
static std::uint8_t toBandwidthIndex(unsigned bandwidth, bool shortGI=false)
Definition: MCSInfo.cc:116
static unsigned fromBandwidthIndex(std::uint8_t bandwidthIndex)
Definition: MCSInfo.cc:132