author | Kirill Andreev <andreev@iitp.ru> |
Tue, 21 Jul 2009 12:51:09 +0400 | |
changeset 5125 | b90c6c0af6a3 |
parent 5098 | 13ded9ff11c4 |
child 5126 | 8e06088a785d |
permissions | -rw-r--r-- |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
2 |
/* |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
3 |
* Copyright (c) 2008,2009 IITP RAS |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
4 |
* |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
8 |
* |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
13 |
* |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
17 |
* |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
18 |
* Authors: Kirill Andreev <andreev@iitp.ru> |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
19 |
* Aleksey Kovalenko <kovalenko@iitp.ru> |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
20 |
*/ |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
21 |
|
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
22 |
|
4882
3eab2f6b1adc
Moved hwmp to dot11s, removed unneded files, removed unneded headers from
Kirill Andreev <andreev@iitp.ru>
parents:
4881
diff
changeset
|
23 |
#include "peer-management-protocol.h" |
4860
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
24 |
|
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 "ie-dot11s-peer-management.h" |
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4882
diff
changeset
|
26 |
#include "ie-dot11s-configuration.h" |
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4882
diff
changeset
|
27 |
|
4888
dec245c213ab
Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents:
4887
diff
changeset
|
28 |
#include "ns3/mesh-point-device.h" |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
29 |
#include "ns3/simulator.h" |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
30 |
#include "ns3/assert.h" |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
31 |
#include "ns3/log.h" |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
32 |
#include "ns3/random-variable.h" |
4858
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
33 |
#include "ns3/mesh-wifi-interface-mac.h" |
4872 | 34 |
#include "ns3/mesh-wifi-interface-mac-plugin.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
|
35 |
#include "ns3/wifi-net-device.h" |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
36 |
#include "peer-link.h" |
4860
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
37 |
|
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
38 |
NS_LOG_COMPONENT_DEFINE ("PeerManagementProtocol"); |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
39 |
namespace ns3 { |
4872 | 40 |
namespace dot11s { |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
41 |
/*************************************************** |
5063 | 42 |
* PeerManager |
43 |
***************************************************/ |
|
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
44 |
NS_OBJECT_ENSURE_REGISTERED (PeerManagementProtocol); |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
45 |
|
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
46 |
TypeId |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
47 |
PeerManagementProtocol::GetTypeId (void) |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
48 |
{ |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
49 |
static TypeId tid = TypeId ("ns3::dot11s::PeerManagementProtocol") |
5063 | 50 |
.SetParent<Object> () |
51 |
.AddConstructor<PeerManagementProtocol> () |
|
52 |
// maximum number of peer links. Now we calculate the total |
|
53 |
// number of peer links on all interfaces |
|
54 |
.AddAttribute ("MaxNumberOfPeerLinks", |
|
55 |
"Maximum number of peer links", |
|
56 |
UintegerValue (32), |
|
57 |
MakeUintegerAccessor (&PeerManagementProtocol::m_maxNumberOfPeerLinks), |
|
58 |
MakeUintegerChecker<uint8_t> () |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
59 |
) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
60 |
.AddAttribute ("MaxBeaconLossForBeaconTiming", |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
61 |
"If maximum number of beacons were lost, station will not included in beacon timing element", |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
62 |
UintegerValue (3), |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
63 |
MakeUintegerAccessor (&PeerManagementProtocol::m_maxBeaconLostForBeaconTiming), |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
64 |
MakeUintegerChecker<uint8_t> () |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
65 |
) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
66 |
; |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
67 |
return tid; |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
68 |
} |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
69 |
PeerManagementProtocol::PeerManagementProtocol (): |
4868 | 70 |
m_lastAssocId (0), |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
71 |
m_lastLocalLinkId (1), |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
72 |
m_maxBeaconLostForBeaconTiming (3) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
73 |
{} |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
74 |
PeerManagementProtocol::~PeerManagementProtocol () |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
75 |
{ |
5005
8038200dac53
Fixed removing peer links
Kirill Andreev <andreev@iitp.ru>
parents:
5003
diff
changeset
|
76 |
} |
8038200dac53
Fixed removing peer links
Kirill Andreev <andreev@iitp.ru>
parents:
5003
diff
changeset
|
77 |
void |
8038200dac53
Fixed removing peer links
Kirill Andreev <andreev@iitp.ru>
parents:
5003
diff
changeset
|
78 |
PeerManagementProtocol::DoDispose () |
8038200dac53
Fixed removing peer links
Kirill Andreev <andreev@iitp.ru>
parents:
5003
diff
changeset
|
79 |
{ |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
80 |
//cancel cleanup event and go through the map of peer links, |
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
81 |
//deleting each |
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
82 |
for (PeerLinksMap::iterator j = m_peerLinks.begin (); j != m_peerLinks.end (); j++) |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
83 |
{ |
4870
79f9c2b6dffc
Uncommented destructor and cleaner
Kirill Andreev <andreev@iitp.ru>
parents:
4869
diff
changeset
|
84 |
for (PeerLinksOnInterface::iterator i = j->second.begin (); i != j->second.end(); i++) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
85 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
86 |
(*i) = 0; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
87 |
} |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
88 |
j->second.clear (); |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
89 |
} |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
90 |
m_peerLinks.clear (); |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
91 |
//cleaning beacon structures: |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
92 |
for (BeaconInfoMap::iterator i = m_neighbourBeacons.begin (); i != m_neighbourBeacons.end (); i ++) |
5063 | 93 |
{ |
94 |
i->second.clear(); |
|
95 |
} |
|
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
96 |
m_neighbourBeacons.clear(); |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
97 |
} |
4870
79f9c2b6dffc
Uncommented destructor and cleaner
Kirill Andreev <andreev@iitp.ru>
parents:
4869
diff
changeset
|
98 |
|
4858
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
99 |
bool |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
100 |
PeerManagementProtocol::Install (Ptr<MeshPointDevice> mp) |
4858
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
101 |
{ |
4888
dec245c213ab
Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents:
4887
diff
changeset
|
102 |
std::vector<Ptr<NetDevice> > interfaces = mp->GetInterfaces (); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
103 |
for (std::vector<Ptr<NetDevice> >::iterator i = interfaces.begin (); i != interfaces.end (); i ++) |
5063 | 104 |
{ |
105 |
Ptr<WifiNetDevice> wifiNetDev = (*i)->GetObject<WifiNetDevice> (); |
|
106 |
if (wifiNetDev == 0) |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
107 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
108 |
return false; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
109 |
} |
5063 | 110 |
Ptr<MeshWifiInterfaceMac> mac = wifiNetDev->GetMac ()->GetObject<MeshWifiInterfaceMac> (); |
111 |
if (mac == 0) |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
112 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
113 |
return false; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
114 |
} |
5087 | 115 |
Ptr<PeerManagementProtocolMac> plugin = Create<PeerManagementProtocolMac> ((*i)->GetIfIndex(), this); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
116 |
mac->InstallPlugin (plugin); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
117 |
m_plugins[(*i)->GetIfIndex ()] = plugin; |
5063 | 118 |
PeerLinksOnInterface newmap; |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
119 |
m_peerLinks[(*i)->GetIfIndex ()] = newmap; |
5063 | 120 |
} |
4898
b079cb67fda2
For now mesh point aggregates installed protocols. This is done to allow user directly access protocols via mp->GetObject<...>() (though you must known mesh point and protocol class to do this)
Pavel Boyko <boyko@iitp.ru>
parents:
4895
diff
changeset
|
121 |
// Mesh point aggregates all installed protocols |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
122 |
m_address = Mac48Address::ConvertFrom (mp->GetAddress ()); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
123 |
mp->AggregateObject (this); |
4858
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
124 |
return true; |
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
125 |
} |
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
126 |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
127 |
Ptr<IeBeaconTiming> |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
128 |
PeerManagementProtocol::GetBeaconTimingElement (uint32_t interface) |
4858
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
129 |
{ |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
130 |
Ptr<IeBeaconTiming> retval = Create<IeBeaconTiming> (); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
131 |
BeaconInfoMap::iterator i = m_neighbourBeacons.find (interface); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
132 |
if (i == m_neighbourBeacons.end ()) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
133 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
134 |
return retval; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
135 |
} |
4879 | 136 |
bool cleaned = false; |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
137 |
while (!cleaned) |
4879 | 138 |
{ |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
139 |
for (BeaconsOnInterface::iterator j = i->second.begin (); j != i->second.end (); j++) |
5063 | 140 |
{ |
141 |
//check beacon loss and make a timing element |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
142 |
//if last beacon was m_maxBeaconLostForBeaconTiming beacons ago - we do not put it to the |
5063 | 143 |
//timing element |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
144 |
if ((j->second.referenceTbtt + j->second.beaconInterval * Scalar (m_maxBeaconLostForBeaconTiming)) < Simulator::Now ()) |
5063 | 145 |
{ |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
146 |
i->second.erase (j); |
5063 | 147 |
break; |
148 |
} |
|
149 |
} |
|
150 |
cleaned = true; |
|
4879 | 151 |
} |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
152 |
for (BeaconsOnInterface::const_iterator j = i->second.begin (); j != i->second.end (); j++) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
153 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
154 |
retval->AddNeighboursTimingElementUnit (j->second.aid, j->second.referenceTbtt, j->second.beaconInterval); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
155 |
} |
4858
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
156 |
return retval; |
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
157 |
} |
4881
cec7f8e2bbdf
Minor cosmetics. Peer management protocol is assumed to be implemented now.
Pavel Boyko <boyko@iitp.ru>
parents:
4880
diff
changeset
|
158 |
|
4867
3a02e4e89292
Finished processing peer link frames on new architeture
Kirill Andreev <andreev@iitp.ru>
parents:
4866
diff
changeset
|
159 |
void |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
160 |
PeerManagementProtocol::FillBeaconInfo (uint32_t interface, Mac48Address peerAddress, Time receivingTime, Time beaconInterval) |
4867
3a02e4e89292
Finished processing peer link frames on new architeture
Kirill Andreev <andreev@iitp.ru>
parents:
4866
diff
changeset
|
161 |
{ |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
162 |
BeaconInfoMap::iterator i = m_neighbourBeacons.find (interface); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
163 |
if (i == m_neighbourBeacons.end ()) |
5063 | 164 |
{ |
165 |
BeaconsOnInterface newMap; |
|
166 |
m_neighbourBeacons[interface] = newMap; |
|
167 |
} |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
168 |
i = m_neighbourBeacons.find (interface); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
169 |
BeaconsOnInterface::iterator j = i->second.find (peerAddress); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
170 |
if (j == i->second.end ()) |
5063 | 171 |
{ |
172 |
BeaconInfo newInfo; |
|
173 |
newInfo.referenceTbtt = receivingTime; |
|
174 |
newInfo.beaconInterval = beaconInterval; |
|
175 |
newInfo.aid = m_lastAssocId++; |
|
176 |
if(m_lastAssocId == 0xff) |
|
177 |
m_lastAssocId = 0; |
|
178 |
i->second[peerAddress] = newInfo; |
|
179 |
} |
|
4867
3a02e4e89292
Finished processing peer link frames on new architeture
Kirill Andreev <andreev@iitp.ru>
parents:
4866
diff
changeset
|
180 |
else |
5063 | 181 |
{ |
182 |
j->second.referenceTbtt = receivingTime; |
|
183 |
j->second.beaconInterval = beaconInterval; |
|
184 |
} |
|
4867
3a02e4e89292
Finished processing peer link frames on new architeture
Kirill Andreev <andreev@iitp.ru>
parents:
4866
diff
changeset
|
185 |
} |
4858
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
186 |
|
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
187 |
void |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
188 |
PeerManagementProtocol::UpdatePeerBeaconTiming ( |
4861 | 189 |
uint32_t interface, |
190 |
bool meshBeacon, |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
191 |
IeBeaconTiming timingElement, |
4858
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
192 |
Mac48Address peerAddress, |
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
193 |
Time receivingTime, |
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
194 |
Time beaconInterval) |
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
195 |
{ |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
196 |
FillBeaconInfo (interface, peerAddress, receivingTime, beaconInterval); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
197 |
if (!meshBeacon) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
198 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
199 |
return; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
200 |
} |
5063 | 201 |
//BCA: |
5087 | 202 |
PeerManagementProtocolMacMap::iterator plugin = m_plugins.find (interface); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
203 |
NS_ASSERT (plugin != m_plugins.end ()); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
204 |
Time shift = GetNextBeaconShift (interface); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
205 |
if (TimeToTu (shift) != 0) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
206 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
207 |
plugin->second->SetBeaconShift(shift); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
208 |
} |
5063 | 209 |
//PM STATE Machine |
210 |
//Check that a given beacon is not from our interface |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
211 |
for (PeerManagementProtocolMacMap::const_iterator i = m_plugins.begin (); i != m_plugins.end (); i ++) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
212 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
213 |
if (i->second->GetAddress () == peerAddress) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
214 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
215 |
return; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
216 |
} |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
217 |
} |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
218 |
Ptr<PeerLink> peerLink = FindPeerLink (interface, peerAddress); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
219 |
if (peerLink !=0) |
5063 | 220 |
{ |
221 |
peerLink->SetBeaconTimingElement (timingElement); |
|
222 |
peerLink->SetBeaconInformation (receivingTime, beaconInterval); |
|
223 |
} |
|
224 |
else |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
225 |
{ |
5063 | 226 |
if (ShouldSendOpen (interface, peerAddress)) |
5075 | 227 |
{ |
228 |
peerLink = InitiateLink (interface, peerAddress, Mac48Address::GetBroadcast (), receivingTime, beaconInterval); |
|
229 |
peerLink->SetBeaconTimingElement (timingElement); |
|
5063 | 230 |
peerLink->MLMEActivePeerLinkOpen (); |
5075 | 231 |
} |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
232 |
} |
4858
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
233 |
} |
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
234 |
|
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
235 |
void |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
236 |
PeerManagementProtocol::ReceivePeerLinkFrame ( |
4861 | 237 |
uint32_t interface, |
4858
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
238 |
Mac48Address peerAddress, |
4933
72f0481cfb2d
Peer link restructured to support multi-interface
Kirill Andreev <andreev@iitp.ru>
parents:
4926
diff
changeset
|
239 |
Mac48Address peerMeshPointAddress, |
4858
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
240 |
uint16_t aid, |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
241 |
IePeerManagement peerManagementElement, |
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
242 |
IeConfiguration meshConfig |
5063 | 243 |
) |
4858
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
244 |
{ |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
245 |
Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress); |
4867
3a02e4e89292
Finished processing peer link frames on new architeture
Kirill Andreev <andreev@iitp.ru>
parents:
4866
diff
changeset
|
246 |
if (peerManagementElement.SubtypeIsOpen ()) |
3a02e4e89292
Finished processing peer link frames on new architeture
Kirill Andreev <andreev@iitp.ru>
parents:
4866
diff
changeset
|
247 |
{ |
5063 | 248 |
PmpReasonCode reasonCode; |
249 |
bool reject = ! (ShouldAcceptOpen (interface, peerAddress,reasonCode)); |
|
250 |
if (peerLink == 0) |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
251 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
252 |
peerLink = InitiateLink (interface, peerAddress, peerMeshPointAddress, Simulator::Now (), Seconds(1.0)); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
253 |
} |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
254 |
if (!reject) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
255 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
256 |
peerLink->OpenAccept (peerManagementElement.GetLocalLinkId(), meshConfig, peerMeshPointAddress); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
257 |
} |
5063 | 258 |
else |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
259 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
260 |
peerLink->OpenReject (peerManagementElement.GetLocalLinkId(), meshConfig, peerMeshPointAddress, reasonCode); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
261 |
} |
4867
3a02e4e89292
Finished processing peer link frames on new architeture
Kirill Andreev <andreev@iitp.ru>
parents:
4866
diff
changeset
|
262 |
} |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
263 |
if (peerLink == 0) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
264 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
265 |
return; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
266 |
} |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
267 |
if (peerManagementElement.SubtypeIsConfirm ()) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
268 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
269 |
peerLink->ConfirmAccept ( |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
270 |
peerManagementElement.GetLocalLinkId(), |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
271 |
peerManagementElement.GetPeerLinkId(), |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
272 |
aid, |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
273 |
meshConfig, |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
274 |
peerMeshPointAddress); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
275 |
} |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
276 |
if (peerManagementElement.SubtypeIsClose ()) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
277 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
278 |
peerLink->Close ( |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
279 |
peerManagementElement.GetLocalLinkId(), |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
280 |
peerManagementElement.GetPeerLinkId(), |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
281 |
peerManagementElement.GetReasonCode() |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
282 |
); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
283 |
} |
4858
78437693dcc7
Peer manager restructure - unfinished
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
284 |
} |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
285 |
void |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
286 |
PeerManagementProtocol::ConfigurationMismatch (uint32_t interface, Mac48Address peerAddress) |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
287 |
{ |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
288 |
Ptr<PeerLink> peerLink = FindPeerLink (interface, peerAddress); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
289 |
if (peerLink != 0) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
290 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
291 |
peerLink->MLMECancelPeerLink (REASON11S_MESH_CAPABILITY_POLICY_VIOLATION); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
292 |
} |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
293 |
} |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
294 |
|
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
295 |
Ptr<PeerLink> |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
296 |
PeerManagementProtocol::InitiateLink ( |
5063 | 297 |
uint32_t interface, |
298 |
Mac48Address peerAddress, |
|
299 |
Mac48Address peerMeshPointAddress, |
|
300 |
Time lastBeacon, |
|
301 |
Time beaconInterval) |
|
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
302 |
{ |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
303 |
Ptr<PeerLink> new_link = CreateObject<PeerLink> (); |
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
304 |
if (m_lastLocalLinkId == 0xff) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
305 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
306 |
m_lastLocalLinkId = 0; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
307 |
} |
4868 | 308 |
//find a beacon entry |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
309 |
BeaconInfoMap::iterator beaconsOnInterface = m_neighbourBeacons.find (interface); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
310 |
if (beaconsOnInterface == m_neighbourBeacons.end()) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
311 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
312 |
FillBeaconInfo(interface, peerAddress, lastBeacon, beaconInterval); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
313 |
} |
4895 | 314 |
beaconsOnInterface = m_neighbourBeacons.find (interface); |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
315 |
BeaconsOnInterface::iterator beacon = beaconsOnInterface->second.find (peerAddress); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
316 |
if (beacon == beaconsOnInterface->second.end ()) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
317 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
318 |
FillBeaconInfo(interface, peerAddress, lastBeacon, beaconInterval); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
319 |
} |
4895 | 320 |
beacon = beaconsOnInterface->second.find (peerAddress); |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
321 |
//find a peer link - it must not exist |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
322 |
if (FindPeerLink(interface, peerAddress) != 0) |
5063 | 323 |
{ |
5075 | 324 |
NS_FATAL_ERROR ("Peer link must not exist."); |
5063 | 325 |
} |
4881
cec7f8e2bbdf
Minor cosmetics. Peer management protocol is assumed to be implemented now.
Pavel Boyko <boyko@iitp.ru>
parents:
4880
diff
changeset
|
326 |
// Plugin must exist |
5087 | 327 |
PeerManagementProtocolMacMap::iterator plugin = m_plugins.find (interface); |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
328 |
NS_ASSERT(plugin != m_plugins.end ()); |
4868 | 329 |
PeerLinksMap::iterator iface = m_peerLinks.find (interface); |
330 |
NS_ASSERT (iface != m_peerLinks.end()); |
|
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
331 |
new_link->SetLocalAid (beacon->second.aid); |
4869 | 332 |
new_link->SetInterface (interface); |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
333 |
new_link->SetLocalLinkId (m_lastLocalLinkId++); |
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
334 |
new_link->SetPeerAddress (peerAddress); |
4933
72f0481cfb2d
Peer link restructured to support multi-interface
Kirill Andreev <andreev@iitp.ru>
parents:
4926
diff
changeset
|
335 |
new_link->SetPeerMeshPointAddress (peerMeshPointAddress); |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
336 |
new_link->SetBeaconInformation (lastBeacon, beaconInterval); |
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
337 |
new_link->SetMacPlugin (plugin->second); |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
338 |
new_link->MLMESetSignalStatusCallback (MakeCallback(&PeerManagementProtocol::PeerLinkStatus, this)); |
4868 | 339 |
iface->second.push_back (new_link); |
4866
564372fc5491
First management frame goes through new archotecture
Kirill Andreev <andreev@iitp.ru>
parents:
4865
diff
changeset
|
340 |
return new_link; |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
341 |
} |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
342 |
Ptr<PeerLink> |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
343 |
PeerManagementProtocol::FindPeerLink(uint32_t interface, Mac48Address peerAddress) |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
344 |
{ |
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
345 |
PeerLinksMap::iterator iface = m_peerLinks.find (interface); |
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
346 |
NS_ASSERT (iface != m_peerLinks.end()); |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
347 |
for (PeerLinksOnInterface::iterator i = iface->second.begin (); i != iface->second.end(); i++) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
348 |
{ |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
349 |
if ((*i)->GetPeerAddress () == peerAddress) |
5003 | 350 |
{ |
5063 | 351 |
if((*i)->LinkIsIdle ()) |
352 |
{ |
|
353 |
(*i) = 0; |
|
354 |
(iface->second).erase(i); |
|
355 |
return 0; |
|
356 |
} |
|
357 |
else |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
358 |
{ |
5063 | 359 |
return (*i); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
360 |
} |
5003 | 361 |
} |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
362 |
} |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
363 |
return 0; |
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
364 |
} |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
365 |
void |
4933
72f0481cfb2d
Peer link restructured to support multi-interface
Kirill Andreev <andreev@iitp.ru>
parents:
4926
diff
changeset
|
366 |
PeerManagementProtocol::SetPeerLinkStatusCallback(Callback <void, Mac48Address, Mac48Address, uint32_t, bool> cb) |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
367 |
{ |
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
368 |
m_peerStatusCallback = cb; |
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
369 |
} |
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
370 |
std::vector<Mac48Address> |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
371 |
PeerManagementProtocol::GetActiveLinks (uint32_t interface) |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
372 |
{ |
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
373 |
std::vector<Mac48Address> retval; |
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
374 |
PeerLinksMap::iterator iface = m_peerLinks.find (interface); |
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
375 |
NS_ASSERT (iface != m_peerLinks.end()); |
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
376 |
for (PeerLinksOnInterface::iterator i = iface->second.begin (); i != iface->second.end(); i++) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
377 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
378 |
if ((*i)->LinkIsEstab ()) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
379 |
{ |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
380 |
retval.push_back((*i)->GetPeerAddress ()); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
381 |
} |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
382 |
} |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
383 |
return retval; |
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
384 |
} |
4870
79f9c2b6dffc
Uncommented destructor and cleaner
Kirill Andreev <andreev@iitp.ru>
parents:
4869
diff
changeset
|
385 |
bool |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
386 |
PeerManagementProtocol::IsActiveLink (uint32_t interface, Mac48Address peerAddress) |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
387 |
{ |
4877
f08902c42733
Added a method to find peer link, code cleanup
Kirill Andreev <andreev@iitp.ru>
parents:
4876
diff
changeset
|
388 |
Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
389 |
if (peerLink != 0) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
390 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
391 |
return (peerLink->LinkIsEstab ()); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
392 |
} |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
393 |
return false; |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
394 |
} |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
395 |
bool |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
396 |
PeerManagementProtocol::ShouldSendOpen (uint32_t interface, Mac48Address peerAddress) |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
397 |
{ |
5098
13ded9ff11c4
XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents:
5087
diff
changeset
|
398 |
return (m_stats.linksTotal <= m_maxNumberOfPeerLinks); |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
399 |
} |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
400 |
bool |
4933
72f0481cfb2d
Peer link restructured to support multi-interface
Kirill Andreev <andreev@iitp.ru>
parents:
4926
diff
changeset
|
401 |
PeerManagementProtocol::ShouldAcceptOpen ( |
72f0481cfb2d
Peer link restructured to support multi-interface
Kirill Andreev <andreev@iitp.ru>
parents:
4926
diff
changeset
|
402 |
uint32_t interface, |
72f0481cfb2d
Peer link restructured to support multi-interface
Kirill Andreev <andreev@iitp.ru>
parents:
4926
diff
changeset
|
403 |
Mac48Address peerAddress, |
72f0481cfb2d
Peer link restructured to support multi-interface
Kirill Andreev <andreev@iitp.ru>
parents:
4926
diff
changeset
|
404 |
PmpReasonCode & reasonCode) |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
405 |
{ |
5098
13ded9ff11c4
XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents:
5087
diff
changeset
|
406 |
if (m_stats.linksTotal > m_maxNumberOfPeerLinks) |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
407 |
{ |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
408 |
reasonCode = REASON11S_MESH_MAX_PEERS; |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
409 |
return false; |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
410 |
} |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
411 |
return true; |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
412 |
} |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
413 |
Time |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4899
diff
changeset
|
414 |
PeerManagementProtocol::GetNextBeaconShift (uint32_t interface) |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
415 |
{ |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
416 |
//REMINDER:: in timing element 1) last beacon reception time is measured in units of 256 microseconds |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
417 |
// 2) beacon interval is mesured in units of 1024 microseconds |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
418 |
// 3) hereafter TU = 1024 microseconds |
5077 | 419 |
//So, the shift is a random integer variable uniformly distributed in [-15;-1] U [1;15] |
420 |
static int maxShift = 15; |
|
421 |
static int minShift = 1; |
|
4879 | 422 |
PeerLinksMap::iterator iface = m_peerLinks.find (interface); |
423 |
NS_ASSERT (iface != m_peerLinks.end()); |
|
5087 | 424 |
PeerManagementProtocolMacMap::iterator plugin = m_plugins.find (interface); |
5075 | 425 |
NS_ASSERT (plugin != m_plugins.end()); |
4879 | 426 |
std::pair<Time, Time> myBeacon = plugin->second->GetBeaconInfo (); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
427 |
if (Simulator::Now () + TuToTime (maxShift) > myBeacon.first + myBeacon.second) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
428 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
429 |
return MicroSeconds (0); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
430 |
} |
4879 | 431 |
for (PeerLinksOnInterface::iterator i = iface->second.begin (); i != iface->second.end (); i++) |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
432 |
{ |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
433 |
IeBeaconTiming::NeighboursTimingUnitsList neighbours; |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
434 |
if ((*i)->LinkIsIdle ()) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
435 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
436 |
continue; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
437 |
} |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
438 |
neighbours = (*i)->GetBeaconTimingElement ().GetNeighboursTimingElementsList(); |
5075 | 439 |
//Going through all my timing elements and detecting future beacon collisions |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
440 |
for (IeBeaconTiming::NeighboursTimingUnitsList::const_iterator j = neighbours.begin (); j != neighbours.end (); j++) |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
441 |
//We apply MBAC only if beacon Intervals are equal |
5075 | 442 |
if ((*j)->GetBeaconInterval () == TimeToTu (myBeacon.second)) |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
443 |
{ |
5075 | 444 |
//Apply MBCA if future beacons may coinside |
445 |
if ((TimeToTu (myBeacon.first) - ((*j)->GetLastBeacon ()/4)) % ((*j)->GetBeaconInterval ()) == 0) |
|
446 |
{ |
|
447 |
UniformVariable randomSign (-1, 1); |
|
5077 | 448 |
UniformVariable randomShift (minShift, maxShift); |
449 |
int beaconShift = randomShift.GetInteger (minShift,maxShift) * ((randomSign.GetValue () >= 0) ? 1 : -1); |
|
5075 | 450 |
NS_LOG_DEBUG ("Apply MBCA: Shift value = " << beaconShift << " beacon TUs"); |
451 |
//Do not shift to the past! |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
452 |
return (TuToTime (beaconShift) + Simulator::Now () < myBeacon.first) ? TuToTime (beaconShift) : TuToTime (0); |
5075 | 453 |
} |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
454 |
} |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
455 |
} |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
456 |
return MicroSeconds (0); |
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
457 |
} |
5075 | 458 |
Time |
459 |
PeerManagementProtocol::TuToTime (uint32_t x) |
|
460 |
{ |
|
461 |
return MicroSeconds (x * 1024); |
|
462 |
} |
|
463 |
uint32_t |
|
464 |
PeerManagementProtocol::TimeToTu (Time x) |
|
465 |
{ |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
466 |
return (uint32_t) (x.GetMicroSeconds () / 1024); |
5075 | 467 |
} |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
468 |
void |
5085
5cfc1e9372af
Fixed peer link status notification
Kirill Andreev <andreev@iitp.ru>
parents:
5077
diff
changeset
|
469 |
PeerManagementProtocol::PeerLinkStatus (uint32_t interface, Mac48Address peerAddress, Mac48Address peerMeshPointAddress, PeerLink::PeerState ostate, PeerLink::PeerState nstate) |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
470 |
{ |
5087 | 471 |
PeerManagementProtocolMacMap::iterator plugin = m_plugins.find (interface); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
472 |
NS_ASSERT (plugin != m_plugins.end()); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
473 |
NS_LOG_DEBUG ( |
5063 | 474 |
"Link between me:" << m_address << |
475 |
" my interface:" << plugin->second->GetAddress() << |
|
476 |
" and peer mesh point:" << peerMeshPointAddress << |
|
477 |
" and its interface:" << peerAddress << |
|
478 |
", at my interface ID:" << interface << |
|
5085
5cfc1e9372af
Fixed peer link status notification
Kirill Andreev <andreev@iitp.ru>
parents:
5077
diff
changeset
|
479 |
". State movement:" << ostate << " -> " << nstate); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
480 |
if ((nstate == PeerLink::ESTAB) && (ostate != PeerLink::ESTAB)) |
5063 | 481 |
{ |
482 |
m_stats.linksOpened ++; |
|
5098
13ded9ff11c4
XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents:
5087
diff
changeset
|
483 |
m_stats.linksTotal++; |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
484 |
if (!m_peerStatusCallback.IsNull ()) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
485 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
486 |
m_peerStatusCallback (peerMeshPointAddress, peerAddress, interface, true); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
487 |
} |
5063 | 488 |
} |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
489 |
if ((ostate == PeerLink::ESTAB) && (nstate != PeerLink::ESTAB)) |
5063 | 490 |
{ |
491 |
m_stats.linksClosed ++; |
|
5098
13ded9ff11c4
XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents:
5087
diff
changeset
|
492 |
m_stats.linksTotal--; |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
493 |
if (!m_peerStatusCallback.IsNull ()) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
494 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
495 |
m_peerStatusCallback (peerMeshPointAddress, peerAddress, interface, false); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
496 |
} |
5085
5cfc1e9372af
Fixed peer link status notification
Kirill Andreev <andreev@iitp.ru>
parents:
5077
diff
changeset
|
497 |
} |
5cfc1e9372af
Fixed peer link status notification
Kirill Andreev <andreev@iitp.ru>
parents:
5077
diff
changeset
|
498 |
if (nstate == PeerLink::IDLE) |
5cfc1e9372af
Fixed peer link status notification
Kirill Andreev <andreev@iitp.ru>
parents:
5077
diff
changeset
|
499 |
{ |
5075 | 500 |
Ptr <PeerLink> link = FindPeerLink (interface, peerAddress); |
501 |
NS_ASSERT (link == 0); |
|
5063 | 502 |
} |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
503 |
} |
5017
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5015
diff
changeset
|
504 |
uint8_t |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5015
diff
changeset
|
505 |
PeerManagementProtocol::GetNumberOfLinks () |
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5015
diff
changeset
|
506 |
{ |
5098
13ded9ff11c4
XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents:
5087
diff
changeset
|
507 |
return m_stats.linksTotal; |
5017
a2a6accbc167
Restructured mesh configuration element
Kirill Andreev <andreev@iitp.ru>
parents:
5015
diff
changeset
|
508 |
} |
5020
79e8178d69eb
Mesh ID is made separately from SSID
Kirill Andreev <andreev@iitp.ru>
parents:
5017
diff
changeset
|
509 |
Ptr<IeMeshId> |
79e8178d69eb
Mesh ID is made separately from SSID
Kirill Andreev <andreev@iitp.ru>
parents:
5017
diff
changeset
|
510 |
PeerManagementProtocol::GetMeshId () const |
79e8178d69eb
Mesh ID is made separately from SSID
Kirill Andreev <andreev@iitp.ru>
parents:
5017
diff
changeset
|
511 |
{ |
5024 | 512 |
NS_ASSERT (m_meshId != 0); |
5020
79e8178d69eb
Mesh ID is made separately from SSID
Kirill Andreev <andreev@iitp.ru>
parents:
5017
diff
changeset
|
513 |
return m_meshId; |
79e8178d69eb
Mesh ID is made separately from SSID
Kirill Andreev <andreev@iitp.ru>
parents:
5017
diff
changeset
|
514 |
} |
79e8178d69eb
Mesh ID is made separately from SSID
Kirill Andreev <andreev@iitp.ru>
parents:
5017
diff
changeset
|
515 |
void |
5049 | 516 |
PeerManagementProtocol::SetMeshId(std::string s) |
5020
79e8178d69eb
Mesh ID is made separately from SSID
Kirill Andreev <andreev@iitp.ru>
parents:
5017
diff
changeset
|
517 |
{ |
5049 | 518 |
m_meshId = Create<IeMeshId> (s); |
5020
79e8178d69eb
Mesh ID is made separately from SSID
Kirill Andreev <andreev@iitp.ru>
parents:
5017
diff
changeset
|
519 |
} |
4933
72f0481cfb2d
Peer link restructured to support multi-interface
Kirill Andreev <andreev@iitp.ru>
parents:
4926
diff
changeset
|
520 |
Mac48Address |
72f0481cfb2d
Peer link restructured to support multi-interface
Kirill Andreev <andreev@iitp.ru>
parents:
4926
diff
changeset
|
521 |
PeerManagementProtocol::GetAddress () |
72f0481cfb2d
Peer link restructured to support multi-interface
Kirill Andreev <andreev@iitp.ru>
parents:
4926
diff
changeset
|
522 |
{ |
72f0481cfb2d
Peer link restructured to support multi-interface
Kirill Andreev <andreev@iitp.ru>
parents:
4926
diff
changeset
|
523 |
return m_address; |
72f0481cfb2d
Peer link restructured to support multi-interface
Kirill Andreev <andreev@iitp.ru>
parents:
4926
diff
changeset
|
524 |
} |
5012 | 525 |
void |
5013 | 526 |
PeerManagementProtocol::Statistics::Print (std::ostream & os) const |
527 |
{ |
|
5015 | 528 |
os << "<Statistics " |
5098
13ded9ff11c4
XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents:
5087
diff
changeset
|
529 |
"linksTotal=\"" << linksTotal << "\" " |
5063 | 530 |
"linksOpened=\"" << linksOpened << "\" " |
531 |
"linksClosed=\"" << linksClosed << "\"/>\n"; |
|
5013 | 532 |
} |
533 |
void |
|
5012 | 534 |
PeerManagementProtocol::Report (std::ostream & os) const |
535 |
{ |
|
5015 | 536 |
os << "<PeerManagementProtocol>\n"; |
5013 | 537 |
m_stats.Print (os); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
538 |
for (PeerManagementProtocolMacMap::const_iterator plugins = m_plugins.begin (); plugins != m_plugins.end (); plugins ++) |
5063 | 539 |
{ |
540 |
//Take statistics from plugin: |
|
541 |
plugins->second->Report (os); |
|
542 |
//Print all active peer links: |
|
543 |
PeerLinksMap::const_iterator iface = m_peerLinks.find (plugins->second->m_ifIndex); |
|
544 |
NS_ASSERT (iface != m_peerLinks.end()); |
|
545 |
for (PeerLinksOnInterface::const_iterator i = iface->second.begin (); i != iface->second.end(); i++) |
|
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
546 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
547 |
(*i)->Report (os); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
548 |
} |
5063 | 549 |
} |
5015 | 550 |
os << "</PeerManagementProtocol>\n"; |
5012 | 551 |
} |
5013 | 552 |
void |
553 |
PeerManagementProtocol::ResetStats () |
|
554 |
{ |
|
5098
13ded9ff11c4
XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents:
5087
diff
changeset
|
555 |
m_stats = Statistics::Statistics (m_stats.linksTotal); // don't reset number of links |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
556 |
for (PeerManagementProtocolMacMap::const_iterator plugins = m_plugins.begin (); plugins != m_plugins.end (); plugins ++) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
557 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
558 |
plugins->second->ResetStats (); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
559 |
} |
5013 | 560 |
} |
561 |
||
4872 | 562 |
} // namespace dot11s |
563 |
} //namespace ns3 |
|
564 |