author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Thu, 25 Feb 2010 15:16:53 +0100 | |
changeset 6071 | 6a25c600c450 |
parent 6070 | a971811bb21a |
child 6166 | 0590ed1bdcfb |
permissions | -rw-r--r-- |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
/* |
1912
028e1945d5b2
fix copyright statement
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1911
diff
changeset
|
3 |
* Copyright (c) 2005,2006,2007 INRIA |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
19 |
*/ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
20 |
#ifndef WIFI_REMOTE_STATION_MANAGER_H |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
21 |
#define WIFI_REMOTE_STATION_MANAGER_H |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
|
1930
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
23 |
#include <vector> |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
24 |
#include <utility> |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
#include "ns3/mac48-address.h" |
6065 | 26 |
#include "ns3/traced-callback.h" |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2003
diff
changeset
|
27 |
#include "ns3/packet.h" |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
28 |
#include "ns3/object.h" |
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6065
diff
changeset
|
29 |
#include "ns3/nstime.h" |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
30 |
#include "wifi-mode.h" |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
31 |
|
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
32 |
namespace ns3 { |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
34 |
class WifiRemoteStation; |
6065 | 35 |
class WifiRemoteStationState; |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
36 |
class WifiPhy; |
6065 | 37 |
class WifiMacHeader; |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
38 |
|
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2530
diff
changeset
|
39 |
/** |
6071
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
40 |
* \brief Tid independent remote station statistics |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
41 |
* |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
42 |
* Structure is similar to struct sta_info in Linux kernel (see |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
43 |
* net/mac80211/sta_info.h) |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
44 |
*/ |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
45 |
class WifiRemoteStationInfo |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
46 |
{ |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
47 |
public: |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
48 |
WifiRemoteStationInfo (); |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
49 |
/** |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
50 |
* \brief Updates average frame error rate when data or RTS |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
51 |
* was transmitted successfully. |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
52 |
* \param retryCounter is slrc or ssrc value at the moment of |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
53 |
* success transmission. |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
54 |
*/ |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
55 |
void NotifyTxSuccess (uint32_t retryCounter); |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
56 |
/// Updates average frame error rate when final data or RTS has failed. |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
57 |
void NotifyTxFailed (); |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
58 |
/// Returns frame error rate (probability that frame is corrupted due to transmission error). |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
59 |
double GetFrameErrorRate () const; |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
60 |
private: |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
61 |
/** |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
62 |
* \brief Calculate averaging coefficient for frame error rate. Depends on time of the last update. |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
63 |
* \attention Calling this method twice gives different results, |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
64 |
* because it resets time of last update. |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
65 |
*/ |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
66 |
double CalculateAveragingCoefficient (); |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
67 |
///averaging coefficient depends on the memory time |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
68 |
Time m_memoryTime; |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
69 |
///when last update has occured |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
70 |
Time m_lastUpdate; |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
71 |
/// moving percentage of failed frames |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
72 |
double m_failAvg; |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
73 |
}; |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
74 |
|
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
75 |
/** |
3154 | 76 |
* \brief hold a list of per-remote-station state. |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2530
diff
changeset
|
77 |
* |
3154 | 78 |
* \sa ns3::WifiRemoteStation. |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2530
diff
changeset
|
79 |
*/ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
80 |
class WifiRemoteStationManager : public Object |
1930
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
81 |
{ |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
82 |
private: |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
83 |
typedef std::vector<WifiMode> BasicModes; |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
84 |
public: |
1930
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
85 |
typedef BasicModes::const_iterator BasicModesIterator; |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
86 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
87 |
static TypeId GetTypeId (void); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
88 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
89 |
WifiRemoteStationManager (); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
90 |
virtual ~WifiRemoteStationManager (); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
91 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
92 |
virtual void SetupPhy (Ptr<WifiPhy> phy); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
93 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
94 |
uint32_t GetMaxSsrc (void) const; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
95 |
uint32_t GetMaxSlrc (void) const; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
96 |
uint32_t GetRtsCtsThreshold (void) const; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
97 |
uint32_t GetFragmentationThreshold (void) const; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
98 |
void SetMaxSsrc (uint32_t maxSsrc); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
99 |
void SetMaxSlrc (uint32_t maxSlrc); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
100 |
void SetRtsCtsThreshold (uint32_t threshold); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
101 |
void SetFragmentationThreshold (uint32_t threshold); |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
102 |
|
1930
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
103 |
// Invoked in a STA upon dis-association |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
104 |
// or in an AP upon reboot |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
105 |
void Reset (void); |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
106 |
// Invoked in a STA upon association to store |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
107 |
// the set of rates which belong to the |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
108 |
// BSSBasicRateSet of the associated AP |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
109 |
// and which are supported locally. |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
110 |
// Invoked in an AP to configure the BSSBasicRateSet |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
111 |
void AddBasicMode (WifiMode mode); |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
112 |
|
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
113 |
WifiMode GetDefaultMode (void) const; |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
114 |
uint32_t GetNBasicModes (void) const; |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
115 |
WifiMode GetBasicMode (uint32_t i) const; |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
116 |
BasicModesIterator BeginBasicModes (void) const; |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
117 |
BasicModesIterator EndBasicModes (void) const; |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
118 |
|
4324
951aec5a7b9a
bug 531: Adds NonUnicastMode attribute to WifiRemoteStationManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3745
diff
changeset
|
119 |
WifiMode GetNonUnicastMode (void) const; |
951aec5a7b9a
bug 531: Adds NonUnicastMode attribute to WifiRemoteStationManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
3745
diff
changeset
|
120 |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
121 |
|
3154 | 122 |
/** |
123 |
* Invoked in an AP upon disassociation of a |
|
124 |
* specific STA. |
|
125 |
*/ |
|
6065 | 126 |
void Reset (Mac48Address address); |
3154 | 127 |
/** |
128 |
* Invoked in a STA or AP to store the set of |
|
129 |
* modes supported by a destination which is |
|
130 |
* also supported locally. |
|
131 |
* The set of supported modes includes |
|
132 |
* the BSSBasicRateSet. |
|
133 |
*/ |
|
6065 | 134 |
void AddSupportedMode (Mac48Address address, WifiMode mode); |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
135 |
|
6065 | 136 |
bool IsBrandNew (Mac48Address address) const; |
137 |
bool IsAssociated (Mac48Address address) const; |
|
138 |
bool IsWaitAssocTxOk (Mac48Address address) const; |
|
139 |
void RecordWaitAssocTxOk (Mac48Address address); |
|
140 |
void RecordGotAssocTxOk (Mac48Address address); |
|
141 |
void RecordGotAssocTxFailed (Mac48Address address); |
|
142 |
void RecordDisassociated (Mac48Address address); |
|
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
143 |
|
3154 | 144 |
/** |
145 |
* \param packet the packet to queue |
|
146 |
* \param fullPacketSize the size of the packet after its 802.11 MAC header has been added. |
|
147 |
* |
|
148 |
* This method is typically invoked just before queuing a packet for transmission. |
|
149 |
* It is a no-op unless the IsLowLatency attribute of the attached ns3::WifiRemoteStationManager |
|
150 |
* is set to false, in which case, the tx parameters of the packet are calculated and stored in |
|
151 |
* the packet as a tag. These tx parameters are later retrieved from GetDadaMode and GetRtsMode. |
|
152 |
*/ |
|
6065 | 153 |
void PrepareForQueue (Mac48Address address, const WifiMacHeader *header, |
154 |
Ptr<const Packet> packet, uint32_t fullPacketSize); |
|
3154 | 155 |
/** |
156 |
* \param packet the packet to send |
|
157 |
* \param fullPacketSize the size of the packet after its 802.11 MAC header has been added. |
|
158 |
* \returns the transmission mode to use to send this packet |
|
159 |
*/ |
|
6065 | 160 |
WifiMode GetDataMode (Mac48Address address, const WifiMacHeader *header, |
161 |
Ptr<const Packet> packet, uint32_t fullPacketSize); |
|
3154 | 162 |
/** |
163 |
* \param packet the packet to send |
|
164 |
* \returns the transmission mode to use to send the RTS prior to the |
|
165 |
* transmission of the data packet itself. |
|
166 |
*/ |
|
6065 | 167 |
WifiMode GetRtsMode (Mac48Address address, const WifiMacHeader *header, |
168 |
Ptr<const Packet> packet); |
|
3154 | 169 |
/** |
170 |
* Should be invoked whenever the RtsTimeout associated to a transmission |
|
171 |
* attempt expires. |
|
172 |
*/ |
|
6065 | 173 |
void ReportRtsFailed (Mac48Address address, const WifiMacHeader *header); |
3154 | 174 |
/** |
175 |
* Should be invoked whenever the AckTimeout associated to a transmission |
|
176 |
* attempt expires. |
|
177 |
*/ |
|
6065 | 178 |
void ReportDataFailed (Mac48Address address, const WifiMacHeader *header); |
3154 | 179 |
/** |
180 |
* Should be invoked whenever we receive the Cts associated to an RTS |
|
181 |
* we just sent. |
|
182 |
*/ |
|
6065 | 183 |
void ReportRtsOk (Mac48Address address, const WifiMacHeader *header, |
184 |
double ctsSnr, WifiMode ctsMode, double rtsSnr); |
|
3154 | 185 |
/** |
186 |
* Should be invoked whenever we receive the Ack associated to a data packet |
|
187 |
* we just sent. |
|
188 |
*/ |
|
6065 | 189 |
void ReportDataOk (Mac48Address address, const WifiMacHeader *header, |
190 |
double ackSnr, WifiMode ackMode, double dataSnr); |
|
3154 | 191 |
/** |
192 |
* Should be invoked after calling ReportRtsFailed if |
|
193 |
* NeedRtsRetransmission returns false |
|
194 |
*/ |
|
6065 | 195 |
void ReportFinalRtsFailed (Mac48Address address, const WifiMacHeader *header); |
3154 | 196 |
/** |
197 |
* Should be invoked after calling ReportDataFailed if |
|
198 |
* NeedDataRetransmission returns false |
|
199 |
*/ |
|
6065 | 200 |
void ReportFinalDataFailed (Mac48Address address, const WifiMacHeader *header); |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2003
diff
changeset
|
201 |
|
3154 | 202 |
/** |
203 |
* \param rxSnr the snr of the packet received |
|
204 |
* \param txMode the transmission mode used for the packet received. |
|
205 |
* |
|
206 |
* Should be invoked whenever a packet is successfully received. |
|
207 |
*/ |
|
6065 | 208 |
void ReportRxOk (Mac48Address address, const WifiMacHeader *header, |
209 |
double rxSnr, WifiMode txMode); |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
210 |
|
3154 | 211 |
/** |
212 |
* \param packet the packet to send |
|
213 |
* \returns true if we want to use an RTS/CTS handshake for this |
|
214 |
* packet before sending it, false otherwise. |
|
215 |
*/ |
|
6065 | 216 |
bool NeedRts (Mac48Address address, const WifiMacHeader *header, |
217 |
Ptr<const Packet> packet); |
|
3154 | 218 |
/** |
219 |
* \param packet the packet to send |
|
220 |
* \returns true if we want to restart a failed RTS/CTS |
|
221 |
* handshake, false otherwise. |
|
222 |
*/ |
|
6065 | 223 |
bool NeedRtsRetransmission (Mac48Address address, const WifiMacHeader *header, |
224 |
Ptr<const Packet> packet); |
|
3154 | 225 |
/** |
226 |
* \param packet the packet to send |
|
227 |
* \returns true if we want to resend a packet |
|
228 |
* after a failed transmission attempt, false otherwise. |
|
229 |
*/ |
|
6065 | 230 |
bool NeedDataRetransmission (Mac48Address address, const WifiMacHeader *header, |
231 |
Ptr<const Packet> packet); |
|
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
232 |
|
3154 | 233 |
/** |
3185
c859e129a934
fix dox warnings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3154
diff
changeset
|
234 |
* \param packet the packet to send |
3154 | 235 |
* \returns true if this packet should be fragmented, false otherwise. |
236 |
*/ |
|
6065 | 237 |
bool NeedFragmentation (Mac48Address address, const WifiMacHeader *header, |
238 |
Ptr<const Packet> packet); |
|
3154 | 239 |
/** |
3185
c859e129a934
fix dox warnings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3154
diff
changeset
|
240 |
* \param packet the packet to send |
3154 | 241 |
* \param fragmentNumber the fragment index of the next fragment to send (starts at zero). |
242 |
* \returns the size of the corresponding fragment. |
|
243 |
*/ |
|
6065 | 244 |
uint32_t GetFragmentSize (Mac48Address address, const WifiMacHeader *header, |
245 |
Ptr<const Packet> packet, uint32_t fragmentNumber); |
|
3154 | 246 |
/** |
3185
c859e129a934
fix dox warnings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3154
diff
changeset
|
247 |
* \param packet the packet to send |
3154 | 248 |
* \param fragmentNumber the fragment index of the next fragment to send (starts at zero). |
3745
73e7bb607014
bug 372: fragmentation is broken
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3185
diff
changeset
|
249 |
* \returns the offset within the original packet where this fragment starts. |
73e7bb607014
bug 372: fragmentation is broken
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3185
diff
changeset
|
250 |
*/ |
6065 | 251 |
uint32_t GetFragmentOffset (Mac48Address address, const WifiMacHeader *header, |
252 |
Ptr<const Packet> packet, uint32_t fragmentNumber); |
|
3745
73e7bb607014
bug 372: fragmentation is broken
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3185
diff
changeset
|
253 |
/** |
73e7bb607014
bug 372: fragmentation is broken
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3185
diff
changeset
|
254 |
* \param packet the packet to send |
73e7bb607014
bug 372: fragmentation is broken
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3185
diff
changeset
|
255 |
* \param fragmentNumber the fragment index of the next fragment to send (starts at zero). |
3154 | 256 |
* \returns true if this is the last fragment, false otherwise. |
257 |
*/ |
|
6065 | 258 |
bool IsLastFragment (Mac48Address address, const WifiMacHeader *header, |
259 |
Ptr<const Packet> packet, uint32_t fragmentNumber); |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
260 |
|
3154 | 261 |
/** |
262 |
* \param rtsMode the transmission mode used to send an RTS we just received |
|
263 |
* \returns the transmission mode to use for the CTS to complete the RTS/CTS |
|
264 |
* handshake. |
|
265 |
*/ |
|
6065 | 266 |
WifiMode GetCtsMode (Mac48Address address, WifiMode rtsMode); |
3154 | 267 |
/** |
3185
c859e129a934
fix dox warnings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3154
diff
changeset
|
268 |
* \param dataMode the transmission mode used to send an ACK we just received |
3154 | 269 |
* \returns the transmission mode to use for the ACK to complete the data/ACK |
270 |
* handshake. |
|
271 |
*/ |
|
6065 | 272 |
WifiMode GetAckMode (Mac48Address address, WifiMode dataMode); |
6071
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
273 |
|
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
274 |
WifiRemoteStationInfo GetInfo (Mac48Address address); |
6065 | 275 |
protected: |
276 |
virtual void DoDispose (void); |
|
277 |
// for convenience |
|
278 |
WifiMode GetSupported (const WifiRemoteStation *station, uint32_t i) const; |
|
279 |
uint32_t GetNSupported (const WifiRemoteStation *station) const; |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
280 |
private: |
6065 | 281 |
/** |
282 |
* \param station the station with which we need to communicate |
|
283 |
* \param packet the packet to send |
|
284 |
* \param normally indicates whether the normal 802.11 rts enable mechanism would |
|
285 |
* request that the rts is sent or not. |
|
286 |
* \returns true if we want to use an RTS/CTS handshake for this |
|
287 |
* packet before sending it, false otherwise. |
|
288 |
* |
|
289 |
* Note: This method is called before a unicast packet is sent on the medium. |
|
290 |
*/ |
|
291 |
virtual bool DoNeedRts (WifiRemoteStation *station, |
|
292 |
Ptr<const Packet> packet, bool normally); |
|
293 |
/** |
|
294 |
* \param station the station with which we need to communicate |
|
295 |
* \param packet the packet to send |
|
296 |
* \param normally indicates whether the normal 802.11 rts enable mechanism would |
|
297 |
* request that the rts is retransmitted or not. |
|
298 |
* \returns true if we want to restart a failed RTS/CTS |
|
299 |
* handshake, false otherwise. |
|
300 |
* |
|
301 |
* Note: This method is called after an rts/cts handshake has been attempted |
|
302 |
* and has failed. |
|
303 |
*/ |
|
304 |
virtual bool DoNeedRtsRetransmission (WifiRemoteStation *station, |
|
305 |
Ptr<const Packet> packet, bool normally); |
|
306 |
/** |
|
307 |
* \param station the station with which we need to communicate |
|
308 |
* \param packet the packet to send |
|
309 |
* \param normally indicates whether the normal 802.11 data retransmission mechanism |
|
310 |
* would request that the data is retransmitted or not. |
|
311 |
* \returns true if we want to resend a packet |
|
312 |
* after a failed transmission attempt, false otherwise. |
|
313 |
* |
|
314 |
* Note: This method is called after a unicast packet transmission has been attempted |
|
315 |
* and has failed. |
|
316 |
*/ |
|
317 |
virtual bool DoNeedDataRetransmission (WifiRemoteStation *station, |
|
318 |
Ptr<const Packet> packet, bool normally); |
|
319 |
||
320 |
/** |
|
321 |
* \param station the station with which we need to communicate |
|
322 |
* \param packet the packet to send |
|
323 |
* \param normally indicates whether the normal 802.11 data fragmentation mechanism |
|
324 |
* would request that the data packet is fragmented or not. |
|
325 |
* \returns true if this packet should be fragmented, false otherwise. |
|
326 |
* |
|
327 |
* Note: This method is called before sending a unicast packet. |
|
328 |
*/ |
|
329 |
virtual bool DoNeedFragmentation (WifiRemoteStation *station, |
|
330 |
Ptr<const Packet> packet, bool normally); |
|
331 |
/** |
|
332 |
* \returns whether this manager is a manager designed to work in low-latency |
|
333 |
* environments. |
|
334 |
* |
|
335 |
* Note: In this context, low vs high latency is defined in <i>IEEE 802.11 Rate Adaptation: |
|
336 |
* A Practical Approach</i>, by M. Lacage, M.H. Manshaei, and T. Turletti. |
|
337 |
*/ |
|
338 |
virtual bool IsLowLatency (void) const = 0; |
|
339 |
/** |
|
340 |
* \return a new station data structure |
|
341 |
*/ |
|
342 |
virtual class WifiRemoteStation *DoCreateStation (void) const = 0; |
|
343 |
/** |
|
344 |
* \param station the station with which we need to communicate |
|
345 |
* \param size size of the packet or fragment we want to send |
|
346 |
* \returns the transmission mode to use to send a packet to the station |
|
347 |
* |
|
348 |
* Note: This method is called before sending a unicast packet or a fragment |
|
349 |
* of a unicast packet to decide which transmission mode to use. |
|
350 |
*/ |
|
351 |
virtual WifiMode DoGetDataMode (WifiRemoteStation *station, |
|
352 |
uint32_t size) = 0; |
|
353 |
/** |
|
354 |
* \param station the station with which we need to communicate |
|
355 |
* \returns the transmission mode to use to send an rts to the station |
|
356 |
* |
|
357 |
* Note: This method is called before sending an rts to a station |
|
358 |
* to decide which transmission mode to use for the rts. |
|
359 |
*/ |
|
360 |
virtual WifiMode DoGetRtsMode (WifiRemoteStation *station) = 0; |
|
361 |
virtual void DoReportRtsFailed (WifiRemoteStation *station) = 0; |
|
362 |
virtual void DoReportDataFailed (WifiRemoteStation *station) = 0; |
|
363 |
virtual void DoReportRtsOk (WifiRemoteStation *station, |
|
364 |
double ctsSnr, WifiMode ctsMode, double rtsSnr) = 0; |
|
365 |
virtual void DoReportDataOk (WifiRemoteStation *station, |
|
366 |
double ackSnr, WifiMode ackMode, double dataSnr) = 0; |
|
367 |
virtual void DoReportFinalRtsFailed (WifiRemoteStation *station) = 0; |
|
368 |
virtual void DoReportFinalDataFailed (WifiRemoteStation *station) = 0; |
|
369 |
virtual void DoReportRxOk (WifiRemoteStation *station, |
|
370 |
double rxSnr, WifiMode txMode) = 0; |
|
371 |
||
372 |
WifiRemoteStationState *LookupState (Mac48Address address) const; |
|
373 |
WifiRemoteStation *Lookup (Mac48Address address, uint8_t tid) const; |
|
6071
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
374 |
/// Find a remote station by its remote address and TID taken from MAC header |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
375 |
WifiRemoteStation *Lookup (Mac48Address address, const WifiMacHeader *header) const; |
6065 | 376 |
WifiMode GetControlAnswerMode (Mac48Address address, WifiMode reqMode); |
377 |
uint32_t GetNFragments (Ptr<const Packet> packet); |
|
378 |
||
379 |
typedef std::vector <WifiRemoteStation *> Stations; |
|
380 |
typedef std::vector <WifiRemoteStationState *> StationStates; |
|
381 |
||
382 |
StationStates m_states; |
|
383 |
Stations m_stations; |
|
384 |
WifiMode m_defaultTxMode; |
|
385 |
BasicModes m_basicModes; |
|
386 |
bool m_isLowLatency; |
|
387 |
uint32_t m_maxSsrc; |
|
388 |
uint32_t m_maxSlrc; |
|
389 |
uint32_t m_rtsCtsThreshold; |
|
390 |
uint32_t m_fragmentationThreshold; |
|
391 |
WifiMode m_nonUnicastMode; |
|
392 |
double m_avgSlrcCoefficient; |
|
393 |
/** |
|
394 |
* The trace source fired when the transmission of a single RTS has failed |
|
395 |
*/ |
|
396 |
TracedCallback<Mac48Address> m_macTxRtsFailed; |
|
397 |
/** |
|
398 |
* The trace source fired when the transmission of a single data packet has failed |
|
399 |
*/ |
|
400 |
TracedCallback<Mac48Address> m_macTxDataFailed; |
|
401 |
/** |
|
402 |
* The trace source fired when the transmission of a RTS has |
|
403 |
* exceeded the maximum number of attempts |
|
404 |
*/ |
|
405 |
TracedCallback<Mac48Address> m_macTxFinalRtsFailed; |
|
406 |
/** |
|
407 |
* The trace source fired when the transmission of a data packet has |
|
408 |
* exceeded the maximum number of attempts |
|
409 |
*/ |
|
410 |
TracedCallback<Mac48Address> m_macTxFinalDataFailed; |
|
411 |
||
412 |
}; |
|
413 |
||
414 |
struct WifiRemoteStationState |
|
415 |
{ |
|
4343 | 416 |
typedef std::vector<WifiMode> SupportedModes; |
6065 | 417 |
enum |
418 |
{ |
|
419 |
BRAND_NEW, |
|
420 |
DISASSOC, |
|
421 |
WAIT_ASSOC_TX_OK, |
|
422 |
GOT_ASSOC_TX_OK |
|
423 |
} m_state; |
|
1930
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1913
diff
changeset
|
424 |
SupportedModes m_modes; |
4733
96a3881940c4
new trace sources for WifiRemoteStationManager
Nicola Baldo <nbaldo@cttc.es>
parents:
4692
diff
changeset
|
425 |
Mac48Address m_address; |
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6065
diff
changeset
|
426 |
WifiRemoteStationInfo m_info; |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
427 |
}; |
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
428 |
|
6065 | 429 |
/** |
430 |
* \brief hold per-remote-station state. |
|
431 |
* |
|
432 |
* The state in this class is used to keep track |
|
433 |
* of association status if we are in an infrastructure |
|
434 |
* network and to perform the selection of tx parameters |
|
435 |
* on a per-packet basis. |
|
436 |
*/ |
|
437 |
struct WifiRemoteStation |
|
438 |
{ |
|
439 |
struct WifiRemoteStationState *m_state; |
|
440 |
uint32_t m_ssrc; |
|
441 |
uint32_t m_slrc; |
|
442 |
uint8_t m_tid; |
|
443 |
}; |
|
444 |
||
445 |
||
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
446 |
} // namespace ns3 |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
447 |
|
6065 | 448 |
#endif /* WIFI_REMOTE_STATION_MANAGER_H */ |