CRDA.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_Ext_NetEmu_WLAN_CRDA_
15 #define HH_SENF_Ext_NetEmu_WLAN_CRDA_ 1
16 
17 // Custom includes
18 #include <boost/functional/hash.hpp>
23 
25 namespace senf {
26 namespace emu {
27 
28 #define DEFAULT_CRDA_SYNC_FILE "/dev/shm/NetEMU-CRDA.sync"
29 #define CRDA_SLAVE_NAME "wiback-crda"
30 
31  class CRDA
32  {
33  public:
34  static CRDA & instance();
35 
37 
38  bool init(bool MasterMode = false, std::string const & filename = DEFAULT_CRDA_SYNC_FILE);
39  int run(int argc, char const ** argv);
40 
41  std::string slaveName() const;
42 
44  senf::emu::RegulatoryDomain const & regDomain() const;
46 
47  bool equalsKernel();
48 
49  unsigned dfsRegionFlag() const;
50 
51  private:
52  CRDA();
53 
54  // Master only
55  void cachedRegDomains(std::ostream & os) const;
56 
57  // Common
58  bool setRegCountry(std::string alpha2Country);
59  void kernelRegDomain(std::ostream & os);
60 
61  // Slave CRDA only
62  void setRegulatory();
63  int setRegulatoryDirect();
64 
65  void help(int exit_status);
66  void debugEnable();
67 
68  boost::scoped_ptr<senf::log::Target> logDebugTarget_;
69  senf::log::SyslogTarget logTarget_;
70  std::string dummyCountry_;
71  senf::emu::RegulatoryDomain worldRegDomain_;
72  senf::emu::RegulatoryDomain currentRegDomain_;
73  unsigned dfsRegionFlag_;
74  std::string syncFilename_;
75  std::string logTag_;
76 
77  // here we keep a cache of known regDomains which we have already pushed into the kernel
78  std::set<senf::emu::RegulatoryDomain> cachedRegDomains_;
79  };
80 }}
81 
83 //#include "CRDA.cci"
84 //#include "CRDA.ct"
85 //#include "CRDA.cti"
86 #endif
bool equalsKernel()
Definition: CRDA.cc:215
Regulatory header.
senf::emu::RegulatoryDomain const & regDomain() const
Definition: CRDA.cc:203
static CRDA & instance()
Definition: CRDA.cc:39
int run(int argc, char const **argv)
Definition: CRDA.cc:383
std::string slaveName() const
Definition: CRDA.cc:45
#define DEFAULT_CRDA_SYNC_FILE
Definition: CRDA.hh:28
WirelessNLController public header.
bool init(bool MasterMode=false, std::string const &filename=DEFAULT_CRDA_SYNC_FILE)
Definition: CRDA.cc:154
senf::console::ScopedDirectory dir
Definition: CRDA.hh:36
senf::emu::RegulatoryDomain const & worldRegDomain() const
Definition: CRDA.cc:209
unsigned dfsRegionFlag() const
Definition: CRDA.cc:51