src/devices/wifi/arf-wifi-manager.cc
author Timo Bingmann <timo.bingmann@student.kit.edu>
Fri, 09 Jan 2009 09:39:42 +0100
changeset 4059 251351372d8d
parent 2965 4b28e9740e3b
child 4340 8a1b890c99cc
permissions -rw-r--r--
PropagationLossModel::GetLoss -> CalcRxPower. Add ThreeLogDistancePropagationLossModel.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2004,2005,2006 INRIA
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
6c2d6a5631bc add more files 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
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
6c2d6a5631bc add more files 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,
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
6c2d6a5631bc add more files 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
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
6c2d6a5631bc add more files 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
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 */
6c2d6a5631bc add more files 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: 2269
diff changeset
    21
#include "arf-wifi-manager.h"
1917
d781597e35c0 port ArfMacStations to new MacStation API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1895
diff changeset
    22
#include "ns3/assert.h"
2004
59eb6fb7b722 control the rate control algorithms with default values.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1997
diff changeset
    23
#include "ns3/log.h"
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    24
#include "ns3/uinteger.h"
2004
59eb6fb7b722 control the rate control algorithms with default values.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1997
diff changeset
    25
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2545
diff changeset
    26
NS_LOG_COMPONENT_DEFINE ("ns3::ArfWifiManager");
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
namespace ns3 {
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
  
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    31
ArfWifiRemoteStation::ArfWifiRemoteStation (Ptr<ArfWifiManager> stations,
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    32
                                            int minTimerTimeout,
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    33
                                            int minSuccessThreshold)
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: 1921
diff changeset
    34
  : m_stations (stations)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
{
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
  m_minTimerTimeout = minTimerTimeout;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
  m_minSuccessThreshold = minSuccessThreshold;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
  m_successThreshold = m_minSuccessThreshold;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
  m_timerTimeout = m_minTimerTimeout;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
  m_rate = GetMinRate ();
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
  m_success = 0;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
  m_failed = 0;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
  m_recovery = false;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
  m_retry = 0;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
  m_timer = 0;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    48
ArfWifiRemoteStation::~ArfWifiRemoteStation ()
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    49
{}
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
2005
c15d40b835b5 convert int to uint32_t
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2004
diff changeset
    51
uint32_t
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    52
ArfWifiRemoteStation::GetMaxRate (void)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
{
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: 1921
diff changeset
    54
  return GetNSupportedModes ();
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    55
}
2005
c15d40b835b5 convert int to uint32_t
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2004
diff changeset
    56
uint32_t
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    57
ArfWifiRemoteStation::GetMinRate (void)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    58
{
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    59
  return 0;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    60
}
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    61
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    62
bool 
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    63
ArfWifiRemoteStation::NeedRecoveryFallback (void)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    64
{
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    65
  if (m_retry == 1) 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    66
    {
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    67
      return true;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    68
    } 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    69
  else 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
    {
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    71
      return false;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    72
    }
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    73
}
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
bool 
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    75
ArfWifiRemoteStation::NeedNormalFallback (void)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
{
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    77
  int retryMod = (m_retry - 1) % 2;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    78
  if (retryMod == 1) 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    79
    {
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    80
      return true;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    81
    } 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    82
  else 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    83
    {
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    84
      return false;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    85
    }
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    86
}
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    87
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    88
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    89
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    90
void 
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2602
diff changeset
    91
ArfWifiRemoteStation::DoReportRtsFailed (void)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    92
{}
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    93
/**
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    94
 * It is important to realize that "recovery" mode starts after failure of
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    95
 * the first transmission after a rate increase and ends at the first successful
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    96
 * transmission. Specifically, recovery mode transcends retransmissions boundaries.
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    97
 * Fundamentally, ARF handles each data transmission independently, whether it
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    98
 * is the initial transmission of a packet or the retransmission of a packet.
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    99
 * The fundamental reason for this is that there is a backoff between each data
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   100
 * transmission, be it an initial transmission or a retransmission.
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   101
 */
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   102
void 
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2602
diff changeset
   103
ArfWifiRemoteStation::DoReportDataFailed (void)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   104
{
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   105
  m_timer++;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   106
  m_failed++;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   107
  m_retry++;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   108
  m_success = 0;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   109
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   110
  if (m_recovery) 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   111
    {
1917
d781597e35c0 port ArfMacStations to new MacStation API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1895
diff changeset
   112
      NS_ASSERT (m_retry >= 1);
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   113
      if (NeedRecoveryFallback ()) 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   114
        {
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   115
          ReportRecoveryFailure ();
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   116
          if (m_rate != GetMinRate ()) 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   117
            {
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   118
              m_rate--;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   119
            }
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   120
        }
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   121
      m_timer = 0;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   122
    } 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   123
  else 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   124
    {
1917
d781597e35c0 port ArfMacStations to new MacStation API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1895
diff changeset
   125
      NS_ASSERT (m_retry >= 1);
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   126
      if (NeedNormalFallback ()) 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   127
        {
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   128
          ReportFailure ();
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   129
          if (m_rate != GetMinRate ()) 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   130
            {
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   131
              m_rate--;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   132
            }
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   133
        }
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   134
      if (m_retry >= 2) 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   135
        {
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   136
          m_timer = 0;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   137
        }
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   138
    }
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   139
}
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   140
void 
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2602
diff changeset
   141
ArfWifiRemoteStation::DoReportRxOk (double rxSnr, WifiMode txMode)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   142
{}
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2602
diff changeset
   143
void ArfWifiRemoteStation::DoReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr)
2004
59eb6fb7b722 control the rate control algorithms with default values.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1997
diff changeset
   144
{
59eb6fb7b722 control the rate control algorithms with default values.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1997
diff changeset
   145
  NS_LOG_DEBUG ("self="<<this<<" rts ok");
59eb6fb7b722 control the rate control algorithms with default values.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1997
diff changeset
   146
}
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2602
diff changeset
   147
void ArfWifiRemoteStation::DoReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   148
{
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   149
  m_timer++;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   150
  m_success++;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   151
  m_failed = 0;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   152
  m_recovery = false;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   153
  m_retry = 0;
2004
59eb6fb7b722 control the rate control algorithms with default values.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1997
diff changeset
   154
  NS_LOG_DEBUG ("self="<<this<<" data ok success="<<m_success<<", timer="<<m_timer);
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   155
  if ((m_success == GetSuccessThreshold () ||
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   156
       m_timer == GetTimerTimeout ()) &&
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   157
      (m_rate < (GetMaxRate () - 1))) 
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   158
    {
2004
59eb6fb7b722 control the rate control algorithms with default values.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1997
diff changeset
   159
      NS_LOG_DEBUG ("self="<<this<<" inc rate");
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   160
      m_rate++;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   161
      m_timer = 0;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   162
      m_success = 0;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   163
      m_recovery = true;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   164
    }
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   165
}
2269
06c660ffc070 add MacStation::ReportFinal* methods for onoe rate control model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2268
diff changeset
   166
void 
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2602
diff changeset
   167
ArfWifiRemoteStation::DoReportFinalRtsFailed (void)
2269
06c660ffc070 add MacStation::ReportFinal* methods for onoe rate control model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2268
diff changeset
   168
{}
06c660ffc070 add MacStation::ReportFinal* methods for onoe rate control model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2268
diff changeset
   169
void 
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2602
diff changeset
   170
ArfWifiRemoteStation::DoReportFinalDataFailed (void)
2269
06c660ffc070 add MacStation::ReportFinal* methods for onoe rate control model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2268
diff changeset
   171
{}
06c660ffc070 add MacStation::ReportFinal* methods for onoe rate control model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2268
diff changeset
   172
1917
d781597e35c0 port ArfMacStations to new MacStation API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1895
diff changeset
   173
WifiMode
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   174
ArfWifiRemoteStation::DoGetDataMode (uint32_t size)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   175
{
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: 1921
diff changeset
   176
  return GetSupportedMode (m_rate);
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   177
}
1917
d781597e35c0 port ArfMacStations to new MacStation API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1895
diff changeset
   178
WifiMode
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   179
ArfWifiRemoteStation::DoGetRtsMode (void)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   180
{
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: 1921
diff changeset
   181
  // XXX: we could/should implement the Arf algorithm for
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1921
diff changeset
   182
  // RTS only by picking a single rate within the BasicRateSet.
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1921
diff changeset
   183
  return GetSupportedMode (0);
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   184
}
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   185
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   186
void ArfWifiRemoteStation::ReportRecoveryFailure (void)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   187
{}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   188
void ArfWifiRemoteStation::ReportFailure (void)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   189
{}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   190
uint32_t ArfWifiRemoteStation::GetMinTimerTimeout (void)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   191
{
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   192
  return m_minTimerTimeout;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   193
}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   194
uint32_t ArfWifiRemoteStation::GetMinSuccessThreshold (void)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   195
{
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   196
  return m_minSuccessThreshold;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   197
}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   198
uint32_t ArfWifiRemoteStation::GetTimerTimeout (void)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   199
{
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   200
  return m_timerTimeout;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   201
}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   202
uint32_t ArfWifiRemoteStation::GetSuccessThreshold (void)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   203
{
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   204
  return m_successThreshold;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   205
}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   206
void ArfWifiRemoteStation::SetTimerTimeout (uint32_t timerTimeout)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   207
{
1917
d781597e35c0 port ArfMacStations to new MacStation API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1895
diff changeset
   208
  NS_ASSERT (timerTimeout >= m_minTimerTimeout);
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   209
  m_timerTimeout = timerTimeout;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   210
}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   211
void ArfWifiRemoteStation::SetSuccessThreshold (uint32_t successThreshold)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   212
{
1917
d781597e35c0 port ArfMacStations to new MacStation API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1895
diff changeset
   213
  NS_ASSERT (successThreshold >= m_minSuccessThreshold);
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   214
  m_successThreshold = successThreshold;
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   215
}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   216
Ptr<WifiRemoteStationManager>
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   217
ArfWifiRemoteStation::GetManager (void) const
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: 1921
diff changeset
   218
{
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1921
diff changeset
   219
  return m_stations;
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1921
diff changeset
   220
}
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   221
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   222
NS_OBJECT_ENSURE_REGISTERED (ArfWifiManager);
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   223
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   224
TypeId 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   225
ArfWifiManager::GetTypeId (void)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   226
{
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2545
diff changeset
   227
  static TypeId tid = TypeId ("ns3::ArfWifiManager")
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   228
    .SetParent<WifiRemoteStationManager> ()
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   229
    .AddConstructor<ArfWifiManager> ()
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   230
    .AddAttribute ("TimerThreshold", "The 'timer' threshold in the ARF algorithm.",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2784
diff changeset
   231
                   UintegerValue (15),
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   232
                   MakeUintegerAccessor (&ArfWifiManager::m_timerThreshold),
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   233
                   MakeUintegerChecker<uint32_t> ())
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   234
    .AddAttribute ("SuccessThreshold",
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   235
                   "The minimum number of sucessfull transmissions to try a new rate.",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2784
diff changeset
   236
                   UintegerValue (10),
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   237
                   MakeUintegerAccessor (&ArfWifiManager::m_successThreshold),
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   238
                   MakeUintegerChecker<uint32_t> ())
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   239
    ;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   240
  return tid;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   241
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   242
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   243
ArfWifiManager::ArfWifiManager ()
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   244
{}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   245
ArfWifiManager::~ArfWifiManager ()
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   246
{}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   247
WifiRemoteStation *
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   248
ArfWifiManager::CreateStation (void)
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   249
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   250
  return new ArfWifiRemoteStation (this, m_timerThreshold, m_successThreshold);
1895
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   251
}
6c2d6a5631bc add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   252
1917
d781597e35c0 port ArfMacStations to new MacStation API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1895
diff changeset
   253
} // namespace ns3