A Discrete-Event Network Simulator
API
wave-mac-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/boolean.h"
25 #include "wave-mac-helper.h"
26 
27 namespace ns3 {
28 
30 {
31 
32 }
34 {
35 
36 }
39 {
40  NqosWaveMacHelper helper;
41  // We're making non QoS-enabled Wi-Fi MACs here, so we set the
42  // necessary attribute. I've carefully positioned this here so that
43  // someone who knows what they're doing can override with explicit
44  // attributes.
45  helper.SetType ("ns3::OcbWifiMac", "QosSupported", BooleanValue (false));
46  return helper;
47 }
48 void
49 NqosWaveMacHelper::SetType (std::string type,
50  std::string n0, const AttributeValue &v0,
51  std::string n1, const AttributeValue &v1,
52  std::string n2, const AttributeValue &v2,
53  std::string n3, const AttributeValue &v3,
54  std::string n4, const AttributeValue &v4,
55  std::string n5, const AttributeValue &v5,
56  std::string n6, const AttributeValue &v6,
57  std::string n7, const AttributeValue &v7,
58  std::string n8, const AttributeValue &v8,
59  std::string n9, const AttributeValue &v9,
60  std::string n10, const AttributeValue &v10)
61 {
62  if (type.compare ("ns3::OcbWifiMac") != 0)
63  {
64  NS_FATAL_ERROR ("QosWaveMacHelper shall set OcbWifiMac");
65  }
66  WifiMacHelper::SetType ("ns3::OcbWifiMac",
67  n0, v0,
68  n1, v1,
69  n2, v2,
70  n3, v3,
71  n4, v4,
72  n5, v5,
73  n6, v6,
74  n7, v7,
75  n8, v8,
76  n9, v9,
77  n10, v10);
78 }
79 
80 /********** QosWifi80211pMacHelper *********/
82 {
83 }
85 {
86 }
89 {
90  QosWaveMacHelper helper;
91 
92  // We're making QoS-enabled Wi-Fi MACs here, so we set the necessary
93  // attribute. I've carefully positioned this here so that someone
94  // who knows what they're doing can override with explicit
95  // attributes.
96  helper.SetType ("ns3::OcbWifiMac", "QosSupported", BooleanValue (true));
97 
98  return helper;
99 }
100 void
101 QosWaveMacHelper::SetType (std::string type,
102  std::string n0, const AttributeValue &v0,
103  std::string n1, const AttributeValue &v1,
104  std::string n2, const AttributeValue &v2,
105  std::string n3, const AttributeValue &v3,
106  std::string n4, const AttributeValue &v4,
107  std::string n5, const AttributeValue &v5,
108  std::string n6, const AttributeValue &v6,
109  std::string n7, const AttributeValue &v7,
110  std::string n8, const AttributeValue &v8,
111  std::string n9, const AttributeValue &v9,
112  std::string n10, const AttributeValue &v10)
113 {
114  if (type.compare ("ns3::OcbWifiMac") != 0)
115  {
116  NS_FATAL_ERROR ("QosWaveMacHelper shall set OcbWifiMac");
117  }
118  WifiMacHelper::SetType ("ns3::OcbWifiMac",
119  n0, v0,
120  n1, v1,
121  n2, v2,
122  n3, v3,
123  n4, v4,
124  n5, v5,
125  n6, v6,
126  n7, v7,
127  n8, v8,
128  n9, v9,
129  n10, v10);
130 }
131 
132 } // namespace ns3
AttributeValue implementation for Boolean.
Definition: boolean.h:36
Hold a value for an Attribute.
Definition: attribute.h:68
virtual void SetType(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(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue())
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
virtual void SetType(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(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue())
QosWaveMacHelper(void)
Create a QosWaveMacHelper that is used to make life easier when working with Wifi 802...
virtual ~QosWaveMacHelper(void)
Destroy a QosWaveMacHelper.
Qos Wave Mac Helper class.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
NqosWaveMacHelper(void)
Create a NqosWaveMacHelper to make life easier for people who want to work with non-QOS Wave MAC laye...
Nqos Wave Mac Helper class.
virtual void SetType(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(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue())
virtual ~NqosWaveMacHelper(void)
Destroy a NqosWaveMacHelper.
static QosWaveMacHelper Default(void)
Create a mac helper in a default working state.
static NqosWaveMacHelper Default(void)
Create a mac helper in a default working state.