author | Pavel Boyko <boyko@iitp.ru> |
Mon, 15 Jun 2009 13:10:56 +0400 | |
changeset 5063 | 97b947e83640 |
parent 5059 | 9914d3e51d23 |
child 5072 | 205f0bd58f03 |
permissions | -rw-r--r-- |
4793 | 1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2008,2009 IITP RAS |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
4793 | 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 |
* Authors: Kirill Andreev <andreev@iitp.ru> |
|
19 |
* Aleksey Kovalenko <kovalenko@iitp.ru> |
|
20 |
*/ |
|
21 |
||
22 |
||
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
23 |
#include "ie-dot11s-configuration.h" |
4951
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
24 |
#include "ns3/test.h" |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
25 |
#include "ns3/packet.h" |
4793 | 26 |
namespace ns3 { |
4872 | 27 |
namespace dot11s { |
4793 | 28 |
|
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
29 |
dot11sMeshCapability::dot11sMeshCapability (): |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
30 |
acceptPeerLinks (true), |
5025
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
31 |
MCCASupported (false), |
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
32 |
MCCAEnabled (false), |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
33 |
forwarding (true), |
4951
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
34 |
beaconTimingReport (true), |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
35 |
TBTTAdjustment (true), |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
36 |
powerSaveLevel (false) |
4793 | 37 |
{} |
4825
b407cc4bda3c
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
38 |
uint8_t dot11sMeshCapability::GetSerializedSize () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
39 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
40 |
return 2; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
41 |
} |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
42 |
Buffer::Iterator dot11sMeshCapability::Serialize (Buffer::Iterator i) const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
43 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
44 |
uint16_t result = 0; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
45 |
if (acceptPeerLinks) |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
46 |
result |= 1 << 0; |
5025
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
47 |
if (MCCASupported) |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
48 |
result |= 1 << 1; |
5025
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
49 |
if (MCCAEnabled) |
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
50 |
result |= 1 << 2; |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
51 |
if (forwarding) |
5025
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
52 |
result |= 1 << 3; |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
53 |
if (beaconTimingReport) |
5025
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
54 |
result |= 1 << 4; |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
55 |
if (TBTTAdjustment) |
5025
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
56 |
result |= 1 << 5; |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
57 |
if (powerSaveLevel) |
5025
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
58 |
result |= 1 << 6; |
5018 | 59 |
i.WriteHtolsbU16 (result); |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
60 |
return i; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
61 |
} |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
62 |
Buffer::Iterator dot11sMeshCapability::Deserialize (Buffer::Iterator i) |
4793 | 63 |
{ |
5018 | 64 |
uint16_t cap = i.ReadLsbtohU16 (); |
5025
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
65 |
acceptPeerLinks = Is (cap, 0); |
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
66 |
MCCASupported = Is (cap, 1); |
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
67 |
MCCAEnabled = Is (cap, 2); |
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
68 |
forwarding = Is (cap, 3); |
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
69 |
beaconTimingReport = Is (cap, 4); |
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
70 |
TBTTAdjustment = Is (cap, 5); |
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
71 |
powerSaveLevel = Is (cap, 6); |
4793 | 72 |
return i; |
73 |
} |
|
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
74 |
bool dot11sMeshCapability::Is (uint16_t cap, uint8_t n) const |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
75 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
76 |
uint16_t mask = 1<<n; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
77 |
return (cap & mask) == mask; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
78 |
} |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
79 |
IeConfiguration::IeConfiguration (): |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
80 |
m_APSId (PROTOCOL_HWMP), |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
81 |
m_APSMId (METRIC_AIRTIME), |
5025
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
82 |
m_CCMId (CONGESTION_NULL), |
5017
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
83 |
m_SPId (SYNC_NEIGHBOUR_OFFSET), |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
84 |
m_APId (AUTH_NULL), |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
85 |
m_neighbors (0) |
4793 | 86 |
{} |
4838
ce31277d72ad
Finished restructuring information elements
Kirill Andreev <andreev@iitp.ru>
parents:
4835
diff
changeset
|
87 |
uint8_t |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
88 |
IeConfiguration::GetInformationSize () const |
4828
c251ea20cc82
Fixed difference between length in bytes and length field
Kirill Andreev <andreev@iitp.ru>
parents:
4825
diff
changeset
|
89 |
{ |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
90 |
return 1 // Version |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
91 |
+ 4 // APSPId |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
92 |
+ 4 // APSMId |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
93 |
+ 4 // CCMId |
5017
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
94 |
+ 4 // SPId |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
95 |
+ 4 // APId |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
96 |
+ 1 // Mesh formation info (see 7.3.2.86.6 of 802.11s draft 3.0) |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
97 |
+ m_meshCap.GetSerializedSize (); |
4828
c251ea20cc82
Fixed difference between length in bytes and length field
Kirill Andreev <andreev@iitp.ru>
parents:
4825
diff
changeset
|
98 |
} |
4825
b407cc4bda3c
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
99 |
void |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
100 |
IeConfiguration::SerializeInformation (Buffer::Iterator i) const |
4825
b407cc4bda3c
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
101 |
{ |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
102 |
i.WriteU8 (1); //Version |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
103 |
// Active Path Selection Protocol ID: |
5018 | 104 |
i.WriteHtolsbU32 (m_APSId); |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
105 |
// Active Path Metric ID: |
5018 | 106 |
i.WriteHtolsbU32 (m_APSMId); |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
107 |
// Congestion Control Mode ID: |
5018 | 108 |
i.WriteHtolsbU32 (m_CCMId); |
5017
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
109 |
// Sync: |
5018 | 110 |
i.WriteHtolsbU32 (m_SPId); |
5017
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
111 |
// Auth: |
5018 | 112 |
i.WriteHtolsbU32 (m_APId); |
5025
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
113 |
i.WriteU8 (m_neighbors << 1); |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
114 |
m_meshCap.Serialize (i); |
4825
b407cc4bda3c
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
115 |
} |
4838
ce31277d72ad
Finished restructuring information elements
Kirill Andreev <andreev@iitp.ru>
parents:
4835
diff
changeset
|
116 |
uint8_t |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
117 |
IeConfiguration::DeserializeInformation (Buffer::Iterator i, uint8_t length) |
4825
b407cc4bda3c
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
118 |
{ |
b407cc4bda3c
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
119 |
Buffer::Iterator start = i; |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
120 |
uint8_t version; |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
121 |
version = i.ReadU8 (); |
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
122 |
// Active Path Selection Protocol ID: |
5018 | 123 |
m_APSId = (dot11sPathSelectionProtocol)i.ReadLsbtohU32 (); |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
124 |
// Active Path Metric ID: |
5018 | 125 |
m_APSMId = (dot11sPathSelectionMetric)i.ReadLsbtohU32 (); |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
126 |
// Congestion Control Mode ID: |
5018 | 127 |
m_CCMId = (dot11sCongestionControlMode)i.ReadLsbtohU32 (); |
128 |
m_SPId = (dot11sSynchronizationProtocolIdentifier)i.ReadLsbtohU32 (); |
|
129 |
m_APId = (dot11sAuthenticationProtocol)i.ReadLsbtohU32 (); |
|
5027
2f926202a5bf
Moving to IEEE 802.11s Draft 3.0 (Mesh Control Field, Beacon Timing Element):
Andrey Mazo <mazo@iitp.ru>
parents:
5025
diff
changeset
|
130 |
m_neighbors = (i.ReadU8 () >> 1) & 0xF; |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
131 |
i = m_meshCap.Deserialize (i); |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4841
diff
changeset
|
132 |
return i.GetDistanceFrom (start); |
4793 | 133 |
} |
4825
b407cc4bda3c
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
134 |
void |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
135 |
IeConfiguration::PrintInformation (std::ostream& os) const |
4825
b407cc4bda3c
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
136 |
{ |
b407cc4bda3c
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
4824
diff
changeset
|
137 |
} |
4793 | 138 |
void |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
139 |
IeConfiguration::SetRouting (dot11sPathSelectionProtocol routingId) |
4793 | 140 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
141 |
m_APSId = routingId; |
4793 | 142 |
} |
143 |
void |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
144 |
IeConfiguration::SetMetric (dot11sPathSelectionMetric metricId) |
4793 | 145 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
146 |
m_APSMId = metricId; |
4793 | 147 |
} |
148 |
bool |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
149 |
IeConfiguration::IsHWMP () |
4793 | 150 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
151 |
return (m_APSId == PROTOCOL_HWMP); |
4793 | 152 |
} |
153 |
bool |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
154 |
IeConfiguration::IsAirtime () |
4793 | 155 |
{ |
4812
adcb26652e1d
Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents:
4809
diff
changeset
|
156 |
return (m_APSMId == METRIC_AIRTIME); |
4793 | 157 |
} |
5017
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
158 |
void |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
159 |
IeConfiguration::SetNeighborCount (uint8_t neighbors) |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
160 |
{ |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
161 |
m_neighbors = (neighbors > 31) ? 31 : neighbors; |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
162 |
} |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
163 |
uint8_t |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
164 |
IeConfiguration::GetNeighborCount () |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
165 |
{ |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
166 |
return m_neighbors; |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
167 |
} |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4872
diff
changeset
|
168 |
dot11sMeshCapability const& IeConfiguration::MeshCapability () |
4793 | 169 |
{ |
170 |
return m_meshCap; |
|
171 |
} |
|
4951
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
172 |
bool operator== (const dot11sMeshCapability & a, const dot11sMeshCapability & b) |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
173 |
{ |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
174 |
return ( |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
175 |
(a.acceptPeerLinks == b.acceptPeerLinks) && |
5025
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
176 |
(a.MCCASupported == b.MCCASupported) && |
fc820a3a1975
Moving to IEEE 802.11s Draft 3.0 (Mesh Configuration Element)
Andrey Mazo <mazo@iitp.ru>
parents:
5018
diff
changeset
|
177 |
(a.MCCAEnabled == b.MCCAEnabled) && |
4951
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
178 |
(a.forwarding == b.forwarding) && |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
179 |
(a.beaconTimingReport == b.beaconTimingReport) && |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
180 |
(a.TBTTAdjustment == b.TBTTAdjustment) && |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
181 |
(a.powerSaveLevel == b.powerSaveLevel) |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
182 |
); |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
183 |
} |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
184 |
bool operator== (const IeConfiguration & a, const IeConfiguration & b) |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
185 |
{ |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
186 |
return ( |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
187 |
(a.m_APSId == b.m_APSId) && |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
188 |
(a.m_APSMId == b.m_APSMId) && |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
189 |
(a.m_CCMId == b.m_CCMId) && |
5017
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
190 |
(a.m_SPId == b.m_SPId) && |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
191 |
(a.m_APId == b.m_APId) && |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5004
diff
changeset
|
192 |
(a.m_neighbors == b.m_neighbors) && |
4951
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
193 |
(a.m_meshCap == b.m_meshCap) |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
194 |
); |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
195 |
} |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
196 |
#ifdef RUN_SELF_TESTS |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
197 |
|
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
198 |
/// Built-in self test for IePreq |
5004 | 199 |
struct IeConfigurationBist : public IeTest |
4951
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
200 |
{ |
5004 | 201 |
IeConfigurationBist () : IeTest ("Mesh/802.11s/IE/Configuration") {} |
4951
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
202 |
virtual bool RunTests(); |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
203 |
}; |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
204 |
|
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
205 |
/// Test instance |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
206 |
static IeConfigurationBist g_IeConfigurationBist; |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
207 |
|
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
208 |
bool IeConfigurationBist::RunTests () |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
209 |
{ |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
210 |
bool result(true); |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
211 |
IeConfiguration a; |
5004 | 212 |
|
213 |
result = TestRoundtripSerialization (a); |
|
4951
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
214 |
return result; |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
215 |
} |
acaf07eb8542
Unit testing for dot11s-IE
Kirill Andreev <andreev@iitp.ru>
parents:
4920
diff
changeset
|
216 |
#endif |
4872 | 217 |
} // namespace dot11s |
218 |
} //namespace ns3 |
|
4793 | 219 |