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