author | Kirill Andreev <andreev@iitp.ru> |
Thu, 19 Mar 2009 17:28:37 +0300 | |
changeset 4857 | ddfb13420455 |
parent 4855 | 0b5980b04249 |
child 4865 | e331ed5d3662 |
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; -*- */ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
2 |
/* |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 IITP RAS |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
4 |
* |
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 |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
17 |
* |
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/mesh-wifi-mac-header.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
31 |
#include "ns3/random-variable.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
32 |
#include "ns3/simulator.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
33 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
34 |
NS_LOG_COMPONENT_DEFINE ("MeshWifiInterfaceMac"); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
35 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
36 |
namespace ns3 { |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
37 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
38 |
NS_OBJECT_ENSURE_REGISTERED (MeshWifiInterfaceMac); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
39 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
40 |
TypeId |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
41 |
MeshWifiInterfaceMac::GetTypeId () |
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 |
static TypeId tid = TypeId ("ns3::MeshWifiInterfaceMac") |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
44 |
.SetParent<WifiMac> () |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
45 |
.AddConstructor<MeshWifiInterfaceMac> () |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
46 |
.AddAttribute ("BeaconInterval", "Beacon Interval", |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
47 |
TimeValue (Seconds (1.0)), |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
48 |
MakeTimeAccessor (&MeshWifiInterfaceMac::m_beaconInterval), |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
49 |
MakeTimeChecker () |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
50 |
) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
51 |
.AddAttribute ("RandomStart", "Window when beacon generating starts (uniform random) in seconds", |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
52 |
TimeValue (Seconds (0.1)), |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
53 |
MakeTimeAccessor (&MeshWifiInterfaceMac::m_randomStart), |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
54 |
MakeTimeChecker () |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
55 |
) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
56 |
.AddAttribute ("SoftwareDelay", "Window of uniformely distributed random software handling delay", |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
57 |
TimeValue (MicroSeconds (500)), |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
58 |
MakeTimeAccessor (&MeshWifiInterfaceMac::m_softwareDelay), |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
59 |
MakeTimeChecker () |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
60 |
) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
61 |
.AddAttribute ("BeaconGeneration", "Enable/Disable Beaconing.", |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
62 |
BooleanValue (true), |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
63 |
MakeBooleanAccessor ( |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
64 |
&MeshWifiInterfaceMac::SetBeaconGeneration, |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
65 |
&MeshWifiInterfaceMac::GetBeaconGeneration |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
66 |
), |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
67 |
MakeBooleanChecker () |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
68 |
); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
69 |
return tid; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
70 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
71 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
72 |
MeshWifiInterfaceMac::MeshWifiInterfaceMac () |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
73 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
74 |
NS_LOG_FUNCTION (this); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
75 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
76 |
m_rxMiddle = new MacRxMiddle (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
77 |
m_rxMiddle->SetForwardCallback (MakeCallback (&MeshWifiInterfaceMac::Receive, this)); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
78 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
79 |
m_low = CreateObject<MacLow> (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
80 |
m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle)); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
81 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
82 |
m_dcfManager = new DcfManager (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
83 |
m_dcfManager->SetupLowListener (m_low); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
84 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
85 |
m_beaconDca = CreateObject<DcaTxop> (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
86 |
m_beaconDca->SetLow (m_low); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
87 |
m_beaconDca->SetMinCw (0); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
88 |
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
|
89 |
m_beaconDca->SetAifsn (1); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
90 |
m_beaconDca->SetManager (m_dcfManager); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
91 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
92 |
m_VO = CreateObject<DcaTxop> (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
93 |
m_VO->SetLow (m_low); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
94 |
m_VO->SetMinCw (3); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
95 |
m_VO->SetMaxCw (7); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
96 |
m_VO->SetManager (m_dcfManager); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
97 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
98 |
m_BE = CreateObject<DcaTxop> (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
99 |
m_BE->SetLow (m_low); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
100 |
m_BE->SetManager (m_dcfManager); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
101 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
102 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
103 |
MeshWifiInterfaceMac::~MeshWifiInterfaceMac () |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
104 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
105 |
NS_LOG_FUNCTION (this); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
106 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
107 |
|
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 |
// WifiMac inherited |
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 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
112 |
MeshWifiInterfaceMac::SetSlot (Time slotTime) |
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 |
NS_LOG_FUNCTION (this << slotTime); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
115 |
m_dcfManager->SetSlot (slotTime); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
116 |
m_slot = slotTime; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
117 |
} |
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 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
120 |
MeshWifiInterfaceMac::SetSifs (Time sifs) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
121 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
122 |
NS_LOG_FUNCTION (this << sifs); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
123 |
m_dcfManager->SetSifs (sifs); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
124 |
m_sifs = sifs; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
125 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
126 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
127 |
MeshWifiInterfaceMac::SetAckTimeout (Time ackTimeout) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
128 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
129 |
m_low->SetAckTimeout (ackTimeout); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
130 |
} |
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::SetCtsTimeout (Time ctsTimeout) |
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->SetCtsTimeout (ctsTimeout); |
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 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
138 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
139 |
MeshWifiInterfaceMac::SetPifs (Time pifs) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
140 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
141 |
NS_LOG_FUNCTION (this << pifs); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
142 |
m_pifs = pifs; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
143 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
144 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
145 |
MeshWifiInterfaceMac::SetEifsNoDifs (Time eifsNoDifs) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
146 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
147 |
NS_LOG_FUNCTION (this << eifsNoDifs); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
148 |
m_dcfManager->SetEifsNoDifs (eifsNoDifs); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
149 |
m_eifsNoDifs = 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 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
152 |
Time |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
153 |
MeshWifiInterfaceMac::GetSlot () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
154 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
155 |
return m_slot; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
156 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
157 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
158 |
Time |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
159 |
MeshWifiInterfaceMac::GetSifs () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
160 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
161 |
return m_sifs; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
162 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
163 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
164 |
Time |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
165 |
MeshWifiInterfaceMac::GetEifsNoDifs () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
166 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
167 |
return m_eifsNoDifs; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
168 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
169 |
|
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 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
176 |
Time |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
177 |
MeshWifiInterfaceMac::GetCtsTimeout () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
178 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
179 |
return m_low->GetCtsTimeout (); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
180 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
181 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
182 |
Time |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
183 |
MeshWifiInterfaceMac::GetPifs () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
184 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
185 |
return m_low->GetPifs (); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
186 |
} |
4843
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 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
189 |
MeshWifiInterfaceMac::SetWifiPhy (Ptr<WifiPhy> phy) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
190 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
191 |
NS_LOG_FUNCTION (this << phy); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
192 |
m_phy = phy; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
193 |
m_dcfManager->SetupPhyListener (phy); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
194 |
m_low->SetPhy (phy); |
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 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
197 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
198 |
MeshWifiInterfaceMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
199 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
200 |
NS_LOG_FUNCTION (this << stationManager); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
201 |
m_stationManager = stationManager; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
202 |
m_BE->SetWifiRemoteStationManager (stationManager); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
203 |
m_VO->SetWifiRemoteStationManager (stationManager); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
204 |
m_beaconDca->SetWifiRemoteStationManager (stationManager); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
205 |
m_low->SetWifiRemoteStationManager (stationManager); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
206 |
} |
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 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
209 |
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
|
210 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
211 |
NS_LOG_FUNCTION (this << packet << to << from); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
212 |
ForwardDown (packet, from, 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 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
215 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
216 |
MeshWifiInterfaceMac::Enqueue (Ptr<const Packet> packet, Mac48Address to) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
217 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
218 |
NS_LOG_FUNCTION (this << packet << to); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
219 |
ForwardDown (packet, m_low->GetAddress (), to); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
220 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
221 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
222 |
bool |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
223 |
MeshWifiInterfaceMac::SupportsSendFrom () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
224 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
225 |
return true; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
226 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
227 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
228 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
229 |
MeshWifiInterfaceMac::SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
230 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
231 |
NS_LOG_FUNCTION (this); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
232 |
m_upCallback = upCallback; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
233 |
} |
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 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
236 |
MeshWifiInterfaceMac::SetLinkUpCallback (Callback<void> linkUp) |
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 |
NS_LOG_FUNCTION (this); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
239 |
if (!linkUp.IsNull ()) |
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 |
linkUp (); |
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 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
244 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
245 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
246 |
MeshWifiInterfaceMac::SetLinkDownCallback (Callback<void> linkDown) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
247 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
248 |
NS_LOG_FUNCTION (this); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
249 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
250 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
251 |
Mac48Address |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
252 |
MeshWifiInterfaceMac::GetAddress () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
253 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
254 |
return m_address; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
255 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
256 |
Mac48Address |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
257 |
MeshWifiInterfaceMac::GetBssid () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
258 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
259 |
return m_address; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
260 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
261 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
262 |
Ssid |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
263 |
MeshWifiInterfaceMac::GetSsid () const |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
264 |
{ |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
265 |
return m_MeshId; |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
266 |
} |
4843
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 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
269 |
MeshWifiInterfaceMac::SetAddress (Mac48Address address) |
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 |
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
|
272 |
m_low->SetAddress (address); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
273 |
m_address = address; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
274 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
275 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
276 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
277 |
MeshWifiInterfaceMac::SetSsid (Ssid ssid) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
278 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
279 |
NS_LOG_FUNCTION (ssid); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
280 |
m_MeshId = ssid; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
281 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
282 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
283 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
284 |
MeshWifiInterfaceMac::DoDispose () |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
285 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
286 |
NS_LOG_FUNCTION (this); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
287 |
delete m_rxMiddle; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
288 |
delete m_dcfManager; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
289 |
//Delete smart pointers: |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
290 |
m_rxMiddle = 0; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
291 |
m_low = 0; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
292 |
m_dcfManager = 0; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
293 |
m_phy = 0; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
294 |
m_BE = 0; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
295 |
m_VO = 0; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
296 |
m_beaconSendEvent.Cancel (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
297 |
m_beaconDca = 0; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
298 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
299 |
WifiMac::DoDispose (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
300 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
301 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
302 |
//----------------------------------------------------------------------------- |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
303 |
// Plugins |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
304 |
//----------------------------------------------------------------------------- |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
305 |
void |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
306 |
MeshWifiInterfaceMac::InstallPlugin ( Ptr<MeshWifiInterfaceMacPlugin> plugin) |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
307 |
{ |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
308 |
plugin->SetParent (this); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
309 |
m_plugins.push_back (plugin); |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
310 |
} |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
311 |
|
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
312 |
//----------------------------------------------------------------------------- |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
313 |
// Forward frame up/down |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
314 |
//----------------------------------------------------------------------------- |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
315 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
316 |
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
|
317 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
318 |
NS_LOG_FUNCTION (this << packet << src); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
319 |
m_upCallback (packet, src, dst); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
320 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
321 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
322 |
void |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
323 |
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
|
324 |
{ |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
325 |
// 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
|
326 |
Ptr<Packet> packet = const_packet->Copy (); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
327 |
|
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
328 |
WifiMacHeader hdr; |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
329 |
hdr.SetTypeData (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
330 |
hdr.SetAddr2 (GetAddress ()); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
331 |
hdr.SetAddr3 (to); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
332 |
hdr.SetAddr4 (from); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
333 |
hdr.SetDsFrom (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
334 |
hdr.SetDsTo (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
335 |
|
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
336 |
// 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
|
337 |
hdr.SetAddr1 (Mac48Address ()); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
338 |
|
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
339 |
// Filter packet through all installed plugins |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
340 |
for (PluginList::const_iterator i = m_plugins.begin(); i != m_plugins.end(); ++i) |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
341 |
{ |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
342 |
bool drop = ! ((*i)->UpdateOutcomingFrame(packet, hdr, from, to)); |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
343 |
if (drop) return; // plugin drops frame |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
344 |
} |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
345 |
|
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
346 |
// Assert that address1 is set. Assert will fail e.g. if there is no installed routing plugin. |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
347 |
NS_ASSERT (hdr.GetAddr1() != Mac48Address() ); |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
348 |
|
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
349 |
// Queue frame |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
350 |
WifiRemoteStation *destination = m_stationManager->Lookup (to); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
351 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
352 |
if (destination->IsBrandNew ()) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
353 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
354 |
// in adhoc mode, we assume that every destination |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
355 |
// supports all the rates we support. |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
356 |
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
|
357 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
358 |
destination->AddSupportedMode (m_phy->GetMode (i)); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
359 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
360 |
destination->RecordDisassociated (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
361 |
} |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
362 |
m_BE->Queue (packet, hdr); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
363 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
364 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
365 |
SupportedRates |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
366 |
MeshWifiInterfaceMac::GetSupportedRates () const |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
367 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
368 |
// 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
|
369 |
// 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
|
370 |
SupportedRates rates; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
371 |
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
|
372 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
373 |
WifiMode mode = m_phy->GetMode (i); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
374 |
rates.AddSupportedRate (mode.GetDataRate ()); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
375 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
376 |
// set the basic rates |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
377 |
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
|
378 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
379 |
WifiMode mode = m_stationManager->GetBasicMode (j); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
380 |
rates.SetBasicRate (mode.GetDataRate ()); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
381 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
382 |
return rates; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
383 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
384 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
385 |
//----------------------------------------------------------------------------- |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
386 |
// Beacons |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
387 |
//----------------------------------------------------------------------------- |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
388 |
void |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
389 |
MeshWifiInterfaceMac::SetSoftwareDelay (Time delay) |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
390 |
{ |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
391 |
NS_ASSERT (delay < m_beaconInterval); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
392 |
m_softwareDelay = delay; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
393 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
394 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
395 |
Time |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
396 |
MeshWifiInterfaceMac::GetSoftwareDelay () |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
397 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
398 |
return m_softwareDelay; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
399 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
400 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
401 |
Time |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
402 |
MeshWifiInterfaceMac::CalcSwDelay () |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
403 |
{ |
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
404 |
#if 0 |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
405 |
UniformVariable coefficient (0.0, m_softwareDelay.GetSeconds()); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
406 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
407 |
// Be sure that frames don't change order due to different software delays |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
408 |
Time delay = Seconds (coefficient.GetValue()); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
409 |
if (delay.GetSeconds () + Simulator::Now().GetSeconds() < m_lastMgtFrame.GetSeconds()) |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
410 |
delay = Seconds (m_lastMgtFrame.GetSeconds() - Simulator::Now().GetSeconds()); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
411 |
m_lastMgtFrame = Seconds (Simulator::Now().GetSeconds() + delay.GetSeconds()); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
412 |
|
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
413 |
NS_ASSERT (delay.GetSeconds() >= 0); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
414 |
return delay; |
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
415 |
#endif |
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
416 |
return MicroSeconds(0); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
417 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
418 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
419 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
420 |
MeshWifiInterfaceMac::SetBeaconInterval (Time interval) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
421 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
422 |
NS_LOG_FUNCTION (this << interval); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
423 |
m_beaconInterval = interval; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
424 |
|
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
425 |
NS_ASSERT (m_beaconInterval > m_softwareDelay); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
426 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
427 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
428 |
Time |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
429 |
MeshWifiInterfaceMac::GetBeaconInterval () const |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
430 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
431 |
return m_beaconInterval; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
432 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
433 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
434 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
435 |
MeshWifiInterfaceMac::SetBeaconGeneration (bool enable) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
436 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
437 |
NS_LOG_FUNCTION (this << enable); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
438 |
if (enable) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
439 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
440 |
// Now start sending beacons after some random delay (to avoid collisions) |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
441 |
UniformVariable coefficient (0.0, m_randomStart.GetSeconds()); |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
442 |
Time randomStart = Seconds (coefficient.GetValue()); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
443 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
444 |
m_beaconSendEvent = Simulator::Schedule (randomStart, &MeshWifiInterfaceMac::SendBeacon, this); |
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
445 |
m_tbtt = Simulator::Now() + randomStart; |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
446 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
447 |
else |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
448 |
// stop sending beacons |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
449 |
m_beaconSendEvent.Cancel (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
450 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
451 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
452 |
bool |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
453 |
MeshWifiInterfaceMac::GetBeaconGeneration () const |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
454 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
455 |
return m_beaconSendEvent.IsRunning (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
456 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
457 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
458 |
Time |
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
459 |
MeshWifiInterfaceMac::GetTbtt () const |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
460 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
461 |
return m_tbtt; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
462 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
463 |
|
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
4855
diff
changeset
|
464 |
void MeshWifiInterfaceMac::ShiftTbtt (Time shift) |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
465 |
{ |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
4855
diff
changeset
|
466 |
// User of ShiftTbtt () must take care don't shift it to the past |
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
467 |
NS_ASSERT (GetTbtt() + shift > Simulator::Now()); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
468 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
469 |
m_tbtt += shift; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
470 |
// Shift scheduled event |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
471 |
Simulator::Cancel (m_beaconSendEvent); |
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
472 |
m_beaconSendEvent = Simulator::Schedule (GetTbtt () - Simulator::Now(), &MeshWifiInterfaceMac::SendBeacon, this); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
473 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
474 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
475 |
void |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
476 |
MeshWifiInterfaceMac::ScheduleNextBeacon () |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
477 |
{ |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
478 |
m_tbtt += GetBeaconInterval (); |
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
479 |
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
|
480 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
481 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
482 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
483 |
MeshWifiInterfaceMac::SendBeacon () |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
484 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
485 |
NS_LOG_FUNCTION (this); |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
486 |
NS_LOG_DEBUG (GetAddress() <<" is sending beacon"); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
487 |
|
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
488 |
NS_ASSERT (! m_beaconSendEvent.IsRunning()); |
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
489 |
NS_ASSERT (Simulator::Now().GetMicroSeconds() == GetTbtt().GetMicroSeconds()); // assert that beacon is just on time |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
490 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
491 |
// Form & send beacon |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
492 |
MeshWifiBeacon beacon (GetSsid (), GetSupportedRates (), m_beaconInterval.GetMicroSeconds ()); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
493 |
|
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
494 |
// Ask all plugins to add their specific information elements to beacon |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
495 |
for (PluginList::const_iterator i = m_plugins.begin(); i != m_plugins.end(); ++i) |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
496 |
(*i)->UpdateBeacon (beacon); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
497 |
|
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
498 |
m_beaconDca->Queue (beacon.CreatePacket(), beacon.CreateHeader(GetAddress())); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
499 |
|
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
500 |
ScheduleNextBeacon (); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
501 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
502 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
503 |
void |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
504 |
MeshWifiInterfaceMac::Receive (Ptr<Packet> packet, WifiMacHeader const *hdr) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
505 |
{ |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
506 |
// Process beacon |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
507 |
if (hdr->IsBeacon ()) |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
508 |
{ |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
509 |
MgtBeaconHeader beacon_hdr; |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
510 |
Mac48Address from = hdr->GetAddr2 (); |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
511 |
|
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
512 |
packet->PeekHeader (beacon_hdr); |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
513 |
|
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
514 |
NS_LOG_UNCOND ("Beacon received from "<<hdr->GetAddr2()<< |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
515 |
" to "<<GetAddress ()<< |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
516 |
" at "<<Simulator::Now ().GetMicroSeconds ()<< |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
517 |
" microseconds"); |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
518 |
|
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
519 |
// update supported rates |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
520 |
if (beacon_hdr.GetSsid ().IsEqual(GetSsid())) |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
521 |
{ |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
522 |
SupportedRates rates = beacon_hdr.GetSupportedRates (); |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
523 |
WifiRemoteStation * peerSta = m_stationManager->Lookup (hdr->GetAddr2 ()); |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
524 |
|
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
525 |
for (uint32_t i = 0; i < m_phy->GetNModes (); i++) |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
526 |
{ |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
527 |
WifiMode mode = m_phy->GetMode (i); |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
528 |
if (rates.IsSupportedRate (mode.GetDataRate ())) |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
529 |
{ |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
530 |
peerSta->AddSupportedMode (mode); |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
531 |
if (rates.IsBasicRate (mode.GetDataRate ())) |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
532 |
m_stationManager->AddBasicMode (mode); |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
533 |
} |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
534 |
} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
535 |
} |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
536 |
} |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
537 |
|
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
538 |
// Filter frame through all installed plugins |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
539 |
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
|
540 |
{ |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
541 |
bool drop = ! ((*i)->Receive(packet, *hdr)); |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
542 |
if (drop) return; // plugin drops frame |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
543 |
} |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
544 |
|
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
545 |
// Forward data up |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
546 |
if (hdr->IsData ()) |
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
547 |
ForwardUp (packet, hdr->GetAddr4(), hdr->GetAddr3()); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
548 |
} |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4844
diff
changeset
|
549 |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
550 |
} // namespace ns3 |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
551 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
552 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
553 |