author | Craig Dowell <craigdo@ee.washington.edu> |
Mon, 12 Oct 2009 23:31:58 -0700 | |
changeset 5413 | 64931d320790 |
parent 5174 | 404f414bfaa7 |
child 5824 | 5abf274b52d4 |
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 |
* Author: Kirill Andreev <andreev@iitp.ru> |
|
19 |
*/ |
|
20 |
||
4887
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
21 |
#include "ns3/mesh-wifi-interface-mac.h" |
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
22 |
#include "ns3/packet.h" |
4793 | 23 |
#include "ns3/simulator.h" |
24 |
#include "ns3/nstime.h" |
|
25 |
#include "ns3/log.h" |
|
4956
aba7cae978ac
MeshWifiMacHeader moved to Dot11sMacHeader. test to it is written
Kirill Andreev <andreev@iitp.ru>
parents:
4955
diff
changeset
|
26 |
#include "dot11s-mac-header.h" |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5083
diff
changeset
|
27 |
#include "hwmp-protocol-mac.h" |
4889
279b07de3327
Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents:
4887
diff
changeset
|
28 |
#include "hwmp-tag.h" |
4887
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
29 |
#include "ie-dot11s-preq.h" |
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
30 |
#include "ie-dot11s-prep.h" |
5112
762835be2902
Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents:
5111
diff
changeset
|
31 |
#include "ie-dot11s-rann.h" |
5168
72bf9328f412
Failed destination is structure of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
5162
diff
changeset
|
32 |
#include "ie-dot11s-perr.h" |
4813
e4e2c44d27cd
All mesh related filed moved to devices/mesh. Let the refactoring begins!
Pavel Boyko <boyko@iitp.ru>
parents:
4812
diff
changeset
|
33 |
|
5132
aee541a30256
Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents:
5130
diff
changeset
|
34 |
namespace ns3 { |
aee541a30256
Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents:
5130
diff
changeset
|
35 |
namespace dot11s { |
4793 | 36 |
|
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5083
diff
changeset
|
37 |
NS_LOG_COMPONENT_DEFINE ("HwmpProtocolMac"); |
5129 | 38 |
HwmpProtocolMac::HwmpProtocolMac (uint32_t ifIndex, Ptr<HwmpProtocol> protocol) : |
39 |
m_ifIndex (ifIndex), m_protocol (protocol) |
|
4887
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
40 |
{ |
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
41 |
} |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5083
diff
changeset
|
42 |
HwmpProtocolMac::~HwmpProtocolMac () |
4887
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
43 |
{ |
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
44 |
} |
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
45 |
void |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5083
diff
changeset
|
46 |
HwmpProtocolMac::SetParent (Ptr<MeshWifiInterfaceMac> parent) |
4887
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
47 |
{ |
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
48 |
m_parent = parent; |
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
49 |
} |
5063 | 50 |
|
51 |
bool |
|
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5083
diff
changeset
|
52 |
HwmpProtocolMac::ReceiveData (Ptr<Packet> packet, const WifiMacHeader & header) |
5063 | 53 |
{ |
5129 | 54 |
NS_ASSERT (header.IsData ()); |
5063 | 55 |
|
56 |
MeshHeader meshHdr; |
|
57 |
HwmpTag tag; |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
58 |
if (packet->PeekPacketTag (tag)) |
5129 | 59 |
{ |
60 |
NS_FATAL_ERROR ("HWMP tag is not supposed to be received by network"); |
|
61 |
} |
|
62 |
||
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
63 |
packet->RemoveHeader (meshHdr); |
5129 | 64 |
m_stats.rxData++; |
5063 | 65 |
m_stats.rxDataBytes += packet->GetSize (); |
5129 | 66 |
|
5063 | 67 |
//TODO: address extension |
68 |
Mac48Address destination; |
|
69 |
Mac48Address source; |
|
70 |
switch (meshHdr.GetAddressExt ()) |
|
5129 | 71 |
{ |
72 |
case 0: |
|
73 |
source = header.GetAddr4 (); |
|
74 |
destination = header.GetAddr3 (); |
|
75 |
break; |
|
76 |
default: |
|
77 |
NS_FATAL_ERROR ( |
|
78 |
"6-address scheme is not yet supported and 4-address extension is not supposed to be used for data frames."); |
|
5162
35963e5411c0
PrintInformation replaced with Prin in information elements, added operator
Kirill Andreev <andreev@iitp.ru>
parents:
5158
diff
changeset
|
79 |
} |
5063 | 80 |
tag.SetSeqno (meshHdr.GetMeshSeqno ()); |
81 |
tag.SetTtl (meshHdr.GetMeshTtl ()); |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
82 |
packet->AddPacketTag (tag); |
5129 | 83 |
|
84 |
if ((destination == Mac48Address::GetBroadcast ()) && (m_protocol->DropDataFrame (meshHdr.GetMeshSeqno (), |
|
85 |
source))) |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
86 |
{ |
5063 | 87 |
return false; |
5129 | 88 |
} |
5063 | 89 |
return true; |
90 |
} |
|
91 |
||
92 |
bool |
|
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5083
diff
changeset
|
93 |
HwmpProtocolMac::ReceiveAction (Ptr<Packet> packet, const WifiMacHeader & header) |
5063 | 94 |
{ |
5129 | 95 |
m_stats.rxMgt++; |
5063 | 96 |
m_stats.rxMgtBytes += packet->GetSize (); |
97 |
WifiMeshActionHeader actionHdr; |
|
98 |
packet->RemoveHeader (actionHdr); |
|
99 |
WifiMeshActionHeader::ActionValue actionValue = actionHdr.GetAction (); |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
100 |
if (actionHdr.GetCategory () != WifiMeshActionHeader::MESH_PATH_SELECTION) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
101 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
102 |
return true; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
103 |
} |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
104 |
WifiInformationElementVector elements; |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
105 |
packet->RemoveHeader (elements); |
5168
72bf9328f412
Failed destination is structure of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
5162
diff
changeset
|
106 |
std::vector<HwmpProtocol::FailedDestination> failedDestinations; |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
107 |
for (WifiInformationElementVector::Iterator i = elements.Begin(); i != elements.End(); i ++) |
5129 | 108 |
{ |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
109 |
if ((*i)->ElementId () == IE11S_RANN) |
5129 | 110 |
{ |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
111 |
NS_LOG_WARN ("RANN is not supported!"); |
5129 | 112 |
} |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
113 |
if ((*i)->ElementId () == IE11S_PREQ) |
5129 | 114 |
{ |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
115 |
Ptr<IePreq> preq = DynamicCast<IePreq> (*i); |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
116 |
NS_ASSERT (preq != 0); |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
117 |
m_stats.rxPreq++; |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
118 |
if (preq->GetOriginatorAddress () == m_protocol->GetAddress ()) |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
119 |
{ |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
120 |
continue; |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
121 |
} |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
122 |
if (preq->GetTtl () == 0) |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
123 |
{ |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
124 |
continue; |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
125 |
} |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
126 |
preq->DecrementTtl (); |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
127 |
m_protocol->ReceivePreq (*preq, header.GetAddr2 (), m_ifIndex, header.GetAddr3 (), |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
128 |
m_parent->GetLinkMetric (header.GetAddr2 ())); |
5129 | 129 |
} |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
130 |
if ((*i)->ElementId () == IE11S_PREP) |
5130 | 131 |
{ |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
132 |
Ptr<IePrep> prep = DynamicCast<IePrep> (*i); |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
133 |
NS_ASSERT (prep != 0); |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
134 |
m_stats.rxPrep++; |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
135 |
if (prep->GetTtl () == 0) |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
136 |
{ |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
137 |
continue; |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
138 |
} |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
139 |
prep->DecrementTtl (); |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
140 |
m_protocol->ReceivePrep (*prep, header.GetAddr2 (), m_ifIndex, header.GetAddr3 (), |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
141 |
m_parent->GetLinkMetric (header.GetAddr2 ())); |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
142 |
} |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
143 |
if ((*i)->ElementId () == IE11S_PERR) |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
144 |
{ |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
145 |
Ptr<IePerr> perr = DynamicCast<IePerr> (*i); |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
146 |
NS_ASSERT (perr != 0); |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
147 |
m_stats.rxPerr++; |
5168
72bf9328f412
Failed destination is structure of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
5162
diff
changeset
|
148 |
std::vector<HwmpProtocol::FailedDestination> destinations = perr->GetAddressUnitVector (); |
72bf9328f412
Failed destination is structure of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
5162
diff
changeset
|
149 |
for (std::vector<HwmpProtocol::FailedDestination>::const_iterator i = destinations.begin (); i |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
150 |
!= destinations.end (); i++) |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
151 |
{ |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
152 |
failedDestinations.push_back (*i); |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
153 |
} |
5130 | 154 |
} |
5129 | 155 |
} |
5113
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
156 |
if (failedDestinations.size () > 0) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
157 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
158 |
m_protocol->ReceivePerr (failedDestinations, header.GetAddr2 (), m_ifIndex, header.GetAddr3 ()); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
159 |
} |
5129 | 160 |
NS_ASSERT (packet->GetSize () == 0); |
5112
762835be2902
Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents:
5111
diff
changeset
|
161 |
return false; |
5063 | 162 |
} |
163 |
||
4887
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
164 |
bool |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5083
diff
changeset
|
165 |
HwmpProtocolMac::Receive (Ptr<Packet> packet, const WifiMacHeader & header) |
4887
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
166 |
{ |
5063 | 167 |
if (header.IsData ()) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
168 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
169 |
return ReceiveData (packet, header); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
170 |
} |
5129 | 171 |
else |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
172 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
173 |
if (header.IsAction ()) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
174 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
175 |
return ReceiveAction (packet, header); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
176 |
} |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
177 |
else |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
178 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
179 |
return true; // don't care |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
180 |
} |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
181 |
} |
4887
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
182 |
} |
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
183 |
bool |
5129 | 184 |
HwmpProtocolMac::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Address from, |
185 |
Mac48Address to) |
|
4887
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
186 |
{ |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
187 |
if (!header.IsData ()) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
188 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
189 |
return true; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
190 |
} |
4889
279b07de3327
Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents:
4887
diff
changeset
|
191 |
HwmpTag tag; |
5129 | 192 |
bool tagExists = packet->RemovePacketTag (tag); |
5008
9650fb0087d2
Revert commit [c259eaefdd7f]. Make compiler happy.
Andrey Mazo <mazo@iitp.ru>
parents:
5002
diff
changeset
|
193 |
if (!tagExists) |
5129 | 194 |
{ |
195 |
NS_FATAL_ERROR ("HWMP tag must exist at this point"); |
|
196 |
} |
|
197 |
m_stats.txData++; |
|
5038 | 198 |
m_stats.txDataBytes += packet->GetSize (); |
4994
2c25f9c66604
Dot11sMacHeader renamed to MeshHeader to correspond standard
Pavel Boyko <boyko@iitp.ru>
parents:
4991
diff
changeset
|
199 |
MeshHeader meshHdr; |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
200 |
meshHdr.SetMeshSeqno (tag.GetSeqno ()); |
5129 | 201 |
meshHdr.SetMeshTtl (tag.GetTtl ()); |
5113
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
202 |
packet->AddHeader (meshHdr); |
5129 | 203 |
header.SetAddr1 (tag.GetAddress ()); |
4887
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
204 |
return true; |
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4886
diff
changeset
|
205 |
} |
5112
762835be2902
Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents:
5111
diff
changeset
|
206 |
WifiMeshActionHeader |
762835be2902
Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents:
5111
diff
changeset
|
207 |
HwmpProtocolMac::GetWifiMeshActionHeader () |
762835be2902
Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents:
5111
diff
changeset
|
208 |
{ |
762835be2902
Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents:
5111
diff
changeset
|
209 |
WifiMeshActionHeader actionHdr; |
762835be2902
Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents:
5111
diff
changeset
|
210 |
WifiMeshActionHeader::ActionValue action; |
762835be2902
Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents:
5111
diff
changeset
|
211 |
action.pathSelection = WifiMeshActionHeader::PATH_SELECTION; |
762835be2902
Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents:
5111
diff
changeset
|
212 |
actionHdr.SetAction (WifiMeshActionHeader::MESH_PATH_SELECTION, action); |
762835be2902
Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents:
5111
diff
changeset
|
213 |
return actionHdr; |
762835be2902
Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents:
5111
diff
changeset
|
214 |
} |
4793 | 215 |
void |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
216 |
HwmpProtocolMac::SendPreq (IePreq preq) |
4793 | 217 |
{ |
5107
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
218 |
NS_LOG_FUNCTION_NOARGS (); |
5113
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
219 |
std::vector<IePreq> preq_vector; |
5129 | 220 |
preq_vector.push_back (preq); |
221 |
SendPreq (preq_vector); |
|
5113
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
222 |
} |
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
223 |
void |
5129 | 224 |
HwmpProtocolMac::SendPreq (std::vector<IePreq> preq) |
5113
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
225 |
{ |
5107
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
226 |
Ptr<Packet> packet = Create<Packet> (); |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
227 |
WifiInformationElementVector elements; |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
228 |
for (std::vector<IePreq>::iterator i = preq.begin (); i != preq.end (); i++) |
5129 | 229 |
{ |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
230 |
elements.AddInformationElement(Ptr<IePreq> (&(*i))); |
5129 | 231 |
} |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
232 |
packet->AddHeader(elements); |
5112
762835be2902
Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents:
5111
diff
changeset
|
233 |
packet->AddHeader (GetWifiMeshActionHeader ()); |
4926
a9382a693fa1
PREQ queue bugfix, tested proactive mode, removed unnseded debug messages
Kirill Andreev <andreev@iitp.ru>
parents:
4925
diff
changeset
|
234 |
//create 802.11 header: |
a9382a693fa1
PREQ queue bugfix, tested proactive mode, removed unnseded debug messages
Kirill Andreev <andreev@iitp.ru>
parents:
4925
diff
changeset
|
235 |
WifiMacHeader hdr; |
4968
ff5a2162d492
MulthopAction -> Action management frames in 802.11s according to std
Pavel Boyko <boyko@iitp.ru>
parents:
4965
diff
changeset
|
236 |
hdr.SetAction (); |
4926
a9382a693fa1
PREQ queue bugfix, tested proactive mode, removed unnseded debug messages
Kirill Andreev <andreev@iitp.ru>
parents:
4925
diff
changeset
|
237 |
hdr.SetDsNotFrom (); |
a9382a693fa1
PREQ queue bugfix, tested proactive mode, removed unnseded debug messages
Kirill Andreev <andreev@iitp.ru>
parents:
4925
diff
changeset
|
238 |
hdr.SetDsNotTo (); |
a9382a693fa1
PREQ queue bugfix, tested proactive mode, removed unnseded debug messages
Kirill Andreev <andreev@iitp.ru>
parents:
4925
diff
changeset
|
239 |
hdr.SetAddr2 (m_parent->GetAddress ()); |
4996
33f418524356
Fixed routing information with neighbours, fixed address3 in management
Kirill Andreev <andreev@iitp.ru>
parents:
4984
diff
changeset
|
240 |
hdr.SetAddr3 (m_protocol->GetAddress ()); |
4926
a9382a693fa1
PREQ queue bugfix, tested proactive mode, removed unnseded debug messages
Kirill Andreev <andreev@iitp.ru>
parents:
4925
diff
changeset
|
241 |
//Send Management frame |
5129 | 242 |
std::vector<Mac48Address> receivers = m_protocol->GetPreqReceivers (m_ifIndex); |
243 |
for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != receivers.end (); i++) |
|
244 |
{ |
|
245 |
hdr.SetAddr1 (*i); |
|
246 |
m_stats.txPreq++; |
|
247 |
m_stats.txMgt++; |
|
248 |
m_stats.txMgtBytes += packet->GetSize (); |
|
249 |
m_parent->SendManagementFrame (packet, hdr); |
|
250 |
} |
|
5107
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
251 |
} |
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
252 |
void |
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
253 |
HwmpProtocolMac::RequestDestination (Mac48Address dst, uint32_t originator_seqno, uint32_t dst_seqno) |
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
254 |
{ |
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
255 |
NS_LOG_FUNCTION_NOARGS (); |
5129 | 256 |
for (std::vector<IePreq>::iterator i = m_myPreq.begin (); i != m_myPreq.end (); i++) |
257 |
{ |
|
258 |
if (i->IsFull ()) |
|
259 |
{ |
|
260 |
continue; |
|
261 |
} |
|
262 |
NS_ASSERT (i->GetDestCount () > 0); |
|
263 |
i->AddDestinationAddressElement (m_protocol->GetDoFlag (), m_protocol->GetRfFlag (), dst, dst_seqno); |
|
264 |
} |
|
5113
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
265 |
IePreq preq; |
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
266 |
preq.SetHopcount (0); |
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
267 |
preq.SetTTL (m_protocol->GetMaxTtl ()); |
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
268 |
preq.SetPreqID (m_protocol->GetNextPreqId ()); |
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
269 |
preq.SetOriginatorAddress (m_protocol->GetAddress ()); |
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
270 |
preq.SetOriginatorSeqNumber (originator_seqno); |
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
271 |
preq.SetLifetime (m_protocol->GetActivePathLifetime ()); |
5129 | 272 |
preq.AddDestinationAddressElement (m_protocol->GetDoFlag (), m_protocol->GetRfFlag (), dst, dst_seqno); |
273 |
m_myPreq.push_back (preq); |
|
5107
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
274 |
SendMyPreq (); |
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
275 |
} |
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
276 |
void |
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
277 |
HwmpProtocolMac::SendMyPreq () |
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
278 |
{ |
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
279 |
NS_LOG_FUNCTION_NOARGS (); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
280 |
if (m_preqTimer.IsRunning ()) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
281 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
282 |
return; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
283 |
} |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
284 |
if (m_myPreq.size () == 0) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
285 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
286 |
return; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
287 |
} |
5107
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
288 |
//reschedule sending PREQ |
5129 | 289 |
NS_ASSERT (!m_preqTimer.IsRunning ()); |
5107
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
290 |
m_preqTimer = Simulator::Schedule (m_protocol->GetPreqMinInterval (), &HwmpProtocolMac::SendMyPreq, this); |
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
291 |
SendPreq (m_myPreq); |
5113
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
292 |
m_myPreq.clear (); |
4900
0c34a34208f2
restructured precursors in rtable
Kirill Andreev <andreev@iitp.ru>
parents:
4896
diff
changeset
|
293 |
} |
0c34a34208f2
restructured precursors in rtable
Kirill Andreev <andreev@iitp.ru>
parents:
4896
diff
changeset
|
294 |
void |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5083
diff
changeset
|
295 |
HwmpProtocolMac::SendPrep (IePrep prep, Mac48Address receiver) |
4900
0c34a34208f2
restructured precursors in rtable
Kirill Andreev <andreev@iitp.ru>
parents:
4896
diff
changeset
|
296 |
{ |
5107
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
297 |
NS_LOG_FUNCTION_NOARGS (); |
4895 | 298 |
//Create packet |
5129 | 299 |
Ptr<Packet> packet = Create<Packet> (); |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
300 |
WifiInformationElementVector elements; |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
301 |
elements.AddInformationElement(Ptr<IePrep> (&prep)); |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
302 |
packet->AddHeader (elements); |
5112
762835be2902
Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents:
5111
diff
changeset
|
303 |
packet->AddHeader (GetWifiMeshActionHeader ()); |
4895 | 304 |
//create 802.11 header: |
305 |
WifiMacHeader hdr; |
|
4968
ff5a2162d492
MulthopAction -> Action management frames in 802.11s according to std
Pavel Boyko <boyko@iitp.ru>
parents:
4965
diff
changeset
|
306 |
hdr.SetAction (); |
4895 | 307 |
hdr.SetDsNotFrom (); |
308 |
hdr.SetDsNotTo (); |
|
4900
0c34a34208f2
restructured precursors in rtable
Kirill Andreev <andreev@iitp.ru>
parents:
4896
diff
changeset
|
309 |
hdr.SetAddr1 (receiver); |
4895 | 310 |
hdr.SetAddr2 (m_parent->GetAddress ()); |
4996
33f418524356
Fixed routing information with neighbours, fixed address3 in management
Kirill Andreev <andreev@iitp.ru>
parents:
4984
diff
changeset
|
311 |
hdr.SetAddr3 (m_protocol->GetAddress ()); |
4895 | 312 |
//Send Management frame |
5129 | 313 |
m_stats.txPrep++; |
314 |
m_stats.txMgt++; |
|
5038 | 315 |
m_stats.txMgtBytes += packet->GetSize (); |
5129 | 316 |
m_parent->SendManagementFrame (packet, hdr); |
4793 | 317 |
} |
318 |
void |
|
5168
72bf9328f412
Failed destination is structure of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
5162
diff
changeset
|
319 |
HwmpProtocolMac::ForwardPerr (std::vector<HwmpProtocol::FailedDestination> failedDestinations, std::vector< |
5129 | 320 |
Mac48Address> receivers) |
4793 | 321 |
{ |
5107
ec4196c70800
Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
322 |
NS_LOG_FUNCTION_NOARGS (); |
5129 | 323 |
Ptr<Packet> packet = Create<Packet> (); |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
324 |
Ptr<IePerr> perr = Create <IePerr> (); |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
325 |
WifiInformationElementVector elements; |
5168
72bf9328f412
Failed destination is structure of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
5162
diff
changeset
|
326 |
for (std::vector<HwmpProtocol::FailedDestination>::const_iterator i = failedDestinations.begin (); i |
5129 | 327 |
!= failedDestinations.end (); i++) |
328 |
{ |
|
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
329 |
if (!perr->IsFull ()) |
5129 | 330 |
{ |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
331 |
perr->AddAddressUnit (*i); |
5129 | 332 |
} |
333 |
else |
|
334 |
{ |
|
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
335 |
elements.AddInformationElement(perr); |
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
336 |
perr->ResetPerr (); |
5129 | 337 |
} |
338 |
} |
|
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
339 |
if (perr->GetNumOfDest () > 0) |
5113
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
340 |
{ |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
341 |
elements.AddInformationElement(perr); |
5113
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
342 |
} |
5158
0baed7827260
Start to remove inheritance from header in WifiInformationElement
Kirill Andreev <andreev@iitp.ru>
parents:
5157
diff
changeset
|
343 |
packet->AddHeader (elements); |
5112
762835be2902
Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents:
5111
diff
changeset
|
344 |
packet->AddHeader (GetWifiMeshActionHeader ()); |
5111 | 345 |
//create 802.11 header: |
346 |
WifiMacHeader hdr; |
|
347 |
hdr.SetAction (); |
|
348 |
hdr.SetDsNotFrom (); |
|
349 |
hdr.SetDsNotTo (); |
|
350 |
hdr.SetAddr2 (m_parent->GetAddress ()); |
|
351 |
hdr.SetAddr3 (m_protocol->GetAddress ()); |
|
5129 | 352 |
if (receivers.size () >= m_protocol->GetUnicastPerrThreshold ()) |
353 |
{ |
|
354 |
receivers.clear (); |
|
355 |
receivers.push_back (Mac48Address::GetBroadcast ()); |
|
356 |
} |
|
5111 | 357 |
//Send Management frame |
5174 | 358 |
for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != receivers.end (); i++) |
5129 | 359 |
{ |
5413
64931d320790
fix valgrind complaints (bug 711)
Craig Dowell <craigdo@ee.washington.edu>
parents:
5174
diff
changeset
|
360 |
// |
64931d320790
fix valgrind complaints (bug 711)
Craig Dowell <craigdo@ee.washington.edu>
parents:
5174
diff
changeset
|
361 |
// 64-bit Intel valgrind complains about hdr.SetAddr1 (*i). It likes this |
64931d320790
fix valgrind complaints (bug 711)
Craig Dowell <craigdo@ee.washington.edu>
parents:
5174
diff
changeset
|
362 |
// just fine. |
64931d320790
fix valgrind complaints (bug 711)
Craig Dowell <craigdo@ee.washington.edu>
parents:
5174
diff
changeset
|
363 |
// |
64931d320790
fix valgrind complaints (bug 711)
Craig Dowell <craigdo@ee.washington.edu>
parents:
5174
diff
changeset
|
364 |
Mac48Address address = *i; |
64931d320790
fix valgrind complaints (bug 711)
Craig Dowell <craigdo@ee.washington.edu>
parents:
5174
diff
changeset
|
365 |
hdr.SetAddr1 (address); |
5129 | 366 |
m_stats.txPerr++; |
367 |
m_stats.txMgt++; |
|
368 |
m_stats.txMgtBytes += packet->GetSize (); |
|
369 |
m_parent->SendManagementFrame (packet, hdr); |
|
370 |
} |
|
5111 | 371 |
} |
372 |
void |
|
5168
72bf9328f412
Failed destination is structure of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
5162
diff
changeset
|
373 |
HwmpProtocolMac::InitiatePerr (std::vector<HwmpProtocol::FailedDestination> failedDestinations, std::vector< |
5129 | 374 |
Mac48Address> receivers) |
5111 | 375 |
{ |
5113
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
376 |
//All duplicates in PERR are checked here, and there is no reason to |
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
377 |
//check it at any athoer place |
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
378 |
{ |
5129 | 379 |
std::vector<Mac48Address>::const_iterator end = receivers.end (); |
380 |
for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != end; i++) |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
381 |
{ |
5129 | 382 |
bool should_add = true; |
383 |
for (std::vector<Mac48Address>::const_iterator j = m_myPerr.receivers.begin (); j |
|
384 |
!= m_myPerr.receivers.end (); j++) |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
385 |
{ |
5129 | 386 |
if ((*i) == (*j)) |
387 |
{ |
|
388 |
should_add = false; |
|
389 |
} |
|
390 |
} |
|
391 |
if (should_add) |
|
392 |
{ |
|
393 |
m_myPerr.receivers.push_back (*i); |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
394 |
} |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
395 |
} |
5129 | 396 |
} |
397 |
{ |
|
5168
72bf9328f412
Failed destination is structure of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
5162
diff
changeset
|
398 |
std::vector<HwmpProtocol::FailedDestination>::const_iterator end = failedDestinations.end (); |
72bf9328f412
Failed destination is structure of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
5162
diff
changeset
|
399 |
for (std::vector<HwmpProtocol::FailedDestination>::const_iterator i = failedDestinations.begin (); i != end; i++) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
400 |
{ |
5129 | 401 |
bool should_add = true; |
5168
72bf9328f412
Failed destination is structure of HWMP
Kirill Andreev <andreev@iitp.ru>
parents:
5162
diff
changeset
|
402 |
for (std::vector<HwmpProtocol::FailedDestination>::const_iterator j = m_myPerr.destinations.begin (); j |
5129 | 403 |
!= m_myPerr.destinations.end (); j++) |
404 |
{ |
|
405 |
if (((*i).destination == (*j).destination) && ((*j).seqnum > (*i).seqnum)) |
|
406 |
{ |
|
407 |
should_add = false; |
|
408 |
} |
|
409 |
} |
|
410 |
if (should_add) |
|
411 |
{ |
|
412 |
m_myPerr.destinations.push_back (*i); |
|
413 |
} |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
414 |
} |
5113
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
415 |
} |
5111 | 416 |
SendMyPerr (); |
417 |
} |
|
418 |
void |
|
5129 | 419 |
HwmpProtocolMac::SendMyPerr () |
5111 | 420 |
{ |
421 |
NS_LOG_FUNCTION_NOARGS (); |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
422 |
if (m_perrTimer.IsRunning ()) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
423 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
424 |
return; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
425 |
} |
5111 | 426 |
m_perrTimer = Simulator::Schedule (m_protocol->GetPerrMinInterval (), &HwmpProtocolMac::SendMyPerr, this); |
5113
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
427 |
ForwardPerr (m_myPerr.destinations, m_myPerr.receivers); |
a912d4372406
PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents:
5112
diff
changeset
|
428 |
m_myPerr.destinations.clear (); |
5111 | 429 |
m_myPerr.receivers.clear (); |
4793 | 430 |
} |
4944
779b641cff5a
Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents:
4943
diff
changeset
|
431 |
uint32_t |
5129 | 432 |
HwmpProtocolMac::GetLinkMetric (Mac48Address peerAddress) const |
4944
779b641cff5a
Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents:
4943
diff
changeset
|
433 |
{ |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5113
diff
changeset
|
434 |
return m_parent->GetLinkMetric (peerAddress); |
4944
779b641cff5a
Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents:
4943
diff
changeset
|
435 |
} |
4950
1163cfb03b9b
Broadcast is not forwarded twice into the same channel
Kirill Andreev <andreev@iitp.ru>
parents:
4949
diff
changeset
|
436 |
uint16_t |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5083
diff
changeset
|
437 |
HwmpProtocolMac::GetChannelId () const |
4950
1163cfb03b9b
Broadcast is not forwarded twice into the same channel
Kirill Andreev <andreev@iitp.ru>
parents:
4949
diff
changeset
|
438 |
{ |
1163cfb03b9b
Broadcast is not forwarded twice into the same channel
Kirill Andreev <andreev@iitp.ru>
parents:
4949
diff
changeset
|
439 |
return m_parent->GetFrequencyChannel (); |
1163cfb03b9b
Broadcast is not forwarded twice into the same channel
Kirill Andreev <andreev@iitp.ru>
parents:
4949
diff
changeset
|
440 |
} |
5126
8e06088a785d
Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents:
5125
diff
changeset
|
441 |
HwmpProtocolMac::Statistics::Statistics () : |
5129 | 442 |
txPreq (0), rxPreq (0), txPrep (0), rxPrep (0), txPerr (0), rxPerr (0), txMgt (0), txMgtBytes (0), |
443 |
rxMgt (0), rxMgtBytes (0), txData (0), txDataBytes (0), rxData (0), rxDataBytes (0) |
|
444 |
{ |
|
445 |
} |
|
5012 | 446 |
void |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5083
diff
changeset
|
447 |
HwmpProtocolMac::Statistics::Print (std::ostream & os) const |
5012 | 448 |
{ |
5015 | 449 |
os << "<Statistics " |
5156 | 450 |
"txPreq= \"" << txPreq << "\"" << std::endl << |
451 |
"txPrep=\"" << txPrep << "\"" << std::endl << |
|
452 |
"txPerr=\"" << txPerr << "\"" << std::endl << |
|
453 |
"rxPreq=\"" << rxPreq << "\"" << std::endl << |
|
454 |
"rxPrep=\"" << rxPrep << "\"" << std::endl << |
|
455 |
"rxPerr=\"" << rxPerr << "\"" << std::endl << |
|
456 |
"txMgt=\"" << txMgt << "\"" << std::endl << |
|
457 |
"txMgtBytes=\"" << txMgtBytes << "\"" << std::endl << |
|
458 |
"rxMgt=\"" << rxMgt << "\"" << std::endl << |
|
459 |
"rxMgtBytes=\"" << rxMgtBytes << "\"" << std::endl << |
|
460 |
"txData=\"" << txData << "\"" << std::endl << |
|
461 |
"txDataBytes=\"" << txDataBytes << "\"" << std::endl << |
|
462 |
"rxData=\"" << rxData << "\"" << std::endl << |
|
463 |
"rxDataBytes=\"" << rxDataBytes << "\"/>" << std::endl; |
|
5012 | 464 |
} |
465 |
void |
|
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5083
diff
changeset
|
466 |
HwmpProtocolMac::Report (std::ostream & os) const |
5012 | 467 |
{ |
5157
ace422ad12df
Cosmetics: '\n' was replaced with std::endl, Camel case for attributes
Kirill Andreev <andreev@iitp.ru>
parents:
5156
diff
changeset
|
468 |
os << "<HwmpProtocolMac" << std::endl << |
ace422ad12df
Cosmetics: '\n' was replaced with std::endl, Camel case for attributes
Kirill Andreev <andreev@iitp.ru>
parents:
5156
diff
changeset
|
469 |
"address =\"" << m_parent->GetAddress () << "\">" << std::endl; |
5129 | 470 |
m_stats.Print (os); |
5157
ace422ad12df
Cosmetics: '\n' was replaced with std::endl, Camel case for attributes
Kirill Andreev <andreev@iitp.ru>
parents:
5156
diff
changeset
|
471 |
os << "</HwmpProtocolMac>" << std::endl; |
5012 | 472 |
} |
5013 | 473 |
void |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5083
diff
changeset
|
474 |
HwmpProtocolMac::ResetStats () |
5013 | 475 |
{ |
476 |
m_stats = Statistics::Statistics (); |
|
477 |
} |
|
478 |
||
4886
bdbf21835837
HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents:
4884
diff
changeset
|
479 |
} //namespace dot11s |
4793 | 480 |
}//namespace ns3 |