src/wifi/model/aarfcd-wifi-manager.h
author Ghada Badawy <gbadawy@gmail.com>
Tue, 13 Aug 2013 22:05:25 -0700
changeset 10139 17a71cd49da3
parent 7385 10beb0e53130
child 10218 97da49da2d6c
permissions -rw-r--r--
partial 802.11n support
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents: 7141
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
4334
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
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
4334
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
6340
fe24c9edacb6 fixed bug 924
Quincy Tse <quincy.tse@gmail.com>
parents: 6339
diff changeset
    27
struct AarfcdWifiRemoteStation;
6065
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    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
7139
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    31
 * \ingroup wifi
4339
dd889b47f446 add reference to paper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4338
diff changeset
    32
 *
dd889b47f446 add reference to paper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4338
diff changeset
    33
 * 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
    34
 * 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
    35
 * 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
    36
 * to ns-3 later without his supervision.
dd889b47f446 add reference to paper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4338
diff changeset
    37
 */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    38
class AarfcdWifiManager : public WifiRemoteStationManager
4334
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    39
{
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    40
public:
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    41
  static TypeId GetTypeId (void);
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    42
  AarfcdWifiManager ();
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    43
  virtual ~AarfcdWifiManager ();
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    44
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    45
private:
6065
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    46
  // overriden from base class
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    47
  virtual WifiRemoteStation * DoCreateStation (void) const;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    48
  virtual void DoReportRxOk (WifiRemoteStation *station,
6065
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    49
                             double rxSnr, WifiMode txMode);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    50
  virtual void DoReportRtsFailed (WifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    51
  virtual void DoReportDataFailed (WifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    52
  virtual void DoReportRtsOk (WifiRemoteStation *station,
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    53
                              double ctsSnr, WifiMode ctsMode, double rtsSnr);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    54
  virtual void DoReportDataOk (WifiRemoteStation *station,
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    55
                               double ackSnr, WifiMode ackMode, double dataSnr);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    56
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    57
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
10139
17a71cd49da3 partial 802.11n support
Ghada Badawy <gbadawy@gmail.com>
parents: 7385
diff changeset
    58
  virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size);
17a71cd49da3 partial 802.11n support
Ghada Badawy <gbadawy@gmail.com>
parents: 7385
diff changeset
    59
  virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    60
  virtual bool DoNeedRts (WifiRemoteStation *station,
6065
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    61
                          Ptr<const Packet> packet, bool normally);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    62
  virtual bool IsLowLatency (void) const;
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    63
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    64
  void CheckRts (AarfcdWifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    65
  void IncreaseRtsWnd (AarfcdWifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    66
  void ResetRtsWnd (AarfcdWifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    67
  void TurnOffRts (AarfcdWifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    68
  void TurnOnRts (AarfcdWifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    69
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    70
  // aarf fields below
4334
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    71
  uint32_t m_minTimerThreshold;
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    72
  uint32_t m_minSuccessThreshold;
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    73
  double m_successK;
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    74
  uint32_t m_maxSuccessThreshold;
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    75
  double m_timerK;
6065
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    76
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    77
  // aarf-cd fields below
4334
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    78
  uint32_t m_minRtsWnd;
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    79
  uint32_t m_maxRtsWnd;
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    80
  bool m_rtsFailsAsDataFails;
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    81
  bool m_turnOffRtsAfterRateDecrease;
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    82
  bool m_turnOnRtsAfterRateIncrease;
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
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    85
} // namespace ns3
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents:
diff changeset
    86
6065
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4345
diff changeset
    87
#endif /* AARFCD_WIFI_MANAGER_H */