A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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/wifi-mac.h"
25 #include "ns3/wifi-phy.h"
26 #include "ns3/log.h"
27 #include "ns3/pointer.h"
28 #include "ns3/boolean.h"
29 #include "ns3/string.h"
30 #include "wave-mac-helper.h"
31 
32 namespace ns3 {
33 
35 {
36 
37 }
39 {
40 
41 }
44 {
45  NqosWaveMacHelper helper;
46  // We're making non QoS-enabled Wi-Fi MACs here, so we set the
47  // necessary attribute. I've carefully positioned this here so that
48  // someone who knows what they're doing can override with explicit
49  // attributes.
50  helper.SetType ("ns3::OcbWifiMac", "QosSupported", BooleanValue (false));
51  return helper;
52 }
53 void
54 NqosWaveMacHelper::SetType (std::string type,
55  std::string n0, const AttributeValue &v0,
56  std::string n1, const AttributeValue &v1,
57  std::string n2, const AttributeValue &v2,
58  std::string n3, const AttributeValue &v3,
59  std::string n4, const AttributeValue &v4,
60  std::string n5, const AttributeValue &v5,
61  std::string n6, const AttributeValue &v6,
62  std::string n7, const AttributeValue &v7)
63 {
64  if (type.compare ("ns3::OcbWifiMac") != 0)
65  {
66  NS_FATAL_ERROR ("QosWaveMacHelper shall set OcbWifiMac");
67  }
68  NqosWifiMacHelper::SetType ("ns3::OcbWifiMac",
69  n0, v0,
70  n1, v1,
71  n2, v2,
72  n3, v3,
73  n4, v4,
74  n5, v5,
75  n6, v6,
76  n7, v7);
77 }
78 
79 /********** QosWifi80211pMacHelper *********/
81 {
82 }
84 {
85 }
88 {
89  QosWaveMacHelper helper;
90 
91  // We're making QoS-enabled Wi-Fi MACs here, so we set the necessary
92  // attribute. I've carefully positioned this here so that someone
93  // who knows what they're doing can override with explicit
94  // attributes.
95  helper.SetType ("ns3::OcbWifiMac", "QosSupported", BooleanValue (true));
96 
97  return helper;
98 }
99 void
100 QosWaveMacHelper::SetType (std::string type,
101  std::string n0, const AttributeValue &v0,
102  std::string n1, const AttributeValue &v1,
103  std::string n2, const AttributeValue &v2,
104  std::string n3, const AttributeValue &v3,
105  std::string n4, const AttributeValue &v4,
106  std::string n5, const AttributeValue &v5,
107  std::string n6, const AttributeValue &v6,
108  std::string n7, const AttributeValue &v7)
109 {
110  if (type.compare ("ns3::OcbWifiMac") != 0)
111  {
112  NS_FATAL_ERROR ("QosWaveMacHelper shall set OcbWifiMac");
113  }
114  QosWifiMacHelper::SetType ("ns3::OcbWifiMac",
115  n0, v0,
116  n1, v1,
117  n2, v2,
118  n3, v3,
119  n4, v4,
120  n5, v5,
121  n6, v6,
122  n7, v7);
123 }
124 
125 } // namespace ns3
Hold a bool native type.
Definition: boolean.h:38
Hold a value for an Attribute.
Definition: attribute.h:56
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)
fatal error handling
Definition: fatal-error.h:72
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)
NqosWaveMacHelper(void)
Create a NqosWaveMacHelper to make life easier for people who want to work with non-QOS Wave MAC laye...
virtual ~NqosWaveMacHelper(void)
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.