author | Kirill Andreev <andreev@iitp.ru> |
Fri, 31 Jul 2009 14:13:10 +0400 | |
changeset 5139 | 87eb2f77f661 |
parent 5132 | aee541a30256 |
child 5140 | 64084ae6cff1 |
permissions | -rw-r--r-- |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
5129 | 2 |
/* |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 IITP RAS |
5129 | 4 |
* |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
8 |
* |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
13 |
* |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
5129 | 17 |
* |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
18 |
* Author: Kirill Andreev <andreev@iitp.ru> |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
19 |
*/ |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
20 |
|
4860
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4859
diff
changeset
|
21 |
#include "ie-dot11s-configuration.h" |
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4859
diff
changeset
|
22 |
#include "ie-dot11s-peer-management.h" |
4956
aba7cae978ac
MeshWifiMacHeader moved to Dot11sMacHeader. test to it is written
Kirill Andreev <andreev@iitp.ru>
parents:
4953
diff
changeset
|
23 |
#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:
5038
diff
changeset
|
24 |
#include "peer-management-protocol-mac.h" |
4887
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4882
diff
changeset
|
25 |
#include "peer-management-protocol.h" |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
26 |
#include "peer-link-frame.h" |
4887
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4882
diff
changeset
|
27 |
#include "ns3/mesh-wifi-interface-mac.h" |
4861 | 28 |
#include "ns3/simulator.h" |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
29 |
#include "ns3/wifi-mac-header.h" |
5139
87eb2f77f661
Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
30 |
#include "ns3/ie-vector.h" |
87eb2f77f661
Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
31 |
#include "ns3/log.h" |
5132
aee541a30256
Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents:
5129
diff
changeset
|
32 |
namespace ns3 { |
aee541a30256
Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents:
5129
diff
changeset
|
33 |
namespace dot11s { |
5129 | 34 |
PeerManagementProtocolMac::PeerManagementProtocolMac (uint32_t interface, |
35 |
Ptr<PeerManagementProtocol> protocol) |
|
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
36 |
{ |
4861 | 37 |
m_ifIndex = interface; |
38 |
m_protocol = protocol; |
|
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
39 |
} |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
40 |
|
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5038
diff
changeset
|
41 |
PeerManagementProtocolMac::~PeerManagementProtocolMac () |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
42 |
{ |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
43 |
} |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
44 |
|
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
45 |
void |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5038
diff
changeset
|
46 |
PeerManagementProtocolMac::SetParent (Ptr<MeshWifiInterfaceMac> parent) |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
47 |
{ |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
4856
diff
changeset
|
48 |
m_parent = parent; |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
49 |
} |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
50 |
|
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
51 |
bool |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5038
diff
changeset
|
52 |
PeerManagementProtocolMac::Receive (Ptr<Packet> const_packet, const WifiMacHeader & header) |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
53 |
{ |
4881
cec7f8e2bbdf
Minor cosmetics. Peer management protocol is assumed to be implemented now.
Pavel Boyko <boyko@iitp.ru>
parents:
4879
diff
changeset
|
54 |
// First of all we copy a packet, because we need to remove some |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
55 |
//headers |
5129 | 56 |
Ptr<Packet> packet = const_packet->Copy (); |
57 |
if (header.IsBeacon ()) |
|
58 |
{ |
|
59 |
MgtBeaconHeader beacon_hdr; |
|
5139
87eb2f77f661
Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
60 |
packet->RemoveHeader (beacon_hdr); |
87eb2f77f661
Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
61 |
//meshId.FindFirst (myBeacon); |
5129 | 62 |
bool meshBeacon = false; |
5139
87eb2f77f661
Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
63 |
WifiInformationElementVector elements = WifiInformationElementVector::DeserializePacket (packet); |
87eb2f77f661
Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
64 |
Ptr<IeBeaconTiming> beaconTiming = DynamicCast<IeBeaconTiming> (elements.FindFirst (IE11S_BEACON_TIMING)); |
87eb2f77f661
Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
65 |
Ptr<IeMeshId> meshId = DynamicCast<IeMeshId> (elements.FindFirst (IE11S_MESH_ID)); |
87eb2f77f661
Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
66 |
|
87eb2f77f661
Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
67 |
if ((beaconTiming != 0) && (meshId != 0)) |
5129 | 68 |
{ |
5139
87eb2f77f661
Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
69 |
if (m_protocol->GetMeshId ()->IsEqual (*meshId)) |
87eb2f77f661
Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
70 |
{ |
87eb2f77f661
Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
71 |
meshBeacon = true; |
87eb2f77f661
Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
72 |
} |
5129 | 73 |
} |
5139
87eb2f77f661
Added wifi-information-element-vector
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
74 |
m_protocol->UpdatePeerBeaconTiming (m_ifIndex, meshBeacon, *beaconTiming, header.GetAddr2 (), |
5129 | 75 |
Simulator::Now (), MicroSeconds (beacon_hdr.GetBeaconIntervalUs ())); |
76 |
// Beacon shall not be dropeed. May be needed to another plugins |
|
77 |
return true; |
|
78 |
} |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
79 |
if (header.IsAction ()) |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
80 |
{ |
5129 | 81 |
WifiMeshActionHeader actionHdr; |
82 |
packet->RemoveHeader (actionHdr); |
|
83 |
WifiMeshActionHeader::ActionValue actionValue = actionHdr.GetAction (); |
|
84 |
// If can not handle - just return; |
|
85 |
if (actionHdr.GetCategory () != WifiMeshActionHeader::MESH_PEERING_MGT) |
|
86 |
{ |
|
87 |
return m_protocol->IsActiveLink (m_ifIndex, header.GetAddr2 ()); |
|
88 |
} |
|
89 |
m_stats.rxMgt++; |
|
90 |
m_stats.rxMgtBytes += packet->GetSize (); |
|
91 |
Mac48Address peerAddress = header.GetAddr2 (); |
|
92 |
Mac48Address peerMpAddress = header.GetAddr3 (); |
|
93 |
PeerLinkFrameStart::PlinkFrameStartFields fields; |
|
94 |
{ |
|
95 |
PeerLinkFrameStart peerFrame; |
|
96 |
peerFrame.SetPlinkFrameSubtype ((uint8_t) actionValue.peerLink); |
|
97 |
packet->RemoveHeader (peerFrame); |
|
98 |
fields = peerFrame.GetFields (); |
|
99 |
NS_ASSERT (fields.subtype == actionValue.peerLink); |
|
100 |
} |
|
101 |
if ((actionValue.peerLink != WifiMeshActionHeader::PEER_LINK_CLOSE) && !(m_parent->CheckSupportedRates ( |
|
102 |
fields.rates))) |
|
103 |
{ |
|
104 |
m_protocol->ConfigurationMismatch (m_ifIndex, peerAddress); |
|
105 |
// Broken peer link frame - drop it |
|
106 |
m_stats.brokenMgt++; |
|
107 |
return false; |
|
108 |
} |
|
109 |
if ((actionValue.peerLink != WifiMeshActionHeader::PEER_LINK_CONFIRM) && !fields.meshId.IsEqual ( |
|
110 |
*(m_protocol->GetMeshId ()))) |
|
111 |
{ |
|
112 |
m_protocol->ConfigurationMismatch (m_ifIndex, peerAddress); |
|
113 |
// Broken peer link frame - drop it |
|
114 |
m_stats.brokenMgt++; |
|
115 |
return false; |
|
116 |
} |
|
117 |
IePeerManagement peerElement; |
|
118 |
packet->RemoveHeader (peerElement); |
|
119 |
//Check taht frame subtype corresponds peer link subtype |
|
120 |
if (peerElement.SubtypeIsOpen ()) |
|
121 |
{ |
|
122 |
m_stats.rxOpen++; |
|
123 |
NS_ASSERT (actionValue.peerLink == WifiMeshActionHeader::PEER_LINK_OPEN); |
|
124 |
} |
|
125 |
if (peerElement.SubtypeIsConfirm ()) |
|
126 |
{ |
|
127 |
m_stats.rxConfirm++; |
|
128 |
NS_ASSERT (actionValue.peerLink == WifiMeshActionHeader::PEER_LINK_CONFIRM); |
|
129 |
} |
|
130 |
if (peerElement.SubtypeIsClose ()) |
|
131 |
{ |
|
132 |
m_stats.rxClose++; |
|
133 |
NS_ASSERT (actionValue.peerLink == WifiMeshActionHeader::PEER_LINK_CLOSE); |
|
134 |
} |
|
135 |
//Deliver Peer link management frame to protocol: |
|
136 |
m_protocol->ReceivePeerLinkFrame (m_ifIndex, peerAddress, peerMpAddress, fields.aid, peerElement, |
|
137 |
fields.config); |
|
138 |
// if we can handle a frame - drop it |
|
139 |
return false; |
|
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
140 |
} |
5129 | 141 |
return m_protocol->IsActiveLink (m_ifIndex, header.GetAddr2 ()); |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
142 |
} |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
143 |
bool |
5129 | 144 |
PeerManagementProtocolMac::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, |
145 |
Mac48Address from, Mac48Address to) |
|
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
146 |
{ |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
147 |
if (header.IsAction ()) |
5129 | 148 |
{ |
149 |
WifiMeshActionHeader actionHdr; |
|
150 |
packet->PeekHeader (actionHdr); |
|
151 |
WifiMeshActionHeader::ActionValue actionValue = actionHdr.GetAction (); |
|
152 |
if (actionHdr.GetCategory () == WifiMeshActionHeader::MESH_PEERING_MGT) |
|
153 |
{ |
|
154 |
return true; |
|
155 |
} |
|
156 |
} |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
157 |
if (header.GetAddr1 ().IsGroup ()) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
158 |
{ |
5012 | 159 |
return true; |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
160 |
} |
5129 | 161 |
else |
5012 | 162 |
{ |
5129 | 163 |
if (m_protocol->IsActiveLink (m_ifIndex, header.GetAddr1 ())) |
164 |
{ |
|
165 |
return true; |
|
166 |
} |
|
167 |
else |
|
168 |
{ |
|
169 |
m_stats.dropped++; |
|
170 |
return false; |
|
171 |
} |
|
5012 | 172 |
} |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
173 |
} |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
174 |
void |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5038
diff
changeset
|
175 |
PeerManagementProtocolMac::UpdateBeacon (MeshWifiBeacon & beacon) const |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
176 |
{ |
5129 | 177 |
Ptr<IeBeaconTiming> beaconTiming = m_protocol->GetBeaconTimingElement (m_ifIndex); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
178 |
beacon.AddInformationElement (beaconTiming); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
179 |
beacon.AddInformationElement (m_protocol->GetMeshId ()); |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
180 |
} |
4881
cec7f8e2bbdf
Minor cosmetics. Peer management protocol is assumed to be implemented now.
Pavel Boyko <boyko@iitp.ru>
parents:
4879
diff
changeset
|
181 |
|
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
182 |
void |
5129 | 183 |
PeerManagementProtocolMac::SendPeerLinkManagementFrame (Mac48Address peerAddress, Mac48Address peerMpAddress, |
184 |
uint16_t aid, IePeerManagement peerElement, IeConfiguration meshConfig) |
|
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
185 |
{ |
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
186 |
//Create a packet: |
5017
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5015
diff
changeset
|
187 |
meshConfig.SetNeighborCount (m_protocol->GetNumberOfLinks ()); |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
188 |
Ptr<Packet> packet = Create<Packet> (); |
4867
3a02e4e89292
Finished processing peer link frames on new architeture
Kirill Andreev <andreev@iitp.ru>
parents:
4866
diff
changeset
|
189 |
packet->AddHeader (peerElement); |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
190 |
PeerLinkFrameStart::PlinkFrameStartFields fields; |
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
191 |
fields.rates = m_parent->GetSupportedRates (); |
5023
fce378307409
Moving to IEEE 802.11s Draft 3.0:
Andrey Mazo <mazo@iitp.ru>
parents:
5020
diff
changeset
|
192 |
fields.capability = 0; |
5020
79e8178d69eb
Mesh ID is made separately from SSID
Kirill Andreev <andreev@iitp.ru>
parents:
5017
diff
changeset
|
193 |
fields.meshId = *(m_protocol->GetMeshId ()); |
4973
59b050ada622
Restructured peer link frame
Kirill Andreev <andreev@iitp.ru>
parents:
4970
diff
changeset
|
194 |
fields.config = meshConfig; |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
195 |
PeerLinkFrameStart plinkFrame; |
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
196 |
//Create an 802.11 frame header: |
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
197 |
//Send management frame to MAC: |
4984
77ab6e01a1c3
Outgoing data packets are dropped if there is no active link, MultihopAction
Kirill Andreev <andreev@iitp.ru>
parents:
4977
diff
changeset
|
198 |
WifiMeshActionHeader actionHdr; |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
199 |
if (peerElement.SubtypeIsOpen ()) |
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
200 |
{ |
5129 | 201 |
m_stats.txOpen++; |
4984
77ab6e01a1c3
Outgoing data packets are dropped if there is no active link, MultihopAction
Kirill Andreev <andreev@iitp.ru>
parents:
4977
diff
changeset
|
202 |
WifiMeshActionHeader::ActionValue action; |
77ab6e01a1c3
Outgoing data packets are dropped if there is no active link, MultihopAction
Kirill Andreev <andreev@iitp.ru>
parents:
4977
diff
changeset
|
203 |
action.peerLink = WifiMeshActionHeader::PEER_LINK_OPEN; |
77ab6e01a1c3
Outgoing data packets are dropped if there is no active link, MultihopAction
Kirill Andreev <andreev@iitp.ru>
parents:
4977
diff
changeset
|
204 |
fields.subtype = WifiMeshActionHeader::PEER_LINK_OPEN; |
5027
2f926202a5bf
Moving to IEEE 802.11s Draft 3.0 (Mesh Control Field, Beacon Timing Element):
Andrey Mazo <mazo@iitp.ru>
parents:
5023
diff
changeset
|
205 |
actionHdr.SetAction (WifiMeshActionHeader::MESH_PEERING_MGT, action); |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
206 |
} |
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
207 |
if (peerElement.SubtypeIsConfirm ()) |
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
208 |
{ |
5129 | 209 |
m_stats.txConfirm++; |
4984
77ab6e01a1c3
Outgoing data packets are dropped if there is no active link, MultihopAction
Kirill Andreev <andreev@iitp.ru>
parents:
4977
diff
changeset
|
210 |
WifiMeshActionHeader::ActionValue action; |
77ab6e01a1c3
Outgoing data packets are dropped if there is no active link, MultihopAction
Kirill Andreev <andreev@iitp.ru>
parents:
4977
diff
changeset
|
211 |
action.peerLink = WifiMeshActionHeader::PEER_LINK_CONFIRM; |
4957
3ce177c38776
Resturctured peer link frame - removed unneeded field "subtype", added unit
Kirill Andreev <andreev@iitp.ru>
parents:
4956
diff
changeset
|
212 |
fields.aid = aid; |
4984
77ab6e01a1c3
Outgoing data packets are dropped if there is no active link, MultihopAction
Kirill Andreev <andreev@iitp.ru>
parents:
4977
diff
changeset
|
213 |
fields.subtype = WifiMeshActionHeader::PEER_LINK_CONFIRM; |
5027
2f926202a5bf
Moving to IEEE 802.11s Draft 3.0 (Mesh Control Field, Beacon Timing Element):
Andrey Mazo <mazo@iitp.ru>
parents:
5023
diff
changeset
|
214 |
actionHdr.SetAction (WifiMeshActionHeader::MESH_PEERING_MGT, action); |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
215 |
} |
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
216 |
if (peerElement.SubtypeIsClose ()) |
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
217 |
{ |
5129 | 218 |
m_stats.txClose++; |
4984
77ab6e01a1c3
Outgoing data packets are dropped if there is no active link, MultihopAction
Kirill Andreev <andreev@iitp.ru>
parents:
4977
diff
changeset
|
219 |
WifiMeshActionHeader::ActionValue action; |
77ab6e01a1c3
Outgoing data packets are dropped if there is no active link, MultihopAction
Kirill Andreev <andreev@iitp.ru>
parents:
4977
diff
changeset
|
220 |
action.peerLink = WifiMeshActionHeader::PEER_LINK_CLOSE; |
77ab6e01a1c3
Outgoing data packets are dropped if there is no active link, MultihopAction
Kirill Andreev <andreev@iitp.ru>
parents:
4977
diff
changeset
|
221 |
fields.subtype = WifiMeshActionHeader::PEER_LINK_CLOSE; |
4957
3ce177c38776
Resturctured peer link frame - removed unneeded field "subtype", added unit
Kirill Andreev <andreev@iitp.ru>
parents:
4956
diff
changeset
|
222 |
fields.reasonCode = peerElement.GetReasonCode (); |
5027
2f926202a5bf
Moving to IEEE 802.11s Draft 3.0 (Mesh Control Field, Beacon Timing Element):
Andrey Mazo <mazo@iitp.ru>
parents:
5023
diff
changeset
|
223 |
actionHdr.SetAction (WifiMeshActionHeader::MESH_PEERING_MGT, action); |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
224 |
} |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
225 |
plinkFrame.SetPlinkFrameStart (fields); |
4957
3ce177c38776
Resturctured peer link frame - removed unneeded field "subtype", added unit
Kirill Andreev <andreev@iitp.ru>
parents:
4956
diff
changeset
|
226 |
packet->AddHeader (plinkFrame); |
4984
77ab6e01a1c3
Outgoing data packets are dropped if there is no active link, MultihopAction
Kirill Andreev <andreev@iitp.ru>
parents:
4977
diff
changeset
|
227 |
packet->AddHeader (actionHdr); |
5129 | 228 |
m_stats.txMgt++; |
5038 | 229 |
m_stats.txMgtBytes += packet->GetSize (); |
4968
ff5a2162d492
MulthopAction -> Action management frames in 802.11s according to std
Pavel Boyko <boyko@iitp.ru>
parents:
4957
diff
changeset
|
230 |
// Wifi Mac header: |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
231 |
WifiMacHeader hdr; |
4968
ff5a2162d492
MulthopAction -> Action management frames in 802.11s according to std
Pavel Boyko <boyko@iitp.ru>
parents:
4957
diff
changeset
|
232 |
hdr.SetAction (); |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
233 |
hdr.SetAddr1 (peerAddress); |
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
234 |
hdr.SetAddr2 (m_parent->GetAddress ()); |
4970
320f59d9df27
Removed mesh header from acion management frames
Kirill Andreev <andreev@iitp.ru>
parents:
4968
diff
changeset
|
235 |
//Addr is not used here, we use it as our MP address |
320f59d9df27
Removed mesh header from acion management frames
Kirill Andreev <andreev@iitp.ru>
parents:
4968
diff
changeset
|
236 |
hdr.SetAddr3 (m_protocol->GetAddress ()); |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
237 |
hdr.SetDsNotFrom (); |
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
238 |
hdr.SetDsNotTo (); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
239 |
m_parent->SendManagementFrame (packet, hdr); |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
240 |
} |
4881
cec7f8e2bbdf
Minor cosmetics. Peer management protocol is assumed to be implemented now.
Pavel Boyko <boyko@iitp.ru>
parents:
4879
diff
changeset
|
241 |
|
4869 | 242 |
Mac48Address |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5038
diff
changeset
|
243 |
PeerManagementProtocolMac::GetAddress () const |
4869 | 244 |
{ |
5129 | 245 |
if (m_parent != 0) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
246 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
247 |
return m_parent->GetAddress (); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
248 |
} |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
249 |
else |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
250 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
251 |
return Mac48Address::Mac48Address (); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
252 |
} |
4869 | 253 |
} |
5129 | 254 |
std::pair<Time, Time> |
255 |
PeerManagementProtocolMac::GetBeaconInfo () const |
|
4879 | 256 |
{ |
5129 | 257 |
std::pair<Time, Time> retval; |
4879 | 258 |
retval.first = m_parent->GetTbtt (); |
259 |
retval.second = m_parent->GetBeaconInterval (); |
|
260 |
return retval; |
|
261 |
} |
|
262 |
void |
|
5129 | 263 |
PeerManagementProtocolMac::SetBeaconShift (Time shift) |
4879 | 264 |
{ |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
265 |
if (shift != Seconds (0)) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
266 |
{ |
5129 | 267 |
m_stats.beaconShift++; |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
268 |
} |
4879 | 269 |
m_parent->ShiftTbtt (shift); |
270 |
} |
|
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5038
diff
changeset
|
271 |
PeerManagementProtocolMac::Statistics::Statistics () : |
5129 | 272 |
txOpen (0), txConfirm (0), txClose (0), rxOpen (0), rxConfirm (0), rxClose (0), dropped (0), brokenMgt (0), |
273 |
txMgt (0), txMgtBytes (0), rxMgt (0), rxMgtBytes (0), beaconShift (0) |
|
5009
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
5002
diff
changeset
|
274 |
{ |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
5002
diff
changeset
|
275 |
} |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
5002
diff
changeset
|
276 |
void |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5038
diff
changeset
|
277 |
PeerManagementProtocolMac::Statistics::Print (std::ostream & os) const |
5009
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
5002
diff
changeset
|
278 |
{ |
5015 | 279 |
os << "<Statistics " |
5038 | 280 |
"txOpen=\"" << txOpen << "\"\n" |
281 |
"txConfirm=\"" << txConfirm << "\"\n" |
|
282 |
"txClose=\"" << txClose << "\"\n" |
|
283 |
"rxOpen=\"" << rxOpen << "\"\n" |
|
284 |
"rxConfirm=\"" << rxConfirm << "\"\n" |
|
285 |
"rxClose=\"" << rxClose << "\"\n" |
|
5015 | 286 |
"dropped=\"" << dropped << "\"\n" |
287 |
"brokenMgt=\"" << brokenMgt << "\"\n" |
|
5038 | 288 |
"txMgt=\"" << txMgt << "\"\n" |
5098
13ded9ff11c4
XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents:
5087
diff
changeset
|
289 |
"txMgtBytes=\"" << txMgtBytes << "\"\n" |
5038 | 290 |
"rxMgt=\"" << rxMgt << "\"\n" |
5098
13ded9ff11c4
XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents:
5087
diff
changeset
|
291 |
"rxMgtBytes=\"" << rxMgtBytes << "\"\n" |
5015 | 292 |
"beaconShift=\"" << beaconShift << "\"/>\n"; |
5009
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
5002
diff
changeset
|
293 |
} |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
5002
diff
changeset
|
294 |
void |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5038
diff
changeset
|
295 |
PeerManagementProtocolMac::Report (std::ostream & os) const |
5009
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
5002
diff
changeset
|
296 |
{ |
5087 | 297 |
os << "<PeerManagementProtocolMac " |
5015 | 298 |
"address=\"" << m_parent->GetAddress () << "\">\n"; |
5009
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
5002
diff
changeset
|
299 |
m_stats.Print (os); |
5087 | 300 |
os << "</PeerManagementProtocolMac>\n"; |
5009
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
5002
diff
changeset
|
301 |
} |
5013 | 302 |
void |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5038
diff
changeset
|
303 |
PeerManagementProtocolMac::ResetStats () |
5013 | 304 |
{ |
305 |
m_stats = Statistics::Statistics (); |
|
306 |
} |
|
5015 | 307 |
uint32_t |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5038
diff
changeset
|
308 |
PeerManagementProtocolMac::GetLinkMetric (Mac48Address peerAddress) |
5015 | 309 |
{ |
310 |
return m_parent->GetLinkMetric (peerAddress); |
|
311 |
} |
|
4872 | 312 |
} // namespace dot11s |
313 |
} //namespace ns3 |
|
314 |