A Discrete-Event Network Simulator
API
wifi-80211p-helper.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 INRIA
3  * Copyright (c) 2009 MIRKO BANCHI
4  * Copyright (c) 2013 Dalian University of Technology
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Author: Mirko Banchi <mk.banchi@gmail.com>
21  * Author: Junling Bu <linlinjavaer@gmail.com>
22  */
23 #include "wifi-80211p-helper.h"
24 
25 #include "wave-mac-helper.h"
26 
27 #include "ns3/log.h"
28 #include "ns3/string.h"
29 
30 #include <typeinfo>
31 
32 namespace ns3
33 {
34 
36 {
37 }
38 
40 {
41 }
42 
45 {
46  Wifi80211pHelper helper;
48  helper.SetRemoteStationManager("ns3::ConstantRateWifiManager",
49  "DataMode",
50  StringValue("OfdmRate6MbpsBW10MHz"),
51  "ControlMode",
52  StringValue("OfdmRate6MbpsBW10MHz"),
53  "NonUnicastMode",
54  StringValue("OfdmRate6MbpsBW10MHz"));
55  return helper;
56 }
57 
58 void
60 {
61  if (standard == WIFI_STANDARD_80211p)
62  {
63  WifiHelper::SetStandard(standard);
64  }
65  else
66  {
67  NS_FATAL_ERROR("wrong standard selected!");
68  }
69 }
70 
71 void
73 {
75 
76  LogComponentEnable("OcbWifiMac", LOG_LEVEL_ALL);
77  LogComponentEnable("VendorSpecificAction", LOG_LEVEL_ALL);
78 }
79 
82  const WifiMacHelper& macHelper,
83  NodeContainer c) const
84 {
85  const QosWaveMacHelper* qosMac [[maybe_unused]] =
86  dynamic_cast<const QosWaveMacHelper*>(&macHelper);
87  if (qosMac == nullptr)
88  {
89  const NqosWaveMacHelper* nqosMac [[maybe_unused]] =
90  dynamic_cast<const NqosWaveMacHelper*>(&macHelper);
91  if (nqosMac == nullptr)
92  {
93  NS_FATAL_ERROR("the macHelper should be either QosWaveMacHelper or NqosWaveMacHelper"
94  ", or should be the subclass of QosWaveMacHelper or NqosWaveMacHelper");
95  }
96  }
97 
98  return WifiHelper::Install(phyHelper, macHelper, c);
99 }
100 
101 } // namespace ns3
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Nqos Wave Mac Helper class.
Qos Wave Mac Helper class.
Hold variables of type string.
Definition: string.h:56
helps to create wifi 802.11p objects of WifiNetDevice class
void SetStandard(WifiStandard standard) override
static Wifi80211pHelper Default()
NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &macHelper, NodeContainer c) const override
static void EnableLogComponents()
Helper to enable all WifiNetDevice log components with one statement.
void SetRemoteStationManager(std::string type, Args &&... args)
Helper function used to set the station manager.
Definition: wifi-helper.h:605
virtual void SetStandard(WifiStandard standard)
Definition: wifi-helper.cc:738
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer::Iterator first, NodeContainer::Iterator last) const
Definition: wifi-helper.cc:756
static void EnableLogComponents()
Helper to enable all WifiNetDevice log components with one statement.
Definition: wifi-helper.cc:880
create MAC layers for a ns3::WifiNetDevice.
create PHY objects
Definition: wifi-helper.h:50
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
@ WIFI_STANDARD_80211p
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:305
@ LOG_LEVEL_ALL
Print everything.
Definition: log.h:116