author | Kirill Andreev <andreev@iitp.ru> |
Fri, 26 Feb 2010 12:11:11 +0300 | |
changeset 6080 | 41ee42654550 |
parent 6069 | c21754b56036 |
child 6331 | eee2eab36748 |
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; -*- */ |
5129 | 2 |
/* |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 IITP RAS |
5129 | 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 |
5129 | 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 |
#ifndef MESHWIFIINTERFACEMAC_H_ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
23 |
#define MESHWIFIINTERFACEMAC_H_ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
24 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
25 |
#include <stdint.h> |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
26 |
#include <map> |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
27 |
#include "ns3/mac48-address.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
28 |
#include "ns3/mgt-headers.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
29 |
#include "ns3/callback.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
30 |
#include "ns3/packet.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
31 |
#include "ns3/nstime.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
32 |
#include "ns3/wifi-remote-station-manager.h" |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
33 |
#include "ns3/wifi-mac.h" |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
34 |
#include "ns3/mesh-wifi-interface-mac-plugin.h" |
4872 | 35 |
#include "ns3/event-id.h" |
5114
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5092
diff
changeset
|
36 |
#include "qos-utils.h" |
5132
aee541a30256
Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents:
5130
diff
changeset
|
37 |
namespace ns3 { |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
38 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
39 |
class WifiMacHeader; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
40 |
class DcaTxop; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
41 |
class WifiPhy; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
42 |
class DcfManager; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
43 |
class MacRxMiddle; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
44 |
class MacLow; |
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 |
* \ingroup mesh |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
47 |
* |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
48 |
* \brief Basic MAC of mesh point Wi-Fi interface. Its function is extendable through plugins mechanism. |
5129 | 49 |
* |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
50 |
* Now only three output queues are used: |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
51 |
* - beacons (PIFS and no backoff), |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
52 |
* - background traffic, |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
53 |
* - management and priority traffic. |
5129 | 54 |
* |
4843
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 |
class MeshWifiInterfaceMac : public WifiMac |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
57 |
{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
58 |
public: |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
59 |
/// Never forget to support typeid |
5129 | 60 |
static TypeId GetTypeId (); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
61 |
/// C-tor |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4849
diff
changeset
|
62 |
MeshWifiInterfaceMac (); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
63 |
/// D-tor |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4849
diff
changeset
|
64 |
virtual ~MeshWifiInterfaceMac (); |
5129 | 65 |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
66 |
///\name Inherited from WifiMac |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
67 |
//\{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
68 |
virtual void SetSlot (Time slotTime); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
69 |
virtual void SetSifs (Time sifs); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
70 |
virtual void SetPifs (Time pifs); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
71 |
virtual void SetCtsTimeout (Time ctsTimeout); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
72 |
virtual void SetAckTimeout (Time ackTimeout); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
73 |
virtual void SetEifsNoDifs (Time eifsNoDifs); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
74 |
virtual Time GetSlot () const; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
75 |
virtual Time GetSifs () const; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
76 |
virtual Time GetPifs () const; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
77 |
virtual Time GetCtsTimeout () const; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
78 |
virtual Time GetAckTimeout () const; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
79 |
virtual Time GetEifsNoDifs () const; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
80 |
virtual void SetWifiPhy (Ptr<WifiPhy> phy); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
81 |
virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
82 |
virtual void 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
|
83 |
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
84 |
virtual bool SupportsSendFrom () const; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
85 |
virtual void SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
86 |
virtual void SetLinkUpCallback (Callback<void> linkUp); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
87 |
virtual void SetLinkDownCallback (Callback<void> linkDown); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
88 |
virtual Mac48Address GetAddress () const; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
89 |
virtual Mac48Address GetBssid () const; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
90 |
virtual Ssid GetSsid () const; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
91 |
virtual void SetAddress (Mac48Address address); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
92 |
virtual void SetSsid (Ssid ssid); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
93 |
//\} |
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
5906
diff
changeset
|
94 |
///Needed to obtain phy to calculate TX-duration |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
5906
diff
changeset
|
95 |
Ptr<WifiPhy> GetWifiPhy () const; |
4985
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4946
diff
changeset
|
96 |
///\name Each mesh point interfaces must know the mesh point address |
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4946
diff
changeset
|
97 |
//\{ |
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4946
diff
changeset
|
98 |
void SetMeshPointAddress (Mac48Address); |
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4946
diff
changeset
|
99 |
Mac48Address 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:
4946
diff
changeset
|
100 |
//\} |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
101 |
///\name Beacons |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
102 |
//\{ |
4929
1689c94d7442
802.11s helper (ns3::dot11s::MeshWifiHelper) refactored
Pavel Boyko <boyko@iitp.ru>
parents:
4878
diff
changeset
|
103 |
/// Set maximum initial random delay before first beacon |
1689c94d7442
802.11s helper (ns3::dot11s::MeshWifiHelper) refactored
Pavel Boyko <boyko@iitp.ru>
parents:
4878
diff
changeset
|
104 |
void SetRandomStartDelay (Time interval); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
105 |
/// Set interval between two successive beacons |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
106 |
void SetBeaconInterval (Time interval); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
107 |
/// \return interval between two beacons |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
108 |
Time GetBeaconInterval () const; |
5129 | 109 |
/** |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
110 |
* \brief Next beacon frame time |
5129 | 111 |
* |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
112 |
* This is supposed to be used by any entity managing beacon collision avoidance (e.g. Peer management protocol in 802.11s) |
5129 | 113 |
*/ |
4855
0b5980b04249
Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents:
4852
diff
changeset
|
114 |
Time GetTbtt () const; |
4843
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 |
* \brief Shift TBTT. |
5129 | 117 |
* |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
118 |
* This is supposed to be used by any entity managing beacon collision avoidance (e.g. Peer management protocol in 802.11s) |
5129 | 119 |
* |
120 |
* \attention User of ShiftTbtt () must take care to not shift it to the past. |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
121 |
*/ |
4857
ddfb13420455
Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents:
4855
diff
changeset
|
122 |
void ShiftTbtt (Time shift); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
123 |
//\} |
5129 | 124 |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
125 |
///\name Plugins |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
126 |
//\{ |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
127 |
/// Install plugin. TODO return unique ID to allow unregister plugins |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4849
diff
changeset
|
128 |
void InstallPlugin (Ptr<MeshWifiInterfaceMacPlugin> plugin); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
129 |
//\} |
5129 | 130 |
|
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
131 |
/** \name Channel switching |
5129 | 132 |
* |
133 |
* Channel center frequency = Channel starting frequency + 5 * channel_id (MHz), |
|
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
134 |
* where Starting channel frequency is standard-dependent as defined in IEEE 802.11-2007 17.3.8.3.2. |
5129 | 135 |
* |
136 |
* Number of channels to use must be limited elsewhere. |
|
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
137 |
*/ |
4865
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
138 |
//\{ |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
139 |
/// Current channel Id |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
140 |
uint16_t GetFrequencyChannel () const; |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
141 |
/// Switch channel |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
142 |
void SwitchFrequencyChannel (uint16_t new_id); |
4865
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
143 |
//\} |
5129 | 144 |
|
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
145 |
/// To be used by plugins sending management frames. |
5130 | 146 |
void SendManagementFrame (Ptr<Packet> frame, const WifiMacHeader& hdr); |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
147 |
/// \return true if rates are supported |
5130 | 148 |
bool CheckSupportedRates (SupportedRates rates) const; |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4929
diff
changeset
|
149 |
/// \return list of supported bitrates |
4865
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
150 |
SupportedRates GetSupportedRates () const; |
4946
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
151 |
///\ name Metric Calculation routines: |
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
152 |
///\{ |
5130 | 153 |
void SetLinkMetricCallback (Callback<uint32_t, Mac48Address, Ptr<MeshWifiInterfaceMac> > cb); |
154 |
uint32_t GetLinkMetric (Mac48Address peerAddress); |
|
4946
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
155 |
Ptr<WifiRemoteStationManager> GetStationManager (); |
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
156 |
///\} |
5014 | 157 |
///\brief Statistics: |
158 |
void Report (std::ostream &) const; |
|
159 |
void ResetStats (); |
|
5092 | 160 |
/// Enable/disable beacons |
161 |
void SetBeaconGeneration (bool enable); |
|
5152
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
162 |
void SetQueue (AccessClass ac); |
5828
9959ba75ba25
Mesh:Dot11s: fixed airtime metric
Kirill Andreev <andreev@iitp.ru>
parents:
5177
diff
changeset
|
163 |
WifiPhyStandard GetPhyStandard () const; |
5152
f14eff131d13
Merge with code.nsnam.org
Kirill Andreev <andreev@iitp.ru>
parents:
5132
diff
changeset
|
164 |
virtual void FinishConfigureStandard (enum WifiPhyStandard standard); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
165 |
private: |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
166 |
/// Frame receive handler |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
167 |
void Receive (Ptr<Packet> packet, WifiMacHeader const *hdr); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
168 |
/// Forward frame to mesh point |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
169 |
virtual void ForwardUp (Ptr<Packet> packet, Mac48Address src, Mac48Address dst); |
5129 | 170 |
/// Send frame. Frame is supposed to be tagged by routing information. TODO: clarify this point |
4852
123dc54d734e
Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents:
4849
diff
changeset
|
171 |
void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to); |
5154
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
172 |
// Notify about tx OK/Error frames: |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
173 |
void TxOk (WifiMacHeader const &hdr); |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
174 |
void TxFailed (WifiMacHeader const &hdr); |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
175 |
/// Send beacon |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
176 |
void SendBeacon (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
177 |
/// Schedule next beacon |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
178 |
void ScheduleNextBeacon (); |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
179 |
/// Get current beaconing status |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
180 |
bool GetBeaconGeneration () const; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
181 |
/// Real d-tor |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
182 |
virtual void DoDispose (); |
6080 | 183 |
///Initiator at t=0 |
184 |
void DoStart (); |
|
5129 | 185 |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
186 |
private: |
5177 | 187 |
typedef std::map<AccessClass, Ptr<DcaTxop> > Queues; |
188 |
typedef std::vector<Ptr<MeshWifiInterfaceMacPlugin> > PluginList; |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
189 |
///\name Wifi MAC internals |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
190 |
//\{ |
5114
505e762ea818
Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents:
5092
diff
changeset
|
191 |
Queues m_queues; |
5129 | 192 |
Ptr<DcaTxop> m_beaconDca; |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
193 |
Ptr<WifiRemoteStationManager> m_stationManager; |
5129 | 194 |
Ptr<WifiPhy> m_phy; |
195 |
Callback<void, Ptr<Packet> , Mac48Address, Mac48Address> m_upCallback; |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
196 |
//\} |
5129 | 197 |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
198 |
///\name Wifi timing intervals |
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 |
Time m_slot; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
201 |
Time m_sifs; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
202 |
Time m_pifs; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
203 |
Time m_ackTimeout; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
204 |
Time m_ctsTimeout; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
205 |
Time m_eifsNoDifs; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
206 |
//\} |
5129 | 207 |
|
208 |
///\name Mesh timing intervals |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
209 |
//\{ |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
210 |
/// Beaconing interval. |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
211 |
Time m_beaconInterval; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
212 |
/// Maximum delay before first beacon |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
213 |
Time m_randomStart; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
214 |
/// Time for the next frame |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
215 |
Time m_tbtt; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
216 |
//\} |
5129 | 217 |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
218 |
/// DCF implementation |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
219 |
DcfManager* m_dcfManager; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
220 |
/// Middle MAC sublayer |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
221 |
MacRxMiddle* m_rxMiddle; |
4849
323c3cf6cf96
Merge fix - mac interface did not compile
Kirill Andreev <andreev@iitp.ru>
parents:
4844
diff
changeset
|
222 |
/// Low MAC sublayer |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
223 |
Ptr<MacLow> m_low; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
224 |
/// My address |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
225 |
Mac48Address m_address; |
4985
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4946
diff
changeset
|
226 |
/// Mesh point address |
8dbdba66f5e1
Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents:
4946
diff
changeset
|
227 |
Mac48Address m_mpAddress; |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
228 |
/// SSID |
4865
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4857
diff
changeset
|
229 |
Ssid m_meshId; |
5129 | 230 |
|
231 |
/// "Timer" for the next beacon |
|
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
232 |
EventId m_beaconSendEvent; |
4844
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
233 |
/// List of all installed plugins |
3c38e23fa821
Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents:
4843
diff
changeset
|
234 |
PluginList m_plugins; |
4946
f97e16db1d79
Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents:
4944
diff
changeset
|
235 |
Callback<uint32_t, Mac48Address, Ptr<MeshWifiInterfaceMac> > m_linkMetricCallback; |
5014 | 236 |
///\name Statistics: |
237 |
///\{ |
|
238 |
struct Statistics |
|
239 |
{ |
|
240 |
uint16_t recvBeacons; |
|
241 |
uint32_t sentFrames; |
|
242 |
uint32_t sentBytes; |
|
243 |
uint32_t recvFrames; |
|
244 |
uint32_t recvBytes; |
|
5129 | 245 |
void |
246 |
Print (std::ostream & os) const; |
|
5126
8e06088a785d
Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents:
5123
diff
changeset
|
247 |
Statistics (); |
5014 | 248 |
}; |
249 |
Statistics m_stats; |
|
250 |
///\} |
|
5154
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
251 |
TracedCallback<WifiMacHeader const &> m_txOkCallback; |
bb06787ed7fe
Added closing link due to transmission failure.
Kirill Andreev <andreev@iitp.ru>
parents:
5152
diff
changeset
|
252 |
TracedCallback<WifiMacHeader const &> m_txErrCallback; |
5828
9959ba75ba25
Mesh:Dot11s: fixed airtime metric
Kirill Andreev <andreev@iitp.ru>
parents:
5177
diff
changeset
|
253 |
/// Current PHY standard: needed to configure metric |
9959ba75ba25
Mesh:Dot11s: fixed airtime metric
Kirill Andreev <andreev@iitp.ru>
parents:
5177
diff
changeset
|
254 |
WifiPhyStandard m_standard; |
4843
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
255 |
}; |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
256 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
257 |
} // namespace ns3 |
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
258 |
|
f65f22ef327e
MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff
changeset
|
259 |
#endif /* MESHWIFIINTERFACEMAC_H_ */ |