author | Kirill Andreev <andreev@iitp.ru> |
Thu, 08 Oct 2009 13:53:21 +0400 | |
changeset 5385 | 1d7cf96ce5bf |
parent 5349 | 8e8459d1831b |
child 5417 | 899604299046 |
permissions | -rw-r--r-- |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
2 |
/* |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 IITP RAS |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
4 |
* |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
8 |
* |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
13 |
* |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
17 |
* |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
18 |
* Authors: Kirill Andreev <andreev@iitp.ru> |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
19 |
* Pavel Boyko <boyko@iitp.ru> |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
20 |
*/ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
21 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
22 |
#include "ns3/mesh-wifi-interface-mac.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
23 |
#include "ns3/mesh-wifi-beacon.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
24 |
#include "ns3/log.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
25 |
#include "ns3/wifi-phy.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
26 |
#include "ns3/dcf-manager.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
27 |
#include "ns3/mac-rx-middle.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
28 |
#include "ns3/mac-low.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
29 |
#include "ns3/dca-txop.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
30 |
#include "ns3/random-variable.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
31 |
#include "ns3/simulator.h" |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
32 |
#include "ns3/yans-wifi-phy.h" |
5054 | 33 |
#include "ns3/pointer.h" |
5154
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
34 |
#include "ns3/trace-source-accessor.h" |
5115
7cdd24c28d4e
QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
35 |
#include "ns3/qos-tag.h" |
5054 | 36 |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
37 |
NS_LOG_COMPONENT_DEFINE ("MeshWifiInterfaceMac"); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
38 |
|
5132
aee541a30256
Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents:
5129
diff
changeset
|
39 |
namespace ns3 { |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
40 |
|
5129 | 41 |
NS_OBJECT_ENSURE_REGISTERED (MeshWifiInterfaceMac); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
42 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
43 |
TypeId |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
44 |
MeshWifiInterfaceMac::GetTypeId () |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
45 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
46 |
static TypeId tid = TypeId ("ns3::MeshWifiInterfaceMac") |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
47 |
.SetParent<WifiMac> () |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
48 |
.AddConstructor<MeshWifiInterfaceMac> () |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
49 |
.AddAttribute ( "BeaconInterval", |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
50 |
"Beacon Interval", |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
51 |
TimeValue (Seconds (0.5)), |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
52 |
|
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
53 |
MakeTimeAccessor ( |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
54 |
&MeshWifiInterfaceMac::m_beaconInterval), |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
55 |
MakeTimeChecker () |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
56 |
) |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
57 |
.AddAttribute ( "RandomStart", |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
58 |
"Window when beacon generating starts (uniform random) in seconds", |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
59 |
TimeValue (Seconds (0.5)), |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
60 |
MakeTimeAccessor ( |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
61 |
&MeshWifiInterfaceMac::m_randomStart), |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
62 |
MakeTimeChecker () |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
63 |
) |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
64 |
.AddAttribute ( "BeaconGeneration", |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
65 |
"Enable/Disable Beaconing.", |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
66 |
BooleanValue (true), |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
67 |
MakeBooleanAccessor ( |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
68 |
&MeshWifiInterfaceMac::SetBeaconGeneration, &MeshWifiInterfaceMac::GetBeaconGeneration), |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
69 |
MakeBooleanChecker () |
5154
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
70 |
) |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
71 |
.AddTraceSource ( "TxOkHeader", |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
72 |
"The header of successfully transmitted packet", |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
73 |
MakeTraceSourceAccessor ( |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
74 |
&MeshWifiInterfaceMac::m_txOkCallback) |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
75 |
) |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
76 |
.AddTraceSource ( "TxErrHeader", |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
77 |
"The header of unsuccessfully transmitted packet", |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
78 |
MakeTraceSourceAccessor ( |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
79 |
&MeshWifiInterfaceMac::m_txErrCallback) |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
80 |
) |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
81 |
; |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
82 |
return tid; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
83 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
84 |
MeshWifiInterfaceMac::MeshWifiInterfaceMac () |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
85 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
86 |
NS_LOG_FUNCTION (this); |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
87 |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
88 |
m_rxMiddle = new MacRxMiddle (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
89 |
m_rxMiddle->SetForwardCallback (MakeCallback (&MeshWifiInterfaceMac::Receive, this)); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
90 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
91 |
m_low = CreateObject<MacLow> (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
92 |
m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle)); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
93 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
94 |
m_dcfManager = new DcfManager (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
95 |
m_dcfManager->SetupLowListener (m_low); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
96 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
97 |
m_beaconDca = CreateObject<DcaTxop> (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
98 |
m_beaconDca->SetLow (m_low); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
99 |
m_beaconDca->SetMinCw (0); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
100 |
m_beaconDca->SetMaxCw (0); |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
101 |
m_beaconDca->SetAifsn (1); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
102 |
m_beaconDca->SetManager (m_dcfManager); |
5152
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
103 |
|
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
104 |
SetQueue (AC_VO); |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
105 |
SetQueue (AC_VI); |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
106 |
SetQueue (AC_BE); |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
107 |
SetQueue (AC_BK); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
108 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
109 |
MeshWifiInterfaceMac::~MeshWifiInterfaceMac () |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
110 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
111 |
NS_LOG_FUNCTION (this); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
112 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
113 |
//----------------------------------------------------------------------------- |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
114 |
// WifiMac inherited |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
115 |
//----------------------------------------------------------------------------- |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
116 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
117 |
MeshWifiInterfaceMac::SetSlot (Time slotTime) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
118 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
119 |
NS_LOG_FUNCTION (this << slotTime); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
120 |
m_dcfManager->SetSlot (slotTime); |
5047
b68f194a346c
Fixed setting slot and sifs time to mac-low
Kirill Andreev <andreev@iitp.ru>
parents:
5038
diff
changeset
|
121 |
m_low->SetSlotTime (slotTime); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
122 |
m_slot = slotTime; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
123 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
124 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
125 |
MeshWifiInterfaceMac::SetSifs (Time sifs) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
126 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
127 |
NS_LOG_FUNCTION (this << sifs); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
128 |
m_dcfManager->SetSifs (sifs); |
5047
b68f194a346c
Fixed setting slot and sifs time to mac-low
Kirill Andreev <andreev@iitp.ru>
parents:
5038
diff
changeset
|
129 |
m_low->SetSifs (sifs); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
130 |
m_sifs = sifs; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
131 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
132 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
133 |
MeshWifiInterfaceMac::SetAckTimeout (Time ackTimeout) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
134 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
135 |
m_low->SetAckTimeout (ackTimeout); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
136 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
137 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
138 |
MeshWifiInterfaceMac::SetCtsTimeout (Time ctsTimeout) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
139 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
140 |
m_low->SetCtsTimeout (ctsTimeout); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
141 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
142 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
143 |
MeshWifiInterfaceMac::SetPifs (Time pifs) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
144 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
145 |
NS_LOG_FUNCTION (this << pifs); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
146 |
m_pifs = pifs; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
147 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
148 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
149 |
MeshWifiInterfaceMac::SetEifsNoDifs (Time eifsNoDifs) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
150 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
151 |
NS_LOG_FUNCTION (this << eifsNoDifs); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
152 |
m_dcfManager->SetEifsNoDifs (eifsNoDifs); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
153 |
m_eifsNoDifs = eifsNoDifs; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
154 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
155 |
Time |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
156 |
MeshWifiInterfaceMac::GetSlot () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
157 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
158 |
return m_slot; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
159 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
160 |
Time |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
161 |
MeshWifiInterfaceMac::GetSifs () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
162 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
163 |
return m_sifs; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
164 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
165 |
Time |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
166 |
MeshWifiInterfaceMac::GetEifsNoDifs () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
167 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
168 |
return m_eifsNoDifs; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
169 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
170 |
Time |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
171 |
MeshWifiInterfaceMac::GetAckTimeout () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
172 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
173 |
return m_low->GetAckTimeout (); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
174 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
175 |
Time |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
176 |
MeshWifiInterfaceMac::GetCtsTimeout () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
177 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
178 |
return m_low->GetCtsTimeout (); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
179 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
180 |
Time |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
181 |
MeshWifiInterfaceMac::GetPifs () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
182 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
183 |
return m_low->GetPifs (); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
184 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
185 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
186 |
MeshWifiInterfaceMac::SetWifiPhy (Ptr<WifiPhy> phy) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
187 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
188 |
NS_LOG_FUNCTION (this << phy); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
189 |
m_phy = phy; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
190 |
m_dcfManager->SetupPhyListener (phy); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
191 |
m_low->SetPhy (phy); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
192 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
193 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
194 |
MeshWifiInterfaceMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
195 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
196 |
NS_LOG_FUNCTION (this << stationManager); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
197 |
m_stationManager = stationManager; |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
198 |
for (Queues::const_iterator i = m_queues.begin (); i != m_queues.end (); i++) |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
199 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
200 |
i->second->SetWifiRemoteStationManager (stationManager); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
201 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
202 |
m_beaconDca->SetWifiRemoteStationManager (stationManager); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
203 |
m_low->SetWifiRemoteStationManager (stationManager); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
204 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
205 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
206 |
MeshWifiInterfaceMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
207 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
208 |
NS_LOG_FUNCTION (this << packet << to << from); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
209 |
ForwardDown (packet, from, to); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
210 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
211 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
212 |
MeshWifiInterfaceMac::Enqueue (Ptr<const Packet> packet, Mac48Address to) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
213 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
214 |
NS_LOG_FUNCTION (this << packet << to); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
215 |
ForwardDown (packet, m_low->GetAddress (), to); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
216 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
217 |
bool |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
218 |
MeshWifiInterfaceMac::SupportsSendFrom () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
219 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
220 |
return true; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
221 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
222 |
void |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
223 |
MeshWifiInterfaceMac::SetForwardUpCallback ( |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
224 |
Callback<void, Ptr<Packet> , Mac48Address, Mac48Address> upCallback) |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
225 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
226 |
NS_LOG_FUNCTION (this); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
227 |
m_upCallback = upCallback; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
228 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
229 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
230 |
MeshWifiInterfaceMac::SetLinkUpCallback (Callback<void> linkUp) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
231 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
232 |
NS_LOG_FUNCTION (this); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
233 |
if (!linkUp.IsNull ()) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
234 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
235 |
linkUp (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
236 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
237 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
238 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
239 |
MeshWifiInterfaceMac::SetLinkDownCallback (Callback<void> linkDown) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
240 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
241 |
NS_LOG_FUNCTION (this); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
242 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
243 |
Mac48Address |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
244 |
MeshWifiInterfaceMac::GetAddress () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
245 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
246 |
return m_address; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
247 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
248 |
Mac48Address |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
249 |
MeshWifiInterfaceMac::GetBssid () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
250 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
251 |
return m_address; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
252 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
253 |
Ssid |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
254 |
MeshWifiInterfaceMac::GetSsid () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
255 |
{ |
4865
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
256 |
return m_meshId; |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
257 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
258 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
259 |
MeshWifiInterfaceMac::SetAddress (Mac48Address address) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
260 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
261 |
NS_LOG_FUNCTION (address); |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
262 |
m_low->SetAddress (address); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
263 |
m_address = address; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
264 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
265 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
266 |
MeshWifiInterfaceMac::SetSsid (Ssid ssid) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
267 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
268 |
NS_LOG_FUNCTION (ssid); |
4865
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
269 |
m_meshId = ssid; |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
270 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
271 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
272 |
MeshWifiInterfaceMac::DoDispose () |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
273 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
274 |
NS_LOG_FUNCTION (this); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
275 |
delete m_rxMiddle; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
276 |
delete m_dcfManager; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
277 |
//Delete smart pointers: |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
278 |
m_rxMiddle = 0; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
279 |
m_low = 0; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
280 |
m_dcfManager = 0; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
281 |
m_phy = 0; |
5114
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5098
diff
changeset
|
282 |
m_queues.clear (); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
283 |
m_beaconSendEvent.Cancel (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
284 |
m_beaconDca = 0; |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
285 |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
286 |
WifiMac::DoDispose (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
287 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
288 |
//----------------------------------------------------------------------------- |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
289 |
// Plugins |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
290 |
//----------------------------------------------------------------------------- |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
291 |
void |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
292 |
MeshWifiInterfaceMac::InstallPlugin (Ptr<MeshWifiInterfaceMacPlugin> plugin) |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
293 |
{ |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
294 |
NS_LOG_FUNCTION (this); |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
295 |
|
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
296 |
plugin->SetParent (this); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
297 |
m_plugins.push_back (plugin); |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
298 |
} |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
299 |
//----------------------------------------------------------------------------- |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
300 |
// Switch channels |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
301 |
//----------------------------------------------------------------------------- |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
302 |
uint16_t |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
303 |
MeshWifiInterfaceMac::GetFrequencyChannel () const |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
304 |
{ |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
305 |
NS_LOG_FUNCTION (this); |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
306 |
NS_ASSERT (m_phy != 0); // need PHY to set/get channel |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
307 |
|
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
308 |
Ptr<YansWifiPhy> phy = m_phy->GetObject<YansWifiPhy> (); |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
309 |
if (phy != 0) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
310 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
311 |
return phy->GetChannelNumber (); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
312 |
} |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
313 |
else |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
314 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
315 |
return 0; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
316 |
} |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
317 |
} |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
318 |
void |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
319 |
MeshWifiInterfaceMac::SwitchFrequencyChannel (uint16_t new_id) |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
320 |
{ |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
321 |
NS_LOG_FUNCTION (this); |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
322 |
NS_ASSERT (m_phy != 0); // need PHY to set/get channel |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
323 |
/* TODO |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
324 |
* |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
325 |
* Correct channel switching is: |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
326 |
* |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
327 |
* 1. Interface down, e.g. to stop packets from layer 3 |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
328 |
* 2. Wait before all output queues will be empty |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
329 |
* 3. Switch PHY channel |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
330 |
* 4. Interface up |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
331 |
* |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
332 |
* Now we use dirty channel switch -- just change frequency |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
333 |
*/ |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
334 |
Ptr<YansWifiPhy> phy = m_phy->GetObject<YansWifiPhy> (); |
5118
3a0893ec9819
ChannelId -> ChannelNumber and also in the base class WifiPhy
Pavel Boyko <boyko@iitp.ru>
parents:
5098
diff
changeset
|
335 |
phy->SetChannelNumber (new_id); |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
336 |
// Don't know NAV on new channel |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
337 |
m_dcfManager->NotifyNavResetNow (Seconds (0)); |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
338 |
} |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
339 |
//----------------------------------------------------------------------------- |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
340 |
// Forward frame up/down |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
341 |
//----------------------------------------------------------------------------- |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
342 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
343 |
MeshWifiInterfaceMac::ForwardUp (Ptr<Packet> packet, Mac48Address src, Mac48Address dst) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
344 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
345 |
NS_LOG_FUNCTION (this << packet << src); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
346 |
m_upCallback (packet, src, dst); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
347 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
348 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
349 |
void |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
350 |
MeshWifiInterfaceMac::ForwardDown (Ptr<const Packet> const_packet, Mac48Address from, Mac48Address to) |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
351 |
{ |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
352 |
// copy packet to allow modifications |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
353 |
Ptr<Packet> packet = const_packet->Copy (); |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
354 |
WifiMacHeader hdr; |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
355 |
hdr.SetTypeData (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
356 |
hdr.SetAddr2 (GetAddress ()); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
357 |
hdr.SetAddr3 (to); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
358 |
hdr.SetAddr4 (from); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
359 |
hdr.SetDsFrom (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
360 |
hdr.SetDsTo (); |
5115
7cdd24c28d4e
QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
361 |
// Fill QoS fields: |
7cdd24c28d4e
QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
362 |
hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK); |
7cdd24c28d4e
QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
363 |
hdr.SetQosNoEosp (); |
7cdd24c28d4e
QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
364 |
hdr.SetQosNoAmsdu (); |
7cdd24c28d4e
QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
365 |
hdr.SetQosTxopLimit (0); |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
366 |
// Address 1 is unknwon here. Routing plugin is responsible to correctly set it. |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
367 |
hdr.SetAddr1 (Mac48Address ()); |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
368 |
// Filter packet through all installed plugins |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
369 |
for (PluginList::const_iterator i = m_plugins.end () - 1; i != m_plugins.begin () - 1; i--) |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
370 |
{ |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
371 |
bool drop = !((*i)->UpdateOutcomingFrame (packet, hdr, from, to)); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
372 |
if (drop) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
373 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
374 |
return; // plugin drops frame |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
375 |
} |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
376 |
} |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
377 |
// Assert that address1 is set. Assert will fail e.g. if there is no installed routing plugin. |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
378 |
NS_ASSERT (hdr.GetAddr1 () != Mac48Address ()); |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
379 |
// Queue frame |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
380 |
WifiRemoteStation *destination = m_stationManager->Lookup (to); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
381 |
if (destination->IsBrandNew ()) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
382 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
383 |
// in adhoc mode, we assume that every destination |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
384 |
// supports all the rates we support. |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
385 |
for (uint32_t i = 0; i < m_phy->GetNModes (); i++) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
386 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
387 |
destination->AddSupportedMode (m_phy->GetMode (i)); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
388 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
389 |
destination->RecordDisassociated (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
390 |
} |
5115
7cdd24c28d4e
QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
391 |
//Classify: application sets a tag, which is removed here |
7cdd24c28d4e
QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
392 |
// Get Qos tag: |
7cdd24c28d4e
QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
393 |
AccessClass ac = AC_BE; |
7cdd24c28d4e
QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
394 |
QosTag tag; |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
395 |
if (packet->RemovePacketTag (tag)) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
396 |
{ |
5349
8e8459d1831b
Mesh: 802.11 header is set to QosData if QosTag exists.
Kirill Andreev <andreev@iitp.ru>
parents:
5178
diff
changeset
|
397 |
hdr.SetType (WIFI_MAC_QOSDATA); |
8e8459d1831b
Mesh: 802.11 header is set to QosData if QosTag exists.
Kirill Andreev <andreev@iitp.ru>
parents:
5178
diff
changeset
|
398 |
hdr.SetQosTid (tag.Get ()); |
5385
1d7cf96ce5bf
Mesh: restoring DsFrom and DsTo flags when setting type QosData
Kirill Andreev <andreev@iitp.ru>
parents:
5349
diff
changeset
|
399 |
//Aftre setting type DsFrom and DsTo fields are reset. |
1d7cf96ce5bf
Mesh: restoring DsFrom and DsTo flags when setting type QosData
Kirill Andreev <andreev@iitp.ru>
parents:
5349
diff
changeset
|
400 |
hdr.SetDsFrom (); |
1d7cf96ce5bf
Mesh: restoring DsFrom and DsTo flags when setting type QosData
Kirill Andreev <andreev@iitp.ru>
parents:
5349
diff
changeset
|
401 |
hdr.SetDsTo (); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
402 |
ac = QosUtilsMapTidToAc (tag.Get ()); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
403 |
} |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
404 |
m_stats.sentFrames++; |
5015 | 405 |
m_stats.sentBytes += packet->GetSize (); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
406 |
NS_ASSERT (m_queues.find (ac) != m_queues.end ()); |
5115
7cdd24c28d4e
QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
407 |
m_queues[ac]->Queue (packet, hdr); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
408 |
} |
4865
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
409 |
void |
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
410 |
MeshWifiInterfaceMac::SendManagementFrame (Ptr<Packet> packet, const WifiMacHeader& hdr) |
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
411 |
{ |
5002
4ff127c1f6fa
Filtering outgoing frames if peer link does not exist. Fixed order of going
Kirill Andreev <andreev@iitp.ru>
parents:
4985
diff
changeset
|
412 |
//Filter management frames: |
4ff127c1f6fa
Filtering outgoing frames if peer link does not exist. Fixed order of going
Kirill Andreev <andreev@iitp.ru>
parents:
4985
diff
changeset
|
413 |
WifiMacHeader header = hdr; |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
414 |
for (PluginList::const_iterator i = m_plugins.end () - 1; i != m_plugins.begin () - 1; i--) |
5002
4ff127c1f6fa
Filtering outgoing frames if peer link does not exist. Fixed order of going
Kirill Andreev <andreev@iitp.ru>
parents:
4985
diff
changeset
|
415 |
{ |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
416 |
bool drop = !((*i)->UpdateOutcomingFrame (packet, header, Mac48Address (), Mac48Address ())); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
417 |
if (drop) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
418 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
419 |
return; // plugin drops frame |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
420 |
} |
5002
4ff127c1f6fa
Filtering outgoing frames if peer link does not exist. Fixed order of going
Kirill Andreev <andreev@iitp.ru>
parents:
4985
diff
changeset
|
421 |
} |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
422 |
m_stats.sentFrames++; |
5015 | 423 |
m_stats.sentBytes += packet->GetSize (); |
5137 | 424 |
if ((m_queues.find (AC_VO) == m_queues.end ()) || (m_queues.find (AC_BK) == m_queues.end ())) |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
425 |
{ |
5136 | 426 |
NS_FATAL_ERROR ("Voice or Background queue is not set up!"); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
427 |
} |
5136 | 428 |
/* |
429 |
* When we send a management frame - it is better to enqueue it to |
|
430 |
* priority queue. But when we send a broadcast management frame, |
|
431 |
* like PREQ, little MinCw value may cause collisions during |
|
432 |
* retransmissions (two neighbor stations may choose the same window |
|
433 |
* size, and two packets will be collided). So, broadcast management |
|
434 |
* frames go to BK queue. |
|
435 |
*/ |
|
436 |
if (hdr.GetAddr1 () != Mac48Address::GetBroadcast ()) |
|
437 |
{ |
|
438 |
m_queues[AC_VO]->Queue (packet, header); |
|
439 |
} |
|
440 |
else |
|
441 |
{ |
|
442 |
m_queues[AC_BK]->Queue (packet, header); |
|
443 |
} |
|
4865
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
444 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
445 |
SupportedRates |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
446 |
MeshWifiInterfaceMac::GetSupportedRates () const |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
447 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
448 |
// set the set of supported rates and make sure that we indicate |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
449 |
// the Basic Rate set in this set of supported rates. |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
450 |
SupportedRates rates; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
451 |
for (uint32_t i = 0; i < m_phy->GetNModes (); i++) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
452 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
453 |
WifiMode mode = m_phy->GetMode (i); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
454 |
rates.AddSupportedRate (mode.GetDataRate ()); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
455 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
456 |
// set the basic rates |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
457 |
for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
458 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
459 |
WifiMode mode = m_stationManager->GetBasicMode (j); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
460 |
rates.SetBasicRate (mode.GetDataRate ()); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
461 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
462 |
return rates; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
463 |
} |
4865
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
464 |
bool |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
465 |
MeshWifiInterfaceMac::CheckSupportedRates (SupportedRates rates) const |
4865
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
466 |
{ |
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
467 |
for (uint32_t i = 0; i < m_stationManager->GetNBasicModes (); i++) |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
468 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
469 |
WifiMode mode = m_stationManager->GetBasicMode (i); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
470 |
if (!rates.IsSupportedRate (mode.GetDataRate ())) |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
471 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
472 |
return false; |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
473 |
} |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
474 |
} |
4865
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
475 |
return true; |
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
476 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
477 |
//----------------------------------------------------------------------------- |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
478 |
// Beacons |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
479 |
//----------------------------------------------------------------------------- |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
480 |
void |
4929
1689c94d7442
802.11s helper (ns3::dot11s::MeshWifiHelper) refactored
Pavel Boyko <boyko@iitp.ru>
parents:
4906
diff
changeset
|
481 |
MeshWifiInterfaceMac::SetRandomStartDelay (Time interval) |
1689c94d7442
802.11s helper (ns3::dot11s::MeshWifiHelper) refactored
Pavel Boyko <boyko@iitp.ru>
parents:
4906
diff
changeset
|
482 |
{ |
1689c94d7442
802.11s helper (ns3::dot11s::MeshWifiHelper) refactored
Pavel Boyko <boyko@iitp.ru>
parents:
4906
diff
changeset
|
483 |
NS_LOG_FUNCTION (this << interval); |
1689c94d7442
802.11s helper (ns3::dot11s::MeshWifiHelper) refactored
Pavel Boyko <boyko@iitp.ru>
parents:
4906
diff
changeset
|
484 |
m_randomStart = interval; |
1689c94d7442
802.11s helper (ns3::dot11s::MeshWifiHelper) refactored
Pavel Boyko <boyko@iitp.ru>
parents:
4906
diff
changeset
|
485 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
486 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
487 |
MeshWifiInterfaceMac::SetBeaconInterval (Time interval) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
488 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
489 |
NS_LOG_FUNCTION (this << interval); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
490 |
m_beaconInterval = interval; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
491 |
} |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
492 |
Time |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
493 |
MeshWifiInterfaceMac::GetBeaconInterval () const |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
494 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
495 |
return m_beaconInterval; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
496 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
497 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
498 |
MeshWifiInterfaceMac::SetBeaconGeneration (bool enable) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
499 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
500 |
NS_LOG_FUNCTION (this << enable); |
5178
fa7d9b667efc
Random variable definitions were removed from conditional code
Kirill Andreev <andreev@iitp.ru>
parents:
5156
diff
changeset
|
501 |
UniformVariable coefficient (0.0, m_randomStart.GetSeconds ()); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
502 |
if (enable) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
503 |
{ |
5178
fa7d9b667efc
Random variable definitions were removed from conditional code
Kirill Andreev <andreev@iitp.ru>
parents:
5156
diff
changeset
|
504 |
Time randomStart = Seconds (coefficient.GetValue ()); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
505 |
// Now start sending beacons after some random delay (to avoid collisions) |
5178
fa7d9b667efc
Random variable definitions were removed from conditional code
Kirill Andreev <andreev@iitp.ru>
parents:
5156
diff
changeset
|
506 |
NS_ASSERT (!m_beaconSendEvent.IsRunning ()); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
507 |
m_beaconSendEvent = Simulator::Schedule (randomStart, &MeshWifiInterfaceMac::SendBeacon, this); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
508 |
m_tbtt = Simulator::Now () + randomStart; |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
509 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
510 |
else |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
511 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
512 |
// stop sending beacons |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
513 |
m_beaconSendEvent.Cancel (); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
514 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
515 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
516 |
bool |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
517 |
MeshWifiInterfaceMac::GetBeaconGeneration () const |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
518 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
519 |
return m_beaconSendEvent.IsRunning (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
520 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
521 |
Time |
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
522 |
MeshWifiInterfaceMac::GetTbtt () const |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
523 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
524 |
return m_tbtt; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
525 |
} |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
526 |
void |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
527 |
MeshWifiInterfaceMac::ShiftTbtt (Time shift) |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
528 |
{ |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
4855
diff
changeset
|
529 |
// User of ShiftTbtt () must take care don't shift it to the past |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
530 |
NS_ASSERT (GetTbtt () + shift > Simulator::Now ()); |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
531 |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
532 |
m_tbtt += shift; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
533 |
// Shift scheduled event |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
534 |
Simulator::Cancel (m_beaconSendEvent); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
535 |
m_beaconSendEvent = Simulator::Schedule (GetTbtt () - Simulator::Now (), &MeshWifiInterfaceMac::SendBeacon, |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
536 |
this); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
537 |
} |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
538 |
void |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
539 |
MeshWifiInterfaceMac::ScheduleNextBeacon () |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
540 |
{ |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
541 |
m_tbtt += GetBeaconInterval (); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
542 |
m_beaconSendEvent = Simulator::Schedule (GetBeaconInterval (), &MeshWifiInterfaceMac::SendBeacon, this); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
543 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
544 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
545 |
MeshWifiInterfaceMac::SendBeacon () |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
546 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
547 |
NS_LOG_FUNCTION (this); |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
548 |
NS_LOG_DEBUG (GetAddress () << " is sending beacon"); |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
549 |
|
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
550 |
NS_ASSERT (!m_beaconSendEvent.IsRunning ()); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
551 |
NS_ASSERT (Simulator::Now ().GetMicroSeconds () == GetTbtt ().GetMicroSeconds ()); // assert that beacon is just on time |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
552 |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
553 |
// Form & send beacon |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
554 |
MeshWifiBeacon beacon (GetSsid (), GetSupportedRates (), m_beaconInterval.GetMicroSeconds ()); |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
555 |
|
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
556 |
// Ask all plugins to add their specific information elements to beacon |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
557 |
for (PluginList::const_iterator i = m_plugins.begin (); i != m_plugins.end (); ++i) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
558 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
559 |
(*i)->UpdateBeacon (beacon); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
560 |
} |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
561 |
m_beaconDca->Queue (beacon.CreatePacket (), beacon.CreateHeader (GetAddress (), GetMeshPointAddress ())); |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
562 |
|
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
563 |
ScheduleNextBeacon (); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
564 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
565 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
566 |
MeshWifiInterfaceMac::Receive (Ptr<Packet> packet, WifiMacHeader const *hdr) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
567 |
{ |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
568 |
// Process beacon |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
569 |
if ((hdr->GetAddr1 () != GetAddress ()) && (hdr->GetAddr1 () != Mac48Address::GetBroadcast ())) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
570 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
571 |
return; |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
572 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
573 |
if (hdr->IsBeacon ()) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
574 |
{ |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
575 |
m_stats.recvBeacons++; |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
576 |
MgtBeaconHeader beacon_hdr; |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
577 |
Mac48Address from = hdr->GetAddr2 (); |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
578 |
|
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
579 |
packet->PeekHeader (beacon_hdr); |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
580 |
|
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
581 |
NS_LOG_DEBUG ("Beacon received from " << hdr->GetAddr2 () << " I am " << GetAddress () << " at " |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
582 |
<< Simulator::Now ().GetMicroSeconds () << " microseconds"); |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
583 |
|
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
584 |
// update supported rates |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
585 |
if (beacon_hdr.GetSsid ().IsEqual (GetSsid ())) |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
586 |
{ |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
587 |
SupportedRates rates = beacon_hdr.GetSupportedRates (); |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
588 |
WifiRemoteStation * peerSta = m_stationManager->Lookup (hdr->GetAddr2 ()); |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
589 |
|
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
590 |
for (uint32_t i = 0; i < m_phy->GetNModes (); i++) |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
591 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
592 |
WifiMode mode = m_phy->GetMode (i); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
593 |
if (rates.IsSupportedRate (mode.GetDataRate ())) |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
594 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
595 |
peerSta->AddSupportedMode (mode); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
596 |
if (rates.IsBasicRate (mode.GetDataRate ())) |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
597 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
598 |
m_stationManager->AddBasicMode (mode); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
599 |
} |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
600 |
} |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
601 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
602 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
603 |
} |
5014 | 604 |
else |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
605 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
606 |
m_stats.recvBytes += packet->GetSize (); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
607 |
m_stats.recvFrames++; |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
608 |
} |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
609 |
// Filter frame through all installed plugins |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
610 |
for (PluginList::iterator i = m_plugins.begin (); i != m_plugins.end (); ++i) |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
611 |
{ |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
612 |
bool drop = !((*i)->Receive (packet, *hdr)); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
613 |
if (drop) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
614 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
615 |
return; // plugin drops frame |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
616 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
617 |
} |
5115
7cdd24c28d4e
QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
618 |
// Check if QoS tag exists and add it: |
7cdd24c28d4e
QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents:
5114
diff
changeset
|
619 |
if (hdr->IsQosData ()) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
620 |
{ |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
621 |
packet->AddPacketTag (QosTag (hdr->GetQosTid ())); |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
622 |
} |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
623 |
// Forward data up |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
624 |
if (hdr->IsData ()) |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
625 |
{ |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
626 |
ForwardUp (packet, hdr->GetAddr4 (), hdr->GetAddr3 ()); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
627 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
628 |
} |
4944
779b641cff5a
Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents:
4934
diff
changeset
|
629 |
uint32_t |
779b641cff5a
Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents:
4934
diff
changeset
|
630 |
MeshWifiInterfaceMac::GetLinkMetric (Mac48Address peerAddress) |
779b641cff5a
Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents:
4934
diff
changeset
|
631 |
{ |
4946
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
632 |
uint32_t metric = 1; |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
633 |
if (!m_linkMetricCallback.IsNull ()) |
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
634 |
{ |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
635 |
metric = m_linkMetricCallback (peerAddress, this); |
5125
b90c6c0af6a3
Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
636 |
} |
4946
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
637 |
return metric; |
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
638 |
} |
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
639 |
void |
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
640 |
MeshWifiInterfaceMac::SetLinkMetricCallback (Callback<uint32_t, Mac48Address, Ptr<MeshWifiInterfaceMac> > cb) |
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
641 |
{ |
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
642 |
m_linkMetricCallback = cb; |
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
643 |
} |
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
644 |
Ptr<WifiRemoteStationManager> |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
645 |
MeshWifiInterfaceMac::GetStationManager () |
4946
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
646 |
{ |
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
647 |
return m_stationManager; |
4944
779b641cff5a
Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents:
4934
diff
changeset
|
648 |
} |
4985
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4964
diff
changeset
|
649 |
void |
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4964
diff
changeset
|
650 |
MeshWifiInterfaceMac::SetMeshPointAddress (Mac48Address a) |
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4964
diff
changeset
|
651 |
{ |
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4964
diff
changeset
|
652 |
m_mpAddress = a; |
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4964
diff
changeset
|
653 |
} |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
654 |
Mac48Address |
4985
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4964
diff
changeset
|
655 |
MeshWifiInterfaceMac::GetMeshPointAddress () const |
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4964
diff
changeset
|
656 |
{ |
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4964
diff
changeset
|
657 |
return m_mpAddress; |
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4964
diff
changeset
|
658 |
} |
5014 | 659 |
//Statistics: |
5126
8e06088a785d
Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents:
5125
diff
changeset
|
660 |
MeshWifiInterfaceMac::Statistics::Statistics () : |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
661 |
recvBeacons (0), sentFrames (0), sentBytes (0), recvFrames (0), recvBytes (0) |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
662 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
663 |
} |
5014 | 664 |
void |
665 |
MeshWifiInterfaceMac::Statistics::Print (std::ostream & os) const |
|
666 |
{ |
|
5015 | 667 |
os << "<Statistics " |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
668 |
// TODO txBeacons |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
669 |
"rxBeacons=\"" << recvBeacons << "\" " |
5038 | 670 |
"txFrames=\"" << sentFrames << "\" " |
5098
13ded9ff11c4
XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents:
5073
diff
changeset
|
671 |
"txBytes=\"" << sentBytes << "\" " |
5038 | 672 |
"rxFrames=\"" << recvFrames << "\" " |
5156 | 673 |
"rxBytes=\"" << recvBytes << "\"/>" << std::endl; |
5014 | 674 |
} |
675 |
void |
|
676 |
MeshWifiInterfaceMac::Report (std::ostream & os) const |
|
677 |
{ |
|
5015 | 678 |
os << "<Interface " |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
679 |
"BeaconInterval=\"" << GetBeaconInterval ().GetSeconds () << "\" " |
5015 | 680 |
"Channel=\"" << GetFrequencyChannel () << "\" " |
5156 | 681 |
"Address = \"" << GetAddress () << "\">" << std::endl; |
5014 | 682 |
m_stats.Print (os); |
5156 | 683 |
os << "</Interface>" << std::endl; |
5014 | 684 |
} |
685 |
void |
|
686 |
MeshWifiInterfaceMac::ResetStats () |
|
687 |
{ |
|
688 |
m_stats = Statistics::Statistics (); |
|
689 |
} |
|
5054 | 690 |
void |
5152
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
691 |
MeshWifiInterfaceMac::SetQueue (AccessClass ac) |
5054 | 692 |
{ |
5134 | 693 |
if (m_queues.find (ac) != m_queues.end ()) |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
694 |
{ |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
695 |
NS_LOG_WARN ("Queue is already set!"); |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
696 |
return; |
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
697 |
} |
5152
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
698 |
Ptr<DcaTxop> queue = Create<DcaTxop> (); |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
699 |
queue->SetLow (m_low); |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
700 |
queue->SetManager (m_dcfManager); |
5154
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
701 |
queue->SetTxOkCallback (MakeCallback (&MeshWifiInterfaceMac::TxOk, this)); |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
702 |
queue->SetTxFailedCallback (MakeCallback (&MeshWifiInterfaceMac::TxFailed, this)); |
5152
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
703 |
|
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
704 |
m_queues.insert (std::make_pair (ac, queue)); |
5054 | 705 |
} |
5152
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
706 |
void |
5154
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
707 |
MeshWifiInterfaceMac::TxOk (WifiMacHeader const &hdr) |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
708 |
{ |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
709 |
m_txOkCallback (hdr); |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
710 |
} |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
711 |
void |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
712 |
MeshWifiInterfaceMac::TxFailed (WifiMacHeader const &hdr) |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
713 |
{ |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
714 |
m_txErrCallback (hdr); |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
715 |
} |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
716 |
|
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
717 |
void |
5152
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
718 |
MeshWifiInterfaceMac::FinishConfigureStandard (enum WifiPhyStandard standard) |
5054 | 719 |
{ |
5152
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
720 |
switch (standard) |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
721 |
{ |
5152
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
722 |
case WIFI_PHY_STANDARD_holland: |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
723 |
// fall through |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
724 |
case WIFI_PHY_STANDARD_80211a: |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
725 |
// fall through |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
726 |
case WIFI_PHY_STANDARD_80211_10Mhz: |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
727 |
// fall through |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
728 |
case WIFI_PHY_STANDARD_80211_5Mhz: |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
729 |
ConfigureDcf (m_queues[AC_BK], 15, 1023, AC_BK); |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
730 |
ConfigureDcf (m_queues[AC_BE], 15, 1023, AC_BE); |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
731 |
ConfigureDcf (m_queues[AC_VI], 15, 1023, AC_VI); |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
732 |
ConfigureDcf (m_queues[AC_VO], 15, 1023, AC_VO); |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
733 |
break; |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
734 |
case WIFI_PHY_STANDARD_80211b: |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
735 |
ConfigureDcf (m_queues[AC_BK], 31, 1023, AC_BK); |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
736 |
ConfigureDcf (m_queues[AC_BE], 31, 1023, AC_BE); |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
737 |
ConfigureDcf (m_queues[AC_VI], 31, 1023, AC_VI); |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
738 |
ConfigureDcf (m_queues[AC_VO], 31, 1023, AC_VO); |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
739 |
break; |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
740 |
default: |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
741 |
NS_ASSERT (false); |
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
742 |
break; |
5128
d6e168eba404
Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents:
5126
diff
changeset
|
743 |
} |
5054 | 744 |
} |
5152
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5137
diff
changeset
|
745 |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
746 |
} // namespace ns3 |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
747 |