author | Vedran Miletić <rivanvx@gmail.com> |
Tue, 02 Aug 2011 17:42:33 -0400 | |
changeset 7385 | 10beb0e53130 |
parent 7227 | 9f045cf89be4 |
child 7704 | aef733235832 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7227
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
1893
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 |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
1893
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 |
*/ |
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
21 |
#include "wifi-remote-station-manager.h" |
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
22 |
#include "ns3/simulator.h" |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
23 |
#include "ns3/assert.h" |
1980
3fa3bac40b5b
add asserts and some debug log
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1975
diff
changeset
|
24 |
#include "ns3/log.h" |
3041
a624276a897b
mtag -> tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3040
diff
changeset
|
25 |
#include "ns3/tag.h" |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
26 |
#include "ns3/boolean.h" |
6065 | 27 |
#include "ns3/double.h" |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
28 |
#include "ns3/uinteger.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
29 |
#include "ns3/wifi-phy.h" |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
30 |
#include "ns3/trace-source-accessor.h" |
6065 | 31 |
#include "wifi-mac-header.h" |
6473 | 32 |
#include "wifi-mac-trailer.h" |
1980
3fa3bac40b5b
add asserts and some debug log
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1975
diff
changeset
|
33 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2508
diff
changeset
|
34 |
NS_LOG_COMPONENT_DEFINE ("WifiRemoteStationManager"); |
1893
d72388b06b22
add MacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
35 |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
36 |
|
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
37 |
/*************************************************************** |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
38 |
* Packet Mode Tagger |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
39 |
***************************************************************/ |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
40 |
|
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
41 |
namespace ns3 { |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
42 |
|
3040
e11e106c7c19
Mtag -> Tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3038
diff
changeset
|
43 |
class TxModeTag : public Tag |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
44 |
{ |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
45 |
public: |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
46 |
TxModeTag (); |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
47 |
TxModeTag (WifiMode rtsMode, WifiMode dataMode); |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
48 |
WifiMode GetRtsMode (void) const; |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
49 |
WifiMode GetDataMode (void) const; |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
50 |
|
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
51 |
static TypeId GetTypeId (void); |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
52 |
virtual TypeId GetInstanceTypeId (void) const; |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
53 |
virtual uint32_t GetSerializedSize (void) const; |
3040
e11e106c7c19
Mtag -> Tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3038
diff
changeset
|
54 |
virtual void Serialize (TagBuffer i) const; |
e11e106c7c19
Mtag -> Tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3038
diff
changeset
|
55 |
virtual void Deserialize (TagBuffer i); |
3208
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3041
diff
changeset
|
56 |
virtual void Print (std::ostream &os) const; |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
57 |
private: |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
58 |
WifiMode m_rtsMode; |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
59 |
WifiMode m_dataMode; |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
60 |
}; |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
61 |
|
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
62 |
TxModeTag::TxModeTag () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
63 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
64 |
} |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
65 |
TxModeTag::TxModeTag (WifiMode rtsMode, WifiMode dataMode) |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
66 |
: m_rtsMode (rtsMode), |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
67 |
m_dataMode (dataMode) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
68 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
69 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
70 |
WifiMode |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
71 |
TxModeTag::GetRtsMode (void) const |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
72 |
{ |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
73 |
return m_rtsMode; |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
74 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
75 |
WifiMode |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
76 |
TxModeTag::GetDataMode (void) const |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
77 |
{ |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
78 |
return m_dataMode; |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
79 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
80 |
TypeId |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
81 |
TxModeTag::GetTypeId (void) |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
82 |
{ |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
83 |
static TypeId tid = TypeId ("ns3::TxModeTag") |
3040
e11e106c7c19
Mtag -> Tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3038
diff
changeset
|
84 |
.SetParent<Tag> () |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
85 |
.AddConstructor<TxModeTag> () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
86 |
.AddAttribute ("RtsTxMode", |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
87 |
"Tx mode of rts to use later", |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
88 |
EmptyAttributeValue (), |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
89 |
MakeWifiModeAccessor (&TxModeTag::GetRtsMode), |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
90 |
MakeWifiModeChecker ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
91 |
.AddAttribute ("DataTxMode", |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
92 |
"Tx mode of data to use later", |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
93 |
EmptyAttributeValue (), |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
94 |
MakeWifiModeAccessor (&TxModeTag::GetDataMode), |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
95 |
MakeWifiModeChecker ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
96 |
; |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
97 |
return tid; |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
98 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
99 |
TypeId |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
100 |
TxModeTag::GetInstanceTypeId (void) const |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
101 |
{ |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
102 |
return GetTypeId (); |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
103 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
104 |
uint32_t |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
105 |
TxModeTag::GetSerializedSize (void) const |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
106 |
{ |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
107 |
return sizeof (WifiMode) * 2; |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
108 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
109 |
void |
3040
e11e106c7c19
Mtag -> Tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3038
diff
changeset
|
110 |
TxModeTag::Serialize (TagBuffer i) const |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
111 |
{ |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
112 |
i.Write ((uint8_t *)&m_rtsMode, sizeof (WifiMode)); |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
113 |
i.Write ((uint8_t *)&m_dataMode, sizeof (WifiMode)); |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
114 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
115 |
void |
3040
e11e106c7c19
Mtag -> Tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3038
diff
changeset
|
116 |
TxModeTag::Deserialize (TagBuffer i) |
3038
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
117 |
{ |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
118 |
i.Read ((uint8_t *)&m_rtsMode, sizeof (WifiMode)); |
5962e2962fa9
convert to new tag API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2965
diff
changeset
|
119 |
i.Read ((uint8_t *)&m_dataMode, sizeof (WifiMode)); |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
120 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
121 |
void |
3208
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3041
diff
changeset
|
122 |
TxModeTag::Print (std::ostream &os) const |
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3041
diff
changeset
|
123 |
{ |
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3041
diff
changeset
|
124 |
os << "Rts=" << m_rtsMode << ", Data=" << m_dataMode; |
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3041
diff
changeset
|
125 |
} |
2268
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
126 |
|
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
127 |
} // namespace ns3 |
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
128 |
|
0e57ac711220
introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2027
diff
changeset
|
129 |
|
6065 | 130 |
namespace ns3 { |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
131 |
|
6065 | 132 |
NS_OBJECT_ENSURE_REGISTERED (WifiRemoteStationManager); |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
133 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
134 |
TypeId |
6065 | 135 |
WifiRemoteStationManager::GetTypeId (void) |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
136 |
{ |
6065 | 137 |
static TypeId tid = TypeId ("ns3::WifiRemoteStationManager") |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
138 |
.SetParent<Object> () |
6065 | 139 |
.AddAttribute ("IsLowLatency", "If true, we attempt to modelize a so-called low-latency device: a device" |
140 |
" where decisions about tx parameters can be made on a per-packet basis and feedback about the" |
|
141 |
" transmission of each packet is obtained before sending the next. Otherwise, we modelize a " |
|
142 |
" high-latency device, that is a device where we cannot update our decision about tx parameters" |
|
143 |
" after every packet transmission.", |
|
6241
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
144 |
BooleanValue (true), // this value is ignored because there is no setter |
6065 | 145 |
MakeBooleanAccessor (&WifiRemoteStationManager::IsLowLatency), |
146 |
MakeBooleanChecker ()) |
|
147 |
.AddAttribute ("MaxSsrc", "The maximum number of retransmission attempts for an RTS. This value" |
|
148 |
" will not have any effect on some rate control algorithms.", |
|
149 |
UintegerValue (7), |
|
150 |
MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSsrc), |
|
151 |
MakeUintegerChecker<uint32_t> ()) |
|
152 |
.AddAttribute ("MaxSlrc", "The maximum number of retransmission attempts for a DATA packet. This value" |
|
153 |
" will not have any effect on some rate control algorithms.", |
|
154 |
UintegerValue (7), |
|
155 |
MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSlrc), |
|
156 |
MakeUintegerChecker<uint32_t> ()) |
|
6473 | 157 |
.AddAttribute ("RtsCtsThreshold", "If the size of the data packet + LLC header + MAC header + FCS trailer is bigger than " |
158 |
"this value, we use an RTS/CTS handshake before sending the data, as per IEEE Std. 802.11-2007, Section 9.2.6. " |
|
159 |
"This value will not have any effect on some rate control algorithms.", |
|
160 |
UintegerValue (2346), |
|
6065 | 161 |
MakeUintegerAccessor (&WifiRemoteStationManager::m_rtsCtsThreshold), |
162 |
MakeUintegerChecker<uint32_t> ()) |
|
6473 | 163 |
.AddAttribute ("FragmentationThreshold", "If the size of the data packet + LLC header + MAC header + FCS trailer is bigger" |
164 |
"than this value, we fragment it such that the size of the fragments are equal or smaller " |
|
165 |
"than this value, as per IEEE Std. 802.11-2007, Section 9.4. " |
|
166 |
"This value will not have any effect on some rate control algorithms.", |
|
167 |
UintegerValue (2346), |
|
6065 | 168 |
MakeUintegerAccessor (&WifiRemoteStationManager::m_fragmentationThreshold), |
169 |
MakeUintegerChecker<uint32_t> ()) |
|
170 |
.AddAttribute ("NonUnicastMode", "Wifi mode used for non-unicast transmissions.", |
|
171 |
WifiModeValue (), |
|
172 |
MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicastMode), |
|
173 |
MakeWifiModeChecker ()) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
174 |
.AddTraceSource ("MacTxRtsFailed", |
6065 | 175 |
"The transmission of a RTS by the MAC layer has failed", |
176 |
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxRtsFailed)) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
177 |
.AddTraceSource ("MacTxDataFailed", |
6065 | 178 |
"The transmission of a data packet by the MAC layer has failed", |
179 |
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxDataFailed)) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
180 |
.AddTraceSource ("MacTxFinalRtsFailed", |
6065 | 181 |
"The transmission of a RTS has exceeded the maximum number of attempts", |
182 |
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxFinalRtsFailed)) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
183 |
.AddTraceSource ("MacTxFinalDataFailed", |
6065 | 184 |
"The transmission of a data packet has exceeded the maximum number of attempts", |
185 |
MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxFinalDataFailed)) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
186 |
; |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
187 |
return tid; |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
188 |
} |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
189 |
|
6065 | 190 |
WifiRemoteStationManager::WifiRemoteStationManager () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
191 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
192 |
} |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
193 |
|
6065 | 194 |
WifiRemoteStationManager::~WifiRemoteStationManager () |
195 |
{ |
|
196 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
197 |
void |
6065 | 198 |
WifiRemoteStationManager::DoDispose (void) |
2003
335dc094e52a
support BRAND_NEW station in adhoc code. initialize the supported rates.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1989
diff
changeset
|
199 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
200 |
for (StationStates::const_iterator i = m_states.begin (); i != m_states.end (); i++) |
6065 | 201 |
{ |
202 |
delete (*i); |
|
203 |
} |
|
204 |
m_states.clear (); |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
205 |
for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++) |
6065 | 206 |
{ |
207 |
delete (*i); |
|
208 |
} |
|
209 |
m_stations.clear (); |
|
210 |
} |
|
211 |
void |
|
212 |
WifiRemoteStationManager::SetupPhy (Ptr<WifiPhy> phy) |
|
213 |
{ |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
214 |
// We need to track our PHY because it is the object that knows the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
215 |
// full set of transmit rates that are supported. We need to know |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
216 |
// this in order to find the relevant mandatory rates when chosing a |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
217 |
// transmit rate for automatic control responses like |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
218 |
// acknowledgements. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
219 |
m_wifiPhy = phy; |
6065 | 220 |
m_defaultTxMode = phy->GetMode (0); |
221 |
Reset (); |
|
2003
335dc094e52a
support BRAND_NEW station in adhoc code. initialize the supported rates.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1989
diff
changeset
|
222 |
} |
335dc094e52a
support BRAND_NEW station in adhoc code. initialize the supported rates.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1989
diff
changeset
|
223 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
224 |
uint32_t |
6065 | 225 |
WifiRemoteStationManager::GetMaxSsrc (void) const |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
226 |
{ |
6065 | 227 |
return m_maxSsrc; |
228 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
229 |
uint32_t |
6065 | 230 |
WifiRemoteStationManager::GetMaxSlrc (void) const |
231 |
{ |
|
232 |
return m_maxSlrc; |
|
233 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
234 |
uint32_t |
6065 | 235 |
WifiRemoteStationManager::GetRtsCtsThreshold (void) const |
236 |
{ |
|
237 |
return m_rtsCtsThreshold; |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
238 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
239 |
uint32_t |
6065 | 240 |
WifiRemoteStationManager::GetFragmentationThreshold (void) const |
241 |
{ |
|
242 |
return m_fragmentationThreshold; |
|
243 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
244 |
void |
6065 | 245 |
WifiRemoteStationManager::SetMaxSsrc (uint32_t maxSsrc) |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
246 |
{ |
6065 | 247 |
m_maxSsrc = maxSsrc; |
248 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
249 |
void |
6065 | 250 |
WifiRemoteStationManager::SetMaxSlrc (uint32_t maxSlrc) |
251 |
{ |
|
252 |
m_maxSlrc = maxSlrc; |
|
253 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
254 |
void |
6065 | 255 |
WifiRemoteStationManager::SetRtsCtsThreshold (uint32_t threshold) |
256 |
{ |
|
257 |
m_rtsCtsThreshold = threshold; |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
258 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
259 |
void |
6065 | 260 |
WifiRemoteStationManager::SetFragmentationThreshold (uint32_t threshold) |
261 |
{ |
|
262 |
m_fragmentationThreshold = threshold; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
263 |
} |
6065 | 264 |
|
265 |
void |
|
266 |
WifiRemoteStationManager::Reset (Mac48Address address) |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
267 |
{ |
6065 | 268 |
NS_ASSERT (!address.IsGroup ()); |
269 |
WifiRemoteStationState *state = LookupState (address); |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
270 |
state->m_operationalRateSet.clear (); |
6065 | 271 |
AddSupportedMode (address, GetDefaultMode ()); |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
272 |
} |
6065 | 273 |
void |
274 |
WifiRemoteStationManager::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
|
275 |
{ |
6065 | 276 |
NS_ASSERT (!address.IsGroup ()); |
277 |
WifiRemoteStationState *state = LookupState (address); |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
278 |
for (WifiModeListIterator i = state->m_operationalRateSet.begin (); i != state->m_operationalRateSet.end (); i++) |
6065 | 279 |
{ |
280 |
if ((*i) == mode) |
|
281 |
{ |
|
282 |
// already in. |
|
283 |
return; |
|
284 |
} |
|
285 |
} |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
286 |
state->m_operationalRateSet.push_back (mode); |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
287 |
} |
6065 | 288 |
bool |
289 |
WifiRemoteStationManager::IsBrandNew (Mac48Address address) const |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
290 |
{ |
6065 | 291 |
if (address.IsGroup ()) |
292 |
{ |
|
293 |
return false; |
|
294 |
} |
|
295 |
return LookupState (address)->m_state == WifiRemoteStationState::BRAND_NEW; |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
296 |
} |
6065 | 297 |
bool |
298 |
WifiRemoteStationManager::IsAssociated (Mac48Address address) const |
|
299 |
{ |
|
300 |
if (address.IsGroup ()) |
|
301 |
{ |
|
302 |
return true; |
|
303 |
} |
|
304 |
return LookupState (address)->m_state == WifiRemoteStationState::GOT_ASSOC_TX_OK; |
|
305 |
} |
|
306 |
bool |
|
307 |
WifiRemoteStationManager::IsWaitAssocTxOk (Mac48Address address) const |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
308 |
{ |
6065 | 309 |
if (address.IsGroup ()) |
310 |
{ |
|
311 |
return false; |
|
312 |
} |
|
313 |
return LookupState (address)->m_state == WifiRemoteStationState::WAIT_ASSOC_TX_OK; |
|
314 |
} |
|
315 |
void |
|
316 |
WifiRemoteStationManager::RecordWaitAssocTxOk (Mac48Address address) |
|
317 |
{ |
|
318 |
NS_ASSERT (!address.IsGroup ()); |
|
319 |
LookupState (address)->m_state = WifiRemoteStationState::WAIT_ASSOC_TX_OK; |
|
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
320 |
} |
6065 | 321 |
void |
322 |
WifiRemoteStationManager::RecordGotAssocTxOk (Mac48Address address) |
|
323 |
{ |
|
324 |
NS_ASSERT (!address.IsGroup ()); |
|
325 |
LookupState (address)->m_state = WifiRemoteStationState::GOT_ASSOC_TX_OK; |
|
326 |
} |
|
327 |
void |
|
328 |
WifiRemoteStationManager::RecordGotAssocTxFailed (Mac48Address address) |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
329 |
{ |
6065 | 330 |
NS_ASSERT (!address.IsGroup ()); |
331 |
LookupState (address)->m_state = WifiRemoteStationState::DISASSOC; |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
332 |
} |
6065 | 333 |
void |
334 |
WifiRemoteStationManager::RecordDisassociated (Mac48Address address) |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
335 |
{ |
6065 | 336 |
NS_ASSERT (!address.IsGroup ()); |
337 |
LookupState (address)->m_state = WifiRemoteStationState::DISASSOC; |
|
338 |
} |
|
339 |
void |
|
340 |
WifiRemoteStationManager::PrepareForQueue (Mac48Address address, const WifiMacHeader *header, |
|
341 |
Ptr<const Packet> packet, uint32_t fullPacketSize) |
|
342 |
{ |
|
343 |
if (IsLowLatency () || address.IsGroup ()) |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
344 |
{ |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
345 |
return; |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
346 |
} |
6241
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
347 |
WifiRemoteStation *station = Lookup (address, header); |
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
348 |
WifiMode rts = DoGetRtsMode (station); |
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
349 |
WifiMode data = DoGetDataMode (station, fullPacketSize); |
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
350 |
TxModeTag tag; |
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
351 |
// first, make sure that the tag is not here anymore. |
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
352 |
ConstCast<Packet> (packet)->RemovePacketTag (tag); |
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
353 |
tag = TxModeTag (rts, data); |
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
354 |
// and then, add it back |
6065 | 355 |
packet->AddPacketTag (tag); |
356 |
} |
|
357 |
WifiMode |
|
358 |
WifiRemoteStationManager::GetDataMode (Mac48Address address, const WifiMacHeader *header, |
|
359 |
Ptr<const Packet> packet, uint32_t fullPacketSize) |
|
360 |
{ |
|
361 |
if (address.IsGroup ()) |
|
362 |
{ |
|
363 |
return GetNonUnicastMode (); |
|
364 |
} |
|
365 |
if (!IsLowLatency ()) |
|
366 |
{ |
|
367 |
TxModeTag tag; |
|
368 |
bool found; |
|
6241
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
369 |
found = ConstCast<Packet> (packet)->PeekPacketTag (tag); |
6065 | 370 |
NS_ASSERT (found); |
7227
9f045cf89be4
Bug 1159 - opt build wifi module unused variables
John Abraham<john.abraham@gatech.edu>
parents:
7141
diff
changeset
|
371 |
// cast found to void, to suppress 'found' set but not used |
9f045cf89be4
Bug 1159 - opt build wifi module unused variables
John Abraham<john.abraham@gatech.edu>
parents:
7141
diff
changeset
|
372 |
// compiler warning |
9f045cf89be4
Bug 1159 - opt build wifi module unused variables
John Abraham<john.abraham@gatech.edu>
parents:
7141
diff
changeset
|
373 |
(void) found; |
6065 | 374 |
return tag.GetDataMode (); |
375 |
} |
|
376 |
return DoGetDataMode (Lookup (address, header), fullPacketSize); |
|
377 |
} |
|
378 |
WifiMode |
|
379 |
WifiRemoteStationManager::GetRtsMode (Mac48Address address, const WifiMacHeader *header, |
|
380 |
Ptr<const Packet> packet) |
|
381 |
{ |
|
382 |
NS_ASSERT (!address.IsGroup ()); |
|
383 |
if (!IsLowLatency ()) |
|
384 |
{ |
|
385 |
TxModeTag tag; |
|
386 |
bool found; |
|
6241
d9a65be745f0
Bug 802 - Minstrel, Onoe and Amrr not working
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6087
diff
changeset
|
387 |
found = ConstCast<Packet> (packet)->PeekPacketTag (tag); |
6065 | 388 |
NS_ASSERT (found); |
7227
9f045cf89be4
Bug 1159 - opt build wifi module unused variables
John Abraham<john.abraham@gatech.edu>
parents:
7141
diff
changeset
|
389 |
// cast found to void, to suppress 'found' set but not used |
9f045cf89be4
Bug 1159 - opt build wifi module unused variables
John Abraham<john.abraham@gatech.edu>
parents:
7141
diff
changeset
|
390 |
// compiler warning |
9f045cf89be4
Bug 1159 - opt build wifi module unused variables
John Abraham<john.abraham@gatech.edu>
parents:
7141
diff
changeset
|
391 |
(void) found; |
6065 | 392 |
return tag.GetRtsMode (); |
393 |
} |
|
394 |
return DoGetRtsMode (Lookup (address, header)); |
|
395 |
} |
|
396 |
void |
|
397 |
WifiRemoteStationManager::ReportRtsFailed (Mac48Address address, const WifiMacHeader *header) |
|
398 |
{ |
|
399 |
NS_ASSERT (!address.IsGroup ()); |
|
400 |
WifiRemoteStation *station = Lookup (address, header); |
|
401 |
station->m_ssrc++; |
|
402 |
m_macTxRtsFailed (address); |
|
403 |
DoReportRtsFailed (station); |
|
404 |
} |
|
405 |
void |
|
406 |
WifiRemoteStationManager::ReportDataFailed (Mac48Address address, const WifiMacHeader *header) |
|
407 |
{ |
|
408 |
NS_ASSERT (!address.IsGroup ()); |
|
409 |
WifiRemoteStation *station = Lookup (address, header); |
|
410 |
station->m_slrc++; |
|
411 |
m_macTxDataFailed (address); |
|
412 |
DoReportDataFailed (station); |
|
413 |
} |
|
414 |
void |
|
415 |
WifiRemoteStationManager::ReportRtsOk (Mac48Address address, const WifiMacHeader *header, |
|
416 |
double ctsSnr, WifiMode ctsMode, double rtsSnr) |
|
417 |
{ |
|
418 |
NS_ASSERT (!address.IsGroup ()); |
|
419 |
WifiRemoteStation *station = Lookup (address, header); |
|
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
420 |
station->m_state->m_info.NotifyTxSuccess (station->m_ssrc); |
6065 | 421 |
station->m_ssrc = 0; |
422 |
DoReportRtsOk (station, ctsSnr, ctsMode, rtsSnr); |
|
423 |
} |
|
424 |
void |
|
425 |
WifiRemoteStationManager::ReportDataOk (Mac48Address address, const WifiMacHeader *header, |
|
426 |
double ackSnr, WifiMode ackMode, double dataSnr) |
|
427 |
{ |
|
428 |
NS_ASSERT (!address.IsGroup ()); |
|
429 |
WifiRemoteStation *station = Lookup (address, header); |
|
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
430 |
station->m_state->m_info.NotifyTxSuccess (station->m_slrc); |
6065 | 431 |
station->m_slrc = 0; |
432 |
DoReportDataOk (station, ackSnr, ackMode, dataSnr); |
|
433 |
} |
|
434 |
void |
|
435 |
WifiRemoteStationManager::ReportFinalRtsFailed (Mac48Address address, const WifiMacHeader *header) |
|
436 |
{ |
|
437 |
NS_ASSERT (!address.IsGroup ()); |
|
438 |
WifiRemoteStation *station = Lookup (address, header); |
|
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
439 |
station->m_state->m_info.NotifyTxFailed (); |
6065 | 440 |
station->m_ssrc = 0; |
441 |
m_macTxFinalRtsFailed (address); |
|
442 |
DoReportFinalRtsFailed (station); |
|
443 |
} |
|
444 |
void |
|
445 |
WifiRemoteStationManager::ReportFinalDataFailed (Mac48Address address, const WifiMacHeader *header) |
|
446 |
{ |
|
447 |
NS_ASSERT (!address.IsGroup ()); |
|
448 |
WifiRemoteStation *station = Lookup (address, header); |
|
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
449 |
station->m_state->m_info.NotifyTxFailed (); |
6065 | 450 |
station->m_slrc = 0; |
451 |
m_macTxFinalDataFailed (address); |
|
452 |
DoReportFinalDataFailed (station); |
|
453 |
} |
|
454 |
void |
|
455 |
WifiRemoteStationManager::ReportRxOk (Mac48Address address, const WifiMacHeader *header, |
|
456 |
double rxSnr, WifiMode txMode) |
|
457 |
{ |
|
458 |
if (address.IsGroup ()) |
|
459 |
{ |
|
460 |
return; |
|
461 |
} |
|
462 |
WifiRemoteStation *station = Lookup (address, header); |
|
463 |
DoReportRxOk (station, rxSnr, txMode); |
|
464 |
} |
|
465 |
bool |
|
466 |
WifiRemoteStationManager::NeedRts (Mac48Address address, const WifiMacHeader *header, |
|
467 |
Ptr<const Packet> packet) |
|
468 |
{ |
|
469 |
if (address.IsGroup ()) |
|
470 |
{ |
|
471 |
return false; |
|
472 |
} |
|
6473 | 473 |
bool normally = (packet->GetSize () + header->GetSize () + WIFI_MAC_FCS_LENGTH) > GetRtsCtsThreshold (); |
6065 | 474 |
return DoNeedRts (Lookup (address, header), packet, normally); |
475 |
} |
|
476 |
bool |
|
477 |
WifiRemoteStationManager::NeedRtsRetransmission (Mac48Address address, const WifiMacHeader *header, |
|
478 |
Ptr<const Packet> packet) |
|
479 |
{ |
|
480 |
NS_ASSERT (!address.IsGroup ()); |
|
481 |
WifiRemoteStation *station = Lookup (address, header); |
|
482 |
bool normally = station->m_ssrc < GetMaxSsrc (); |
|
483 |
return DoNeedRtsRetransmission (station, packet, normally); |
|
484 |
} |
|
485 |
bool |
|
486 |
WifiRemoteStationManager::NeedDataRetransmission (Mac48Address address, const WifiMacHeader *header, |
|
487 |
Ptr<const Packet> packet) |
|
488 |
{ |
|
489 |
NS_ASSERT (!address.IsGroup ()); |
|
490 |
WifiRemoteStation *station = Lookup (address, header); |
|
491 |
bool normally = station->m_slrc < GetMaxSlrc (); |
|
492 |
return DoNeedDataRetransmission (station, packet, normally); |
|
493 |
} |
|
494 |
bool |
|
495 |
WifiRemoteStationManager::NeedFragmentation (Mac48Address address, const WifiMacHeader *header, |
|
496 |
Ptr<const Packet> packet) |
|
497 |
{ |
|
498 |
if (address.IsGroup ()) |
|
499 |
{ |
|
500 |
return false; |
|
501 |
} |
|
502 |
WifiRemoteStation *station = Lookup (address, header); |
|
6473 | 503 |
bool normally = (packet->GetSize () + header->GetSize () + WIFI_MAC_FCS_LENGTH) > GetFragmentationThreshold (); |
6065 | 504 |
return DoNeedFragmentation (station, packet, normally); |
505 |
} |
|
506 |
uint32_t |
|
507 |
WifiRemoteStationManager::GetNFragments (Ptr<const Packet> packet) |
|
508 |
{ |
|
509 |
uint32_t nFragments = packet->GetSize () / GetFragmentationThreshold () + 1; |
|
510 |
return nFragments; |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
511 |
} |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
512 |
|
6065 | 513 |
uint32_t |
514 |
WifiRemoteStationManager::GetFragmentSize (Mac48Address address, const WifiMacHeader *header, |
|
515 |
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
|
516 |
{ |
6065 | 517 |
NS_ASSERT (!address.IsGroup ()); |
518 |
uint32_t nFragment = GetNFragments (packet); |
|
519 |
if (fragmentNumber >= nFragment) |
|
520 |
{ |
|
521 |
return 0; |
|
522 |
} |
|
523 |
if (fragmentNumber == nFragment - 1) |
|
524 |
{ |
|
525 |
uint32_t lastFragmentSize = packet->GetSize () % GetFragmentationThreshold (); |
|
526 |
return lastFragmentSize; |
|
527 |
} |
|
528 |
else |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
529 |
{ |
6065 | 530 |
return GetFragmentationThreshold (); |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
531 |
} |
6065 | 532 |
} |
533 |
uint32_t |
|
534 |
WifiRemoteStationManager::GetFragmentOffset (Mac48Address address, const WifiMacHeader *header, |
|
535 |
Ptr<const Packet> packet, uint32_t fragmentNumber) |
|
536 |
{ |
|
537 |
NS_ASSERT (!address.IsGroup ()); |
|
538 |
NS_ASSERT (fragmentNumber < GetNFragments (packet)); |
|
539 |
uint32_t fragmentOffset = fragmentNumber * GetFragmentationThreshold (); |
|
540 |
return fragmentOffset; |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
541 |
} |
6065 | 542 |
bool |
543 |
WifiRemoteStationManager::IsLastFragment (Mac48Address address, const WifiMacHeader *header, |
|
544 |
Ptr<const Packet> packet, uint32_t fragmentNumber) |
|
545 |
{ |
|
546 |
NS_ASSERT (!address.IsGroup ()); |
|
547 |
bool isLast = fragmentNumber == (GetNFragments (packet) - 1); |
|
548 |
return isLast; |
|
549 |
} |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
550 |
WifiMode |
6065 | 551 |
WifiRemoteStationManager::GetControlAnswerMode (Mac48Address address, WifiMode reqMode) |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
552 |
{ |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
553 |
/** |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
554 |
* The standard has relatively unambiguous rules for selecting a |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
555 |
* control response rate (the below is quoted from IEEE 802.11-2007, |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
556 |
* Section 9.6): |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
557 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
558 |
* To allow the transmitting STA to calculate the contents of the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
559 |
* Duration/ID field, a STA responding to a received frame shall |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
560 |
* transmit its Control Response frame (either CTS or ACK), other |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
561 |
* than the BlockAck control frame, at the highest rate in the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
562 |
* BSSBasicRateSet parameter that is less than or equal to the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
563 |
* rate of the immediately previous frame in the frame exchange |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
564 |
* sequence (as defined in 9.12) and that is of the same |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
565 |
* modulation class (see 9.6.1) as the received frame... |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
566 |
*/ |
6065 | 567 |
WifiMode mode = GetDefaultMode (); |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
568 |
bool found = false; |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
569 |
|
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
570 |
// First, search the BSS Basic Rate set |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
571 |
for (WifiModeListIterator i = m_bssBasicRateSet.begin (); |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
572 |
i != m_bssBasicRateSet.end (); i++) |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
573 |
{ |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
574 |
if ((!found || i->GetPhyRate () > mode.GetPhyRate ()) |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
575 |
&& i->GetPhyRate () <= reqMode.GetPhyRate () |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
576 |
&& i->GetModulationClass () == reqMode.GetModulationClass ()) |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
577 |
{ |
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
|
578 |
mode = *i; |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
579 |
// We've found a potentially-suitable transmit rate, but we |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
580 |
// need to continue and consider all the basic rates before |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
581 |
// we can be sure we've got the right one. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
582 |
found = true; |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
583 |
} |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
584 |
} |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
585 |
|
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
586 |
// If we found a suitable rate in the BSSBasicRateSet, then we are |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
587 |
// done and can return that mode. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
588 |
if (found) |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
589 |
{ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
590 |
return mode; |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
591 |
} |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
592 |
|
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
593 |
/** |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
594 |
* If no suitable basic rate was found, we search the mandatory |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
595 |
* rates. The standard (IEEE 802.11-2007, Section 9.6) says: |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
596 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
597 |
* ...If no rate contained in the BSSBasicRateSet parameter meets |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
598 |
* these conditions, then the control frame sent in response to a |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
599 |
* received frame shall be transmitted at the highest mandatory |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
600 |
* rate of the PHY that is less than or equal to the rate of the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
601 |
* received frame, and that is of the same modulation class as the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
602 |
* received frame. In addition, the Control Response frame shall |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
603 |
* be sent using the same PHY options as the received frame, |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
604 |
* unless they conflict with the requirement to use the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
605 |
* BSSBasicRateSet parameter. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
606 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
607 |
* TODO: Note that we're ignoring the last sentence for now, because |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
608 |
* there is not yet any manipulation here of PHY options. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
609 |
*/ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
610 |
for (uint32_t idx = 0; idx < m_wifiPhy->GetNModes (); idx++) |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
611 |
{ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
612 |
WifiMode thismode = m_wifiPhy->GetMode (idx); |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
613 |
|
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
614 |
/* If the rate: |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
615 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
616 |
* - is a mandatory rate for the PHY, and |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
617 |
* - is equal to or faster than our current best choice, and |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
618 |
* - is less than or equal to the rate of the received frame, and |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
619 |
* - is of the same modulation class as the received frame |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
620 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
621 |
* ...then it's our best choice so far. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
622 |
*/ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
623 |
if (thismode.IsMandatory () |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
624 |
&& (!found || thismode.GetPhyRate () > mode.GetPhyRate ()) |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
625 |
&& thismode.GetPhyRate () <= reqMode.GetPhyRate () |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
626 |
&& thismode.GetModulationClass () == reqMode.GetModulationClass ()) |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
627 |
{ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
628 |
mode = thismode; |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
629 |
// As above; we've found a potentially-suitable transmit |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
630 |
// rate, but we need to continue and consider all the |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
631 |
// mandatory rates before we can be sure we've got the right |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
632 |
// one. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
633 |
found = true; |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
634 |
} |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
635 |
} |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
636 |
|
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
637 |
/** |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
638 |
* If we still haven't found a suitable rate for the response then |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
639 |
* someone has messed up the simulation config. This probably means |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
640 |
* that the WifiPhyStandard is not set correctly, or that a rate that |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
641 |
* is not supported by the PHY has been explicitly requested in a |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
642 |
* WifiRemoteStationManager (or descendant) configuration. |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
643 |
* |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
644 |
* Either way, it is serious - we can either disobey the standard or |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
645 |
* fail, and I have chosen to do the latter... |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
646 |
*/ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
647 |
if (!found) |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
648 |
{ |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
649 |
NS_FATAL_ERROR ("Can't find response rate for " << reqMode |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
650 |
<< ". Check standard and selected rates match."); |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
651 |
} |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
652 |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
653 |
return mode; |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
654 |
} |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
655 |
|
6065 | 656 |
WifiMode |
657 |
WifiRemoteStationManager::GetCtsMode (Mac48Address address, WifiMode rtsMode) |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
658 |
{ |
6065 | 659 |
NS_ASSERT (!address.IsGroup ()); |
660 |
return GetControlAnswerMode (address, rtsMode); |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
661 |
} |
6065 | 662 |
WifiMode |
663 |
WifiRemoteStationManager::GetAckMode (Mac48Address address, WifiMode dataMode) |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
664 |
{ |
6065 | 665 |
NS_ASSERT (!address.IsGroup ()); |
666 |
return GetControlAnswerMode (address, dataMode); |
|
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
667 |
} |
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
668 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
669 |
WifiRemoteStationInfo |
6071
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
670 |
WifiRemoteStationManager::GetInfo (Mac48Address address) |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
671 |
{ |
6339 | 672 |
WifiRemoteStationState *state = LookupState (address); |
6071
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
673 |
return state->m_info; |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
674 |
} |
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
675 |
|
6065 | 676 |
WifiRemoteStationState * |
677 |
WifiRemoteStationManager::LookupState (Mac48Address address) const |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
678 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
679 |
for (StationStates::const_iterator i = m_states.begin (); i != m_states.end (); i++) |
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
680 |
{ |
6065 | 681 |
if ((*i)->m_address == address) |
682 |
{ |
|
683 |
return (*i); |
|
684 |
} |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
685 |
} |
6065 | 686 |
WifiRemoteStationState *state = new WifiRemoteStationState (); |
687 |
state->m_state = WifiRemoteStationState::BRAND_NEW; |
|
688 |
state->m_address = address; |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
689 |
state->m_operationalRateSet.push_back (GetDefaultMode ()); |
6067
ccbdc2b19ea5
add newly-created state to state list.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6065
diff
changeset
|
690 |
const_cast<WifiRemoteStationManager *> (this)->m_states.push_back (state); |
6065 | 691 |
return state; |
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
692 |
} |
6065 | 693 |
WifiRemoteStation * |
694 |
WifiRemoteStationManager::Lookup (Mac48Address address, const WifiMacHeader *header) const |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
695 |
{ |
6065 | 696 |
uint8_t tid; |
697 |
if (header->IsQosData ()) |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
698 |
{ |
6065 | 699 |
tid = header->GetQosTid (); |
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
700 |
} |
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
701 |
else |
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
702 |
{ |
6065 | 703 |
tid = 0; |
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
704 |
} |
6065 | 705 |
return Lookup (address, tid); |
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
706 |
} |
6065 | 707 |
WifiRemoteStation * |
708 |
WifiRemoteStationManager::Lookup (Mac48Address address, uint8_t tid) const |
|
3745
73e7bb607014
bug 372: fragmentation is broken
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3212
diff
changeset
|
709 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
710 |
for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++) |
6065 | 711 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
712 |
if ((*i)->m_tid == tid |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
713 |
&& (*i)->m_state->m_address == address) |
6065 | 714 |
{ |
715 |
return (*i); |
|
716 |
} |
|
717 |
} |
|
718 |
WifiRemoteStationState *state = LookupState (address); |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
719 |
|
6065 | 720 |
WifiRemoteStation *station = DoCreateStation (); |
721 |
station->m_state = state; |
|
6087
2c4e9171497e
Simple bug of WifiRemoteStationManager: station's tid is not initialized.
Kirill Andreev <andreev@iitp.ru>
parents:
6071
diff
changeset
|
722 |
station->m_tid = tid; |
6065 | 723 |
station->m_ssrc = 0; |
724 |
station->m_slrc = 0; |
|
725 |
// XXX |
|
726 |
const_cast<WifiRemoteStationManager *> (this)->m_stations.push_back (station); |
|
727 |
return station; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
728 |
|
3745
73e7bb607014
bug 372: fragmentation is broken
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3212
diff
changeset
|
729 |
} |
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
730 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
731 |
WifiMode |
6065 | 732 |
WifiRemoteStationManager::GetDefaultMode (void) const |
733 |
{ |
|
734 |
return m_defaultTxMode; |
|
735 |
} |
|
736 |
void |
|
737 |
WifiRemoteStationManager::Reset (void) |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
738 |
{ |
6065 | 739 |
for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++) |
740 |
{ |
|
741 |
delete (*i); |
|
742 |
} |
|
743 |
m_stations.clear (); |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
744 |
m_bssBasicRateSet.clear (); |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
745 |
m_bssBasicRateSet.push_back (m_defaultTxMode); |
6065 | 746 |
NS_ASSERT (m_defaultTxMode.IsMandatory ()); |
747 |
} |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
748 |
void |
6065 | 749 |
WifiRemoteStationManager::AddBasicMode (WifiMode mode) |
750 |
{ |
|
751 |
for (uint32_t i = 0; i < GetNBasicModes (); i++) |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
752 |
{ |
6065 | 753 |
if (GetBasicMode (i) == mode) |
754 |
{ |
|
755 |
return; |
|
756 |
} |
|
757 |
} |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
758 |
m_bssBasicRateSet.push_back (mode); |
6065 | 759 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
760 |
uint32_t |
6065 | 761 |
WifiRemoteStationManager::GetNBasicModes (void) const |
762 |
{ |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
763 |
return m_bssBasicRateSet.size (); |
6065 | 764 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
765 |
WifiMode |
6065 | 766 |
WifiRemoteStationManager::GetBasicMode (uint32_t i) const |
767 |
{ |
|
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
768 |
NS_ASSERT (i < m_bssBasicRateSet.size ()); |
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
769 |
return m_bssBasicRateSet[i]; |
6065 | 770 |
} |
771 |
WifiMode |
|
772 |
WifiRemoteStationManager::GetNonUnicastMode (void) const |
|
773 |
{ |
|
774 |
if (m_nonUnicastMode == WifiMode ()) |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
775 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
776 |
return GetBasicMode (0); |
6065 | 777 |
} |
778 |
else |
|
779 |
{ |
|
780 |
return m_nonUnicastMode; |
|
2349
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
781 |
} |
b1df486516a4
allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2280
diff
changeset
|
782 |
} |
1911
e24ae66c6918
use WifiMode rather than mode indexes in MacStations API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1908
diff
changeset
|
783 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
784 |
bool |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
785 |
WifiRemoteStationManager::DoNeedRts (WifiRemoteStation *station, |
6065 | 786 |
Ptr<const Packet> packet, bool normally) |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
787 |
{ |
6065 | 788 |
return normally; |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
789 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
790 |
bool |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
791 |
WifiRemoteStationManager::DoNeedRtsRetransmission (WifiRemoteStation *station, |
6065 | 792 |
Ptr<const Packet> packet, bool normally) |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
793 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
794 |
return normally; |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
795 |
} |
6065 | 796 |
bool |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
797 |
WifiRemoteStationManager::DoNeedDataRetransmission (WifiRemoteStation *station, |
6065 | 798 |
Ptr<const Packet> packet, bool normally) |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
799 |
{ |
6065 | 800 |
return normally; |
801 |
} |
|
802 |
bool |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
803 |
WifiRemoteStationManager::DoNeedFragmentation (WifiRemoteStation *station, |
6065 | 804 |
Ptr<const Packet> packet, bool normally) |
805 |
{ |
|
806 |
return normally; |
|
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
807 |
} |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
808 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
809 |
WifiMode |
6065 | 810 |
WifiRemoteStationManager::GetSupported (const WifiRemoteStation *station, uint32_t i) const |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
811 |
{ |
6065 | 812 |
NS_ASSERT (i < GetNSupported (station)); |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
813 |
return station->m_state->m_operationalRateSet[i]; |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
814 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
815 |
uint32_t |
6065 | 816 |
WifiRemoteStationManager::GetNSupported (const WifiRemoteStation *station) const |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
817 |
{ |
6372
0fafd9716f44
Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
818 |
return station->m_state->m_operationalRateSet.size (); |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
819 |
} |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
820 |
|
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
821 |
//WifiRemoteStationInfo constructor |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
822 |
WifiRemoteStationInfo::WifiRemoteStationInfo () |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
823 |
: m_memoryTime (Seconds (1.0)), |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
824 |
m_lastUpdate (Seconds (0.0)), |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
825 |
m_failAvg (0.0) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
826 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
827 |
} |
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2602
diff
changeset
|
828 |
|
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
829 |
double |
6070 | 830 |
WifiRemoteStationInfo::CalculateAveragingCoefficient () |
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
831 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
832 |
double retval = exp ((double)(m_lastUpdate.GetMicroSeconds () - Simulator::Now ().GetMicroSeconds ()) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
833 |
/ (double)m_memoryTime.GetMicroSeconds ()); |
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
834 |
m_lastUpdate = Simulator::Now (); |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
835 |
return retval; |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
836 |
} |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
837 |
|
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
838 |
void |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
839 |
WifiRemoteStationInfo::NotifyTxSuccess (uint32_t retryCounter) |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
840 |
{ |
6071
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
841 |
double coefficient = CalculateAveragingCoefficient (); |
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
842 |
m_failAvg = (double)retryCounter / (1 + (double) retryCounter) * (1.0 - coefficient) + coefficient * m_failAvg; |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
843 |
} |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
844 |
|
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
845 |
void |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
846 |
WifiRemoteStationInfo::NotifyTxFailed () |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
847 |
{ |
6071
6a25c600c450
tweak slightly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
6070
diff
changeset
|
848 |
double coefficient = CalculateAveragingCoefficient (); |
6069
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
849 |
m_failAvg = (1.0 - coefficient) + coefficient * m_failAvg; |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
850 |
} |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
851 |
|
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
852 |
double |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
853 |
WifiRemoteStationInfo::GetFrameErrorRate () const |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
854 |
{ |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
855 |
return m_failAvg; |
c21754b56036
change airtime metric to work with new wifi remote station manager
Kirill Andreev <andreev@iitp.ru>
parents:
6067
diff
changeset
|
856 |
} |
1906
c0901f40bd7e
move mac-station code in mac-stations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1893
diff
changeset
|
857 |
} // namespace ns3 |