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 {
59  if (type.compare ("ns3::OcbWifiMac") != 0)
60  {
61  NS_FATAL_ERROR ("QosWaveMacHelper shall set OcbWifiMac");
62  }
63  NqosWifiMacHelper::SetType ("ns3::OcbWifiMac",
64  n0, v0,
65  n1, v1,
66  n2, v2,
67  n3, v3,
68  n4, v4,
69  n5, v5,
70  n6, v6,
71  n7, v7);
72 }
73 
74 /********** QosWifi80211pMacHelper *********/
76 {
77 }
79 {
80 }
83 {
84  QosWaveMacHelper helper;
85 
86  // We're making QoS-enabled Wi-Fi MACs here, so we set the necessary
87  // attribute. I've carefully positioned this here so that someone
88  // who knows what they're doing can override with explicit
89  // attributes.
90  helper.SetType ("ns3::OcbWifiMac", "QosSupported", BooleanValue (true));
91 
92  return helper;
93 }
94 void
95 QosWaveMacHelper::SetType (std::string type,
96  std::string n0, const AttributeValue &v0,
97  std::string n1, const AttributeValue &v1,
98  std::string n2, const AttributeValue &v2,
99  std::string n3, const AttributeValue &v3,
100  std::string n4, const AttributeValue &v4,
101  std::string n5, const AttributeValue &v5,
102  std::string n6, const AttributeValue &v6,
103  std::string n7, const AttributeValue &v7)
104 {
105  if (type.compare ("ns3::OcbWifiMac") != 0)
106  {
107  NS_FATAL_ERROR ("QosWaveMacHelper shall set OcbWifiMac");
108  }
109  QosWifiMacHelper::SetType ("ns3::OcbWifiMac",
110  n0, v0,
111  n1, v1,
112  n2, v2,
113  n3, v3,
114  n4, v4,
115  n5, v5,
116  n6, v6,
117  n7, v7);
118 }
119 
120 } // namespace ns3
AttributeValue implementation for Boolean.
Definition: boolean.h:34
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())
Set the underlying type of the MAC and its attributes.
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())
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())
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:145
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())
QosWaveMacHelper(void)
Create a QosWaveMacHelper that is used to make life easier when working with Wifi 802...
virtual ~QosWaveMacHelper(void)
Destroy a QosWaveMacHelper.
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...
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.