author | Dean Armstrong <deanarm@gmail.com> |
Thu, 03 Jun 2010 17:23:55 +0100 | |
changeset 6331 | eee2eab36748 |
parent 6294 | 6cefb3c0696a |
child 6673 | ec22aa763e2d |
permissions | -rw-r--r-- |
4408 | 1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2009 MIRKO BANCHI |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License version 2 as |
|
7 |
* published by the Free Software Foundation; |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 |
* |
|
18 |
* Author: Mirko Banchi <mk.banchi@gmail.com> |
|
19 |
*/ |
|
20 |
#include "qos-wifi-mac-helper.h" |
|
21 |
#include "ns3/msdu-aggregator.h" |
|
22 |
#include "ns3/wifi-mac.h" |
|
23 |
#include "ns3/edca-txop-n.h" |
|
24 |
#include "ns3/pointer.h" |
|
25 |
#include "ns3/uinteger.h" |
|
26 |
||
27 |
namespace ns3 { |
|
28 |
||
29 |
QosWifiMacHelper::QosWifiMacHelper () |
|
5467
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
30 |
{} |
4408 | 31 |
|
32 |
QosWifiMacHelper::~QosWifiMacHelper () |
|
33 |
{} |
|
34 |
||
35 |
QosWifiMacHelper |
|
36 |
QosWifiMacHelper::Default (void) |
|
37 |
{ |
|
38 |
QosWifiMacHelper helper; |
|
39 |
helper.SetType ("ns3::QstaWifiMac"); |
|
4720
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4408
diff
changeset
|
40 |
|
4408 | 41 |
return helper; |
42 |
} |
|
43 |
||
44 |
void |
|
45 |
QosWifiMacHelper::SetType (std::string type, |
|
46 |
std::string n0, const AttributeValue &v0, |
|
47 |
std::string n1, const AttributeValue &v1, |
|
48 |
std::string n2, const AttributeValue &v2, |
|
49 |
std::string n3, const AttributeValue &v3, |
|
50 |
std::string n4, const AttributeValue &v4, |
|
51 |
std::string n5, const AttributeValue &v5, |
|
52 |
std::string n6, const AttributeValue &v6, |
|
53 |
std::string n7, const AttributeValue &v7) |
|
54 |
{ |
|
55 |
m_mac.SetTypeId (type); |
|
56 |
m_mac.Set (n0, v0); |
|
57 |
m_mac.Set (n1, v1); |
|
58 |
m_mac.Set (n2, v2); |
|
59 |
m_mac.Set (n3, v3); |
|
60 |
m_mac.Set (n4, v4); |
|
61 |
m_mac.Set (n5, v5); |
|
62 |
m_mac.Set (n6, v6); |
|
63 |
m_mac.Set (n7, v7); |
|
64 |
} |
|
65 |
||
66 |
void |
|
6331
eee2eab36748
Bug 910: Replace AccessClass with 802.11-style AcIndex
Dean Armstrong <deanarm@gmail.com>
parents:
6294
diff
changeset
|
67 |
QosWifiMacHelper::SetMsduAggregatorForAc (AcIndex ac, std::string type, |
4408 | 68 |
std::string n0, const AttributeValue &v0, |
69 |
std::string n1, const AttributeValue &v1, |
|
70 |
std::string n2, const AttributeValue &v2, |
|
71 |
std::string n3, const AttributeValue &v3) |
|
72 |
{ |
|
6331
eee2eab36748
Bug 910: Replace AccessClass with 802.11-style AcIndex
Dean Armstrong <deanarm@gmail.com>
parents:
6294
diff
changeset
|
73 |
std::map<AcIndex, ObjectFactory>::iterator it = m_aggregators.find (ac); |
4408 | 74 |
if (it != m_aggregators.end ()) |
75 |
{ |
|
76 |
it->second.SetTypeId (type); |
|
77 |
it->second.Set (n0, v0); |
|
78 |
it->second.Set (n1, v1); |
|
79 |
it->second.Set (n2, v2); |
|
80 |
it->second.Set (n3, v3); |
|
81 |
} |
|
5467
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
82 |
else |
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
83 |
{ |
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
84 |
ObjectFactory factory; |
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
85 |
factory.SetTypeId (type); |
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
86 |
factory.Set (n0, v0); |
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
87 |
factory.Set (n1, v1); |
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
88 |
factory.Set (n2, v2); |
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
89 |
factory.Set (n3, v3); |
6331
eee2eab36748
Bug 910: Replace AccessClass with 802.11-style AcIndex
Dean Armstrong <deanarm@gmail.com>
parents:
6294
diff
changeset
|
90 |
m_aggregators.insert (std::make_pair (ac, factory)); |
5467
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
91 |
} |
4408 | 92 |
} |
93 |
||
94 |
void |
|
6331
eee2eab36748
Bug 910: Replace AccessClass with 802.11-style AcIndex
Dean Armstrong <deanarm@gmail.com>
parents:
6294
diff
changeset
|
95 |
QosWifiMacHelper::SetBlockAckThresholdForAc (enum AcIndex ac, uint8_t threshold) |
6294
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
96 |
{ |
6331
eee2eab36748
Bug 910: Replace AccessClass with 802.11-style AcIndex
Dean Armstrong <deanarm@gmail.com>
parents:
6294
diff
changeset
|
97 |
m_bAckThresholds[ac] = threshold; |
6294
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
98 |
} |
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
99 |
|
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
100 |
void |
6331
eee2eab36748
Bug 910: Replace AccessClass with 802.11-style AcIndex
Dean Armstrong <deanarm@gmail.com>
parents:
6294
diff
changeset
|
101 |
QosWifiMacHelper::SetBlockAckInactivityTimeoutForAc (enum AcIndex ac, uint16_t timeout) |
6294
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
102 |
{ |
6331
eee2eab36748
Bug 910: Replace AccessClass with 802.11-style AcIndex
Dean Armstrong <deanarm@gmail.com>
parents:
6294
diff
changeset
|
103 |
m_bAckInactivityTimeouts[ac] = timeout; |
6294
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
104 |
} |
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
105 |
|
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
106 |
void |
6331
eee2eab36748
Bug 910: Replace AccessClass with 802.11-style AcIndex
Dean Armstrong <deanarm@gmail.com>
parents:
6294
diff
changeset
|
107 |
QosWifiMacHelper::Setup (Ptr<WifiMac> mac, enum AcIndex ac, std::string dcaAttrName) const |
4408 | 108 |
{ |
6331
eee2eab36748
Bug 910: Replace AccessClass with 802.11-style AcIndex
Dean Armstrong <deanarm@gmail.com>
parents:
6294
diff
changeset
|
109 |
std::map<AcIndex, ObjectFactory>::const_iterator it = m_aggregators.find (ac); |
6294
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
110 |
PointerValue ptr; |
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
111 |
mac->GetAttribute (dcaAttrName, ptr); |
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
112 |
Ptr<EdcaTxopN> edca = ptr.Get<EdcaTxopN> (); |
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
113 |
|
5467
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
114 |
if (it != m_aggregators.end ()) |
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
115 |
{ |
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
116 |
ObjectFactory factory = it->second; |
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
117 |
Ptr<MsduAggregator> aggregator = factory.Create<MsduAggregator> (); |
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
118 |
edca->SetMsduAggregator (aggregator); |
c7aa69502cdd
A-MSDU aggregation is not a default feature.
Mirko Banchi <mk.banchi@gmail.com>
parents:
4720
diff
changeset
|
119 |
} |
6294
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
120 |
if (m_bAckThresholds.find (ac) != m_bAckThresholds.end ()) |
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
121 |
{ |
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
122 |
edca->SetBlockAckThreshold (m_bAckThresholds.find(ac)->second); |
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
123 |
} |
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
124 |
if (m_bAckInactivityTimeouts.find (ac) != m_bAckInactivityTimeouts.end ()) |
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
125 |
{ |
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
126 |
edca->SetBlockAckInactivityTimeout (m_bAckInactivityTimeouts.find(ac)->second); |
6cefb3c0696a
add methods in QosWifiMacHelper for block ack parameters setup
Mirko Banchi <mk.banchi@gmail.com>
parents:
5467
diff
changeset
|
127 |
} |
4408 | 128 |
} |
129 |
||
4720
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4408
diff
changeset
|
130 |
|
4408 | 131 |
Ptr<WifiMac> |
132 |
QosWifiMacHelper::Create (void) const |
|
133 |
{ |
|
134 |
Ptr<WifiMac> mac = m_mac.Create<WifiMac> (); |
|
135 |
||
4720
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4408
diff
changeset
|
136 |
Setup (mac, AC_VO, "VO_EdcaTxopN"); |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4408
diff
changeset
|
137 |
Setup (mac, AC_VI, "VI_EdcaTxopN"); |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4408
diff
changeset
|
138 |
Setup (mac, AC_BE, "BE_EdcaTxopN"); |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4408
diff
changeset
|
139 |
Setup (mac, AC_BK, "BK_EdcaTxopN"); |
4408 | 140 |
|
141 |
return mac; |
|
142 |
} |
|
143 |
||
144 |
} //namespace ns3 |