author | Nicola Baldo <nbaldo@cttc.es> |
Mon, 07 Jun 2010 16:12:16 +0200 | |
changeset 6339 | 84cbcc1a3f16 |
parent 6065 | 0f012e7d9128 |
child 6340 | fe24c9edacb6 |
permissions | -rw-r--r-- |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
2 |
/* |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
3 |
* Copyright (c) 2005,2006 INRIA |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
4 |
* |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
8 |
* |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
13 |
* |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
17 |
* |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
18 |
* Author: Federico Maguolo <maguolof@dei.unipd.it> |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
19 |
*/ |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
20 |
#ifndef AARFCD_WIFI_MANAGER_H |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
21 |
#define AARFCD_WIFI_MANAGER_H |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
22 |
|
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
23 |
#include "wifi-remote-station-manager.h" |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
24 |
|
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
25 |
namespace ns3 { |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
26 |
|
6065 | 27 |
class AarfcdWifiRemoteStation; |
28 |
||
4339
dd889b47f446
add reference to paper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4338
diff
changeset
|
29 |
/** |
dd889b47f446
add reference to paper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4338
diff
changeset
|
30 |
* \brief an implementation of the AARF-CD algorithm |
dd889b47f446
add reference to paper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4338
diff
changeset
|
31 |
* |
dd889b47f446
add reference to paper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4338
diff
changeset
|
32 |
* This algorithm was first described in "Efficient Collision Detection for Auto Rate Fallback Algorithm". |
dd889b47f446
add reference to paper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4338
diff
changeset
|
33 |
* The implementation available here was done by Federico Maguolo for a very early development |
dd889b47f446
add reference to paper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4338
diff
changeset
|
34 |
* version of ns-3. Federico died before merging this work in ns-3 itself so his code was ported |
dd889b47f446
add reference to paper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4338
diff
changeset
|
35 |
* to ns-3 later without his supervision. |
dd889b47f446
add reference to paper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4338
diff
changeset
|
36 |
*/ |
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
37 |
class AarfcdWifiManager : public WifiRemoteStationManager |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
38 |
{ |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
39 |
public: |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
40 |
static TypeId GetTypeId (void); |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
41 |
AarfcdWifiManager (); |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
42 |
virtual ~AarfcdWifiManager (); |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
43 |
|
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
44 |
private: |
6065 | 45 |
// overriden from base class |
6339 | 46 |
virtual WifiRemoteStation *DoCreateStation (void) const; |
6065 | 47 |
virtual void DoReportRxOk (WifiRemoteStation *station, |
48 |
double rxSnr, WifiMode txMode); |
|
49 |
virtual void DoReportRtsFailed (WifiRemoteStation *station); |
|
50 |
virtual void DoReportDataFailed (WifiRemoteStation *station); |
|
51 |
virtual void DoReportRtsOk (WifiRemoteStation *station, |
|
52 |
double ctsSnr, WifiMode ctsMode, double rtsSnr); |
|
53 |
virtual void DoReportDataOk (WifiRemoteStation *station, |
|
54 |
double ackSnr, WifiMode ackMode, double dataSnr); |
|
55 |
virtual void DoReportFinalRtsFailed (WifiRemoteStation *station); |
|
56 |
virtual void DoReportFinalDataFailed (WifiRemoteStation *station); |
|
57 |
virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size); |
|
58 |
virtual WifiMode DoGetRtsMode (WifiRemoteStation *station); |
|
59 |
virtual bool DoNeedRts (WifiRemoteStation *station, |
|
60 |
Ptr<const Packet> packet, bool normally); |
|
61 |
virtual bool IsLowLatency (void) const; |
|
62 |
||
63 |
void CheckRts (AarfcdWifiRemoteStation *station); |
|
64 |
void IncreaseRtsWnd (AarfcdWifiRemoteStation *station); |
|
65 |
void ResetRtsWnd (AarfcdWifiRemoteStation *station); |
|
66 |
void TurnOffRts (AarfcdWifiRemoteStation *station); |
|
67 |
void TurnOnRts (AarfcdWifiRemoteStation *station); |
|
68 |
||
69 |
// aarf fields below |
|
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
70 |
uint32_t m_minTimerThreshold; |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
71 |
uint32_t m_minSuccessThreshold; |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
72 |
double m_successK; |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
73 |
uint32_t m_maxSuccessThreshold; |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
74 |
double m_timerK; |
6065 | 75 |
|
76 |
// aarf-cd fields below |
|
4334
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
77 |
uint32_t m_minRtsWnd; |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
78 |
uint32_t m_maxRtsWnd; |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
79 |
bool m_rtsFailsAsDataFails; |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
80 |
bool m_turnOffRtsAfterRateDecrease; |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
81 |
bool m_turnOnRtsAfterRateIncrease; |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
82 |
}; |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
83 |
|
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
84 |
} // namespace ns3 |
12b3fcf84fc5
bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff
changeset
|
85 |
|
6065 | 86 |
#endif /* AARFCD_WIFI_MANAGER_H */ |