A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
30
namespace
ns3 {
31
32
Wifi80211pHelper::Wifi80211pHelper
()
33
{
34
}
35
36
Wifi80211pHelper::~Wifi80211pHelper
()
37
{
38
}
39
40
Wifi80211pHelper
41
Wifi80211pHelper::Default
(
void
)
42
{
43
Wifi80211pHelper
helper;
44
helper.
SetStandard
(
WIFI_PHY_STANDARD_80211_10MHZ
);
45
helper.
SetRemoteStationManager
(
"ns3::ConstantRateWifiManager"
,
46
"DataMode"
,
StringValue
(
"OfdmRate6MbpsBW10MHz"
),
47
"ControlMode"
,
StringValue
(
"OfdmRate6MbpsBW10MHz"
));
48
return
helper;
49
}
50
51
void
52
Wifi80211pHelper::SetStandard
(
enum
WifiPhyStandard
standard)
53
{
54
if
((standard ==
WIFI_PHY_STANDARD_80211a
) || (standard ==
WIFI_PHY_STANDARD_80211_10MHZ
))
55
{
56
WifiHelper::SetStandard
(standard);
57
}
58
else
59
{
60
NS_FATAL_ERROR
(
"802.11p only use 802.11 standard with 10MHz or 20MHz"
);
61
}
62
}
63
64
65
void
66
Wifi80211pHelper::EnableLogComponents
(
void
)
67
{
68
WifiHelper::EnableLogComponents
();
69
70
LogComponentEnable
(
"OcbWifiMac"
,
LOG_LEVEL_ALL
);
71
LogComponentEnable
(
"VendorSpecificAction"
,
LOG_LEVEL_ALL
);
72
}
73
74
NetDeviceContainer
75
Wifi80211pHelper::Install
(
const
WifiPhyHelper
&phyHelper,
const
WifiMacHelper
&macHelper,
NodeContainer
c)
const
76
{
77
bool
isWaveMacHelper =
false
;
78
try
79
{
80
const
QosWaveMacHelper
& qosMac =
dynamic_cast<
const
QosWaveMacHelper
&
>
(macHelper);
81
isWaveMacHelper =
true
;
82
// below check will never fail, just used for survive from
83
// gcc warn "-Wunused-but-set-variable"
84
if
(&qosMac == 0)
85
{
86
NS_FATAL_ERROR
(
"it could never get here"
);
87
}
88
}
89
catch
(
const
std::bad_cast &)
90
{
91
92
}
93
94
try
95
{
96
const
NqosWaveMacHelper
& nqosMac =
dynamic_cast<
const
NqosWaveMacHelper
&
>
(macHelper);
97
isWaveMacHelper =
true
;
98
if
(&nqosMac == 0)
99
{
100
NS_FATAL_ERROR
(
"it could never get here"
);
101
}
102
}
103
catch
(
const
std::bad_cast &)
104
{
105
106
}
107
108
if
(!isWaveMacHelper)
109
{
110
NS_FATAL_ERROR
(
"the macHelper should be either QosWaveMacHelper or NqosWaveMacHelper"
111
", or should be the subclass of QosWaveMacHelper or NqosWaveMacHelper"
);
112
}
113
114
return
WifiHelper::Install
(phyHelper, macHelper, c);
115
}
116
117
}
// namespace ns3
wifi-80211p-helper.h
ns3::Wifi80211pHelper
helps to create wifi 802.11p objects of WifiNetDevice class
Definition:
wifi-80211p-helper.h:38
ns3::Wifi80211pHelper::Wifi80211pHelper
Wifi80211pHelper()
Definition:
wifi-80211p-helper.cc:32
ns3::WifiHelper::SetRemoteStationManager
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:73
ns3::StringValue
hold variables of type string
Definition:
string.h:19
ns3::WifiPhyHelper
create PHY objects
Definition:
wifi-helper.h:46
ns3::Wifi80211pHelper::SetStandard
virtual void SetStandard(enum WifiPhyStandard standard)
Definition:
wifi-80211p-helper.cc:52
ns3::WIFI_PHY_STANDARD_80211_10MHZ
OFDM PHY for the 5 GHz band (Clause 17 with 10 MHz channel bandwidth)
Definition:
wifi-phy-standard.h:39
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition:
fatal-error.h:72
ns3::WifiHelper::Install
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
Definition:
wifi-helper.cc:102
ns3::WifiPhyStandard
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
Definition:
wifi-phy-standard.h:30
ns3::Wifi80211pHelper::~Wifi80211pHelper
virtual ~Wifi80211pHelper()
Definition:
wifi-80211p-helper.cc:36
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition:
net-device-container.h:41
ns3::WifiHelper::SetStandard
virtual void SetStandard(enum WifiPhyStandard standard)
Definition:
wifi-helper.cc:96
ns3::QosWaveMacHelper
Definition:
wave-mac-helper.h:86
ns3::Wifi80211pHelper::Install
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &macHelper, NodeContainer c) const
Definition:
wifi-80211p-helper.cc:75
ns3::WIFI_PHY_STANDARD_80211a
OFDM PHY for the 5 GHz band (Clause 17)
Definition:
wifi-phy-standard.h:33
ns3::NodeContainer
keep track of a set of node pointers.
Definition:
node-container.h:38
ns3::Wifi80211pHelper::Default
static Wifi80211pHelper Default(void)
Definition:
wifi-80211p-helper.cc:41
ns3::WifiMacHelper
create MAC objects
Definition:
wifi-helper.h:68
ns3::NqosWaveMacHelper
Definition:
wave-mac-helper.h:31
wave-mac-helper.h
ns3::WifiHelper::EnableLogComponents
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement.
Definition:
wifi-helper.cc:142
ns3::LOG_LEVEL_ALL
Definition:
log.h:90
ns3::Wifi80211pHelper::EnableLogComponents
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement.
Definition:
wifi-80211p-helper.cc:66
ns3::LogComponentEnable
void LogComponentEnable(char const *name, enum LogLevel level)
Definition:
log.cc:311
src
wave
helper
wifi-80211p-helper.cc
Generated on Sat Apr 19 2014 14:07:10 for ns-3 by
1.8.6