A Discrete-Event Network Simulator
API
wifi-80211p-helper.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 INRIA
4  * Copyright (c) 2009 MIRKO BANCHI
5  * Copyright (c) 2013 Dalian University of Technology
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation;
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
21  * Author: Mirko Banchi <mk.banchi@gmail.com>
22  * Author: Junling Bu <linlinjavaer@gmail.com>
23  */
24 #include "ns3/string.h"
25 #include "ns3/log.h"
26 #include <typeinfo>
27 #include "wave-mac-helper.h"
28 #include "wifi-80211p-helper.h"
29 #include "ns3/unused.h"
30 
31 namespace ns3 {
32 
34 {
35 }
36 
38 {
39 }
40 
43 {
44  Wifi80211pHelper helper;
46  helper.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
47  "DataMode", StringValue ("OfdmRate6MbpsBW10MHz"),
48  "ControlMode",StringValue ("OfdmRate6MbpsBW10MHz"),
49  "NonUnicastMode", StringValue ("OfdmRate6MbpsBW10MHz"));
50  return helper;
51 }
52 
53 void
55 {
56  if ((standard == WIFI_PHY_STANDARD_80211a) || (standard == WIFI_PHY_STANDARD_80211_10MHZ))
57  {
58  WifiHelper::SetStandard (standard);
59  }
60  else
61  {
62  NS_FATAL_ERROR ("802.11p only use 802.11 standard with 10MHz or 20MHz");
63  }
64 }
65 
66 
67 void
69 {
71 
72  LogComponentEnable ("OcbWifiMac", LOG_LEVEL_ALL);
73  LogComponentEnable ("VendorSpecificAction", LOG_LEVEL_ALL);
74 }
75 
77 Wifi80211pHelper::Install (const WifiPhyHelper &phyHelper, const WifiMacHelper &macHelper, NodeContainer c) const
78 {
79  QosWaveMacHelper const * qosMac = dynamic_cast <QosWaveMacHelper const *> (&macHelper);
80  if (qosMac == 0)
81  {
82  NqosWaveMacHelper const * nqosMac = dynamic_cast <NqosWaveMacHelper const *> (&macHelper);
83  if (nqosMac == 0)
84  {
85  NS_FATAL_ERROR ("the macHelper should be either QosWaveMacHelper or NqosWaveMacHelper"
86  ", or should be the subclass of QosWaveMacHelper or NqosWaveMacHelper");
87  }
88  NS_UNUSED (nqosMac);
89  }
90 
91  NS_UNUSED (qosMac);
92  return WifiHelper::Install (phyHelper, macHelper, c);
93 }
94 
95 } // namespace ns3
helps to create wifi 802.11p objects of WifiNetDevice class
void SetRemoteStationManager(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:719
Hold variables of type string.
Definition: string.h:41
create PHY objects
Definition: wifi-helper.h:42
virtual void SetStandard(enum WifiPhyStandard standard)
#define NS_UNUSED(x)
Mark a local variable as unused.
Definition: unused.h:36
OFDM PHY for the 5 GHz band (Clause 17 with 10 MHz channel bandwidth)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:369
holds a vector of ns3::NetDevice pointers
virtual void SetStandard(enum WifiPhyStandard standard)
Definition: wifi-helper.cc:742
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer::Iterator first, NodeContainer::Iterator last) const
Definition: wifi-helper.cc:748
Qos Wave Mac Helper class.
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &macHelper, NodeContainer c) const
OFDM PHY for the 5 GHz band (Clause 17)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
static Wifi80211pHelper Default(void)
create MAC layers for a ns3::WifiNetDevice.
Nqos Wave Mac Helper class.
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement.
Definition: wifi-helper.cc:797
Print everything.
Definition: log.h:112
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement.