src/wifi/model/dcf-manager.cc
author Stefano Avallone <stefano.avallone@unina.it>
Fri, 05 Sep 2014 16:33:57 -0700
changeset 10883 d919e7194e23
parent 10580 2a29a9bd6fd6
child 10968 2d29fee2b7b8
permissions -rw-r--r--
add support for a Wifi sleep mode
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; -*- */
4325
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
     2
/*
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
     3
 * Copyright (c) 2005,2006 INRIA
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
     4
 *
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
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: 7061
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
4325
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
     7
 * published by the Free Software Foundation;
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
     8
 *
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
    12
 * GNU General Public License for more details.
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
    13
 *
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
    14
 * You should have received a copy of the GNU General Public License
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
    15
 * along with this program; if not, write to the Free Software
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
    17
 *
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4217
diff changeset
    19
 */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    20
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    21
#include "ns3/assert.h"
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    22
#include "ns3/log.h"
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    23
#include "ns3/simulator.h"
9063
32755d0516f4 Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents: 7385
diff changeset
    24
#include <cmath>
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    25
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    26
#include "dcf-manager.h"
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    27
#include "wifi-phy.h"
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    28
#include "wifi-mac.h"
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    29
#include "mac-low.h"
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    30
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    31
NS_LOG_COMPONENT_DEFINE ("DcfManager");
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    32
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
    33
#define MY_DEBUG(x) \
2140
acfd79fc8d65 debugging output is more verbose.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2130
diff changeset
    34
  NS_LOG_DEBUG (Simulator::Now () << " " << this << " " << x)
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
    35
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    36
namespace ns3 {
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    37
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    38
/****************************************************************
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    39
 *      Implement the DCF state holder
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    40
 ****************************************************************/
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    41
2100
1b8cc486edd9 initialize more state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2099
diff changeset
    42
DcfState::DcfState ()
1b8cc486edd9 initialize more state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2099
diff changeset
    43
  : m_backoffSlots (0),
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
    44
    m_backoffStart (Seconds (0.0)),
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    45
    m_cwMin (0),
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    46
    m_cwMax (0),
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    47
    m_cw (0),
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
    48
    m_accessRequested (false)
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
    49
{
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
    50
}
2100
1b8cc486edd9 initialize more state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2099
diff changeset
    51
2096
4e282663666c add missing method implementations
mlacage@thira.inria.fr
parents: 2095
diff changeset
    52
DcfState::~DcfState ()
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
    53
{
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
    54
}
2096
4e282663666c add missing method implementations
mlacage@thira.inria.fr
parents: 2095
diff changeset
    55
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
    56
void
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    57
DcfState::SetAifsn (uint32_t aifsn)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    58
{
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    59
  m_aifsn = aifsn;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    60
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
    61
void
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    62
DcfState::SetCwMin (uint32_t minCw)
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    63
{
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    64
  m_cwMin = minCw;
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    65
  ResetCw ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    66
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
    67
void
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    68
DcfState::SetCwMax (uint32_t maxCw)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    69
{
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    70
  m_cwMax = maxCw;
2100
1b8cc486edd9 initialize more state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2099
diff changeset
    71
  ResetCw ();
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    72
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
    73
uint32_t
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    74
DcfState::GetAifsn (void) const
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    75
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    76
  return m_aifsn;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    77
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    78
uint32_t
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    79
DcfState::GetCwMin (void) const
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    80
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    81
  return m_cwMin;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    82
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
    83
uint32_t
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    84
DcfState::GetCwMax (void) const
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    85
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    86
  return m_cwMax;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    87
}
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    88
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
    89
void
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    90
DcfState::ResetCw (void)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    91
{
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    92
  m_cw = m_cwMin;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    93
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
    94
void
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    95
DcfState::UpdateFailedCw (void)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    96
{
10580
2a29a9bd6fd6 Update (most of) IEEE Std 802.11-2007 to IEEE Std 802.11-2012
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10507
diff changeset
    97
  // see 802.11-2012, section 9.19.2.5
4217
9494663cf1c9 bug 509: backoff CW growth is invalid
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3905
diff changeset
    98
  m_cw = std::min ( 2 * (m_cw + 1) - 1, m_cwMax);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    99
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   100
void
2122
ee136bc4f214 keep track of the last time a backoff was updated.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2120
diff changeset
   101
DcfState::UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound)
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   102
{
2142
63c08450a4da avoid decrementing by too many backoff slots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2140
diff changeset
   103
  m_backoffSlots -= nSlots;
2122
ee136bc4f214 keep track of the last time a backoff was updated.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2120
diff changeset
   104
  m_backoffStart = backoffUpdateBound;
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   105
  MY_DEBUG ("update slots=" << nSlots << " slots, backoff=" << m_backoffSlots);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   106
}
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   107
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   108
void
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   109
DcfState::StartBackoffNow (uint32_t nSlots)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   110
{
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   111
  NS_ASSERT (m_backoffSlots == 0);
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   112
  MY_DEBUG ("start backoff=" << nSlots << " slots");
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   113
  m_backoffSlots = nSlots;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   114
  m_backoffStart = Simulator::Now ();
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   115
}
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   116
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   117
uint32_t
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   118
DcfState::GetCw (void) const
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   119
{
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   120
  return m_cw;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   121
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   122
uint32_t
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   123
DcfState::GetBackoffSlots (void) const
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   124
{
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   125
  return m_backoffSlots;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   126
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   127
Time
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   128
DcfState::GetBackoffStart (void) const
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   129
{
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   130
  return m_backoffStart;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   131
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   132
bool
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   133
DcfState::IsAccessRequested (void) const
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   134
{
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   135
  return m_accessRequested;
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   136
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   137
void
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   138
DcfState::NotifyAccessRequested (void)
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   139
{
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   140
  m_accessRequested = true;
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   141
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   142
void
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   143
DcfState::NotifyAccessGranted (void)
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   144
{
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   145
  NS_ASSERT (m_accessRequested);
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   146
  m_accessRequested = false;
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   147
  DoNotifyAccessGranted ();
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   148
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   149
void
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   150
DcfState::NotifyCollision (void)
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   151
{
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   152
  DoNotifyCollision ();
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   153
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   154
void
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   155
DcfState::NotifyInternalCollision (void)
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   156
{
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   157
  DoNotifyInternalCollision ();
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   158
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   159
void
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   160
DcfState::NotifyChannelSwitching (void)
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   161
{
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   162
  DoNotifyChannelSwitching ();
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   163
}
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   164
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   165
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   166
/**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   167
 * Listener for NAV events. Forwards to DcfManager
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   168
 */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   169
class LowDcfListener : public ns3::MacLowDcfListener
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   170
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   171
public:
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   172
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   173
   * Create a LowDcfListener for the given DcfManager.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   174
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   175
   * \param dcf
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   176
   */
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   177
  LowDcfListener (ns3::DcfManager *dcf)
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   178
    : m_dcf (dcf)
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   179
  {
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   180
  }
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   181
  virtual ~LowDcfListener ()
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   182
  {
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   183
  }
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   184
  virtual void NavStart (Time duration)
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   185
  {
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   186
    m_dcf->NotifyNavStartNow (duration);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   187
  }
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   188
  virtual void NavReset (Time duration)
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   189
  {
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   190
    m_dcf->NotifyNavResetNow (duration);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   191
  }
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   192
  virtual void AckTimeoutStart (Time duration)
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   193
  {
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   194
    m_dcf->NotifyAckTimeoutStartNow (duration);
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   195
  }
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   196
  virtual void AckTimeoutReset ()
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   197
  {
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   198
    m_dcf->NotifyAckTimeoutResetNow ();
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   199
  }
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   200
  virtual void CtsTimeoutStart (Time duration)
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   201
  {
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   202
    m_dcf->NotifyCtsTimeoutStartNow (duration);
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   203
  }
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   204
  virtual void CtsTimeoutReset ()
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   205
  {
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   206
    m_dcf->NotifyCtsTimeoutResetNow ();
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   207
  }
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   208
private:
10507
2081aa152526 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10483
diff changeset
   209
  ns3::DcfManager *m_dcf;  //!< DcfManager to forward events to
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   210
};
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   211
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   212
/**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   213
 * Listener for PHY events. Forwards to DcfManager
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   214
 */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   215
class PhyListener : public ns3::WifiPhyListener
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   216
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   217
public:
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   218
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   219
   * Create a PhyListener for the given DcfManager.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   220
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   221
   * \param dcf
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10211
diff changeset
   222
   */
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   223
  PhyListener (ns3::DcfManager *dcf)
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   224
    : m_dcf (dcf)
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   225
  {
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   226
  }
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   227
  virtual ~PhyListener ()
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   228
  {
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   229
  }
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   230
  virtual void NotifyRxStart (Time duration)
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   231
  {
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   232
    m_dcf->NotifyRxStartNow (duration);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   233
  }
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   234
  virtual void NotifyRxEndOk (void)
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   235
  {
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   236
    m_dcf->NotifyRxEndOkNow ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   237
  }
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   238
  virtual void NotifyRxEndError (void)
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   239
  {
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   240
    m_dcf->NotifyRxEndErrorNow ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   241
  }
10883
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   242
  virtual void NotifyTxStart (Time duration, double txPowerDbm)
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   243
  {
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   244
    m_dcf->NotifyTxStartNow (duration);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   245
  }
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   246
  virtual void NotifyMaybeCcaBusyStart (Time duration)
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   247
  {
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
   248
    m_dcf->NotifyMaybeCcaBusyStartNow (duration);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   249
  }
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   250
  virtual void NotifySwitchingStart (Time duration)
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   251
  {
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   252
    m_dcf->NotifySwitchingStartNow (duration);
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   253
  }
10883
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   254
  virtual void NotifySleep (void)
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   255
  {
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   256
    m_dcf->NotifySleepNow ();
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   257
  }
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   258
  virtual void NotifyWakeup (void)
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   259
  {
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   260
    m_dcf->NotifyWakeupNow ();
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   261
  }
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   262
private:
10507
2081aa152526 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10483
diff changeset
   263
  ns3::DcfManager *m_dcf;  //!< DcfManager to forward events to
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   264
};
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   265
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   266
/****************************************************************
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   267
 *      Implement the DCF manager of all DCF state holders
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   268
 ****************************************************************/
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   269
2099
de25c6d81572 initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2096
diff changeset
   270
DcfManager::DcfManager ()
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   271
  : m_lastAckTimeoutEnd (MicroSeconds (0)),
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   272
    m_lastCtsTimeoutEnd (MicroSeconds (0)),
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   273
    m_lastNavStart (MicroSeconds (0)),
2099
de25c6d81572 initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2096
diff changeset
   274
    m_lastNavDuration (MicroSeconds (0)),
de25c6d81572 initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2096
diff changeset
   275
    m_lastRxStart (MicroSeconds (0)),
de25c6d81572 initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2096
diff changeset
   276
    m_lastRxDuration (MicroSeconds (0)),
de25c6d81572 initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2096
diff changeset
   277
    m_lastRxReceivedOk (true),
de25c6d81572 initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2096
diff changeset
   278
    m_lastRxEnd (MicroSeconds (0)),
de25c6d81572 initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2096
diff changeset
   279
    m_lastTxStart (MicroSeconds (0)),
de25c6d81572 initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2096
diff changeset
   280
    m_lastTxDuration (MicroSeconds (0)),
de25c6d81572 initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2096
diff changeset
   281
    m_lastBusyStart (MicroSeconds (0)),
de25c6d81572 initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2096
diff changeset
   282
    m_lastBusyDuration (MicroSeconds (0)),
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   283
    m_lastSwitchingStart (MicroSeconds (0)),
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   284
    m_lastSwitchingDuration (MicroSeconds (0)),
2105
e883a100109a get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2104
diff changeset
   285
    m_rxing (false),
10883
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   286
    m_sleeping (false),
5816
d3fdc15b065f Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 5815
diff changeset
   287
    m_slotTimeUs (0),
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   288
    m_sifs (Seconds (0.0)),
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   289
    m_phyListener (0),
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   290
    m_lowListener (0)
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   291
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   292
  NS_LOG_FUNCTION (this);
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   293
}
2099
de25c6d81572 initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2096
diff changeset
   294
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   295
DcfManager::~DcfManager ()
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   296
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   297
  delete m_phyListener;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   298
  delete m_lowListener;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   299
  m_phyListener = 0;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   300
  m_lowListener = 0;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   301
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   302
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   303
void
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   304
DcfManager::SetupPhyListener (Ptr<WifiPhy> phy)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   305
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   306
  NS_LOG_FUNCTION (this << phy);
10200
17e79c1772cd avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents: 9711
diff changeset
   307
  if (m_phyListener != 0)
17e79c1772cd avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents: 9711
diff changeset
   308
    {
17e79c1772cd avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents: 9711
diff changeset
   309
      delete m_phyListener;
17e79c1772cd avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents: 9711
diff changeset
   310
    }
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   311
  m_phyListener = new PhyListener (this);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   312
  phy->RegisterListener (m_phyListener);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   313
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   314
void
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   315
DcfManager::SetupLowListener (Ptr<MacLow> low)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   316
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   317
  NS_LOG_FUNCTION (this << low);
10200
17e79c1772cd avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents: 9711
diff changeset
   318
  if (m_lowListener != 0)
17e79c1772cd avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents: 9711
diff changeset
   319
    {
17e79c1772cd avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents: 9711
diff changeset
   320
      delete m_lowListener;
17e79c1772cd avoid memory leak if called multiple times
Junling Bu <linlinjavaer@gmail.com>
parents: 9711
diff changeset
   321
    }
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   322
  m_lowListener = new LowDcfListener (this);
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   323
  low->RegisterDcfListener (m_lowListener);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   324
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   325
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   326
void
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   327
DcfManager::SetSlot (Time slotTime)
2096
4e282663666c add missing method implementations
mlacage@thira.inria.fr
parents: 2095
diff changeset
   328
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   329
  NS_LOG_FUNCTION (this << slotTime);
5816
d3fdc15b065f Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 5815
diff changeset
   330
  m_slotTimeUs = slotTime.GetMicroSeconds ();
2105
e883a100109a get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2104
diff changeset
   331
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   332
void
2105
e883a100109a get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2104
diff changeset
   333
DcfManager::SetSifs (Time sifs)
e883a100109a get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2104
diff changeset
   334
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   335
  NS_LOG_FUNCTION (this << sifs);
2105
e883a100109a get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2104
diff changeset
   336
  m_sifs = sifs;
2096
4e282663666c add missing method implementations
mlacage@thira.inria.fr
parents: 2095
diff changeset
   337
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   338
void
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   339
DcfManager::SetEifsNoDifs (Time eifsNoDifs)
2096
4e282663666c add missing method implementations
mlacage@thira.inria.fr
parents: 2095
diff changeset
   340
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   341
  NS_LOG_FUNCTION (this << eifsNoDifs);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   342
  m_eifsNoDifs = eifsNoDifs;
2096
4e282663666c add missing method implementations
mlacage@thira.inria.fr
parents: 2095
diff changeset
   343
}
4460
d7ad6e210086 move GetEifsNoDifs to DcfManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 4325
diff changeset
   344
Time
d7ad6e210086 move GetEifsNoDifs to DcfManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 4325
diff changeset
   345
DcfManager::GetEifsNoDifs () const
d7ad6e210086 move GetEifsNoDifs to DcfManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 4325
diff changeset
   346
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   347
  NS_LOG_FUNCTION (this);
4460
d7ad6e210086 move GetEifsNoDifs to DcfManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 4325
diff changeset
   348
  return m_eifsNoDifs;
d7ad6e210086 move GetEifsNoDifs to DcfManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 4325
diff changeset
   349
}
2096
4e282663666c add missing method implementations
mlacage@thira.inria.fr
parents: 2095
diff changeset
   350
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   351
void
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   352
DcfManager::Add (DcfState *dcf)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   353
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   354
  NS_LOG_FUNCTION (this << dcf);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   355
  m_states.push_back (dcf);
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   356
}
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   357
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   358
Time
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   359
DcfManager::MostRecent (Time a, Time b) const
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   360
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   361
  NS_LOG_FUNCTION (this << a << b);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   362
  return Max (a, b);
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   363
}
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   364
Time
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   365
DcfManager::MostRecent (Time a, Time b, Time c) const
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   366
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   367
  NS_LOG_FUNCTION (this << a << b << c);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   368
  Time retval;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   369
  retval = Max (a, b);
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   370
  retval = Max (retval, c);
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   371
  return retval;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   372
}
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   373
Time
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   374
DcfManager::MostRecent (Time a, Time b, Time c, Time d) const
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   375
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   376
  NS_LOG_FUNCTION (this << a << b << c << d);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   377
  Time e = Max (a, b);
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   378
  Time f = Max (c, d);
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   379
  Time retval = Max (e, f);
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   380
  return retval;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   381
}
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   382
Time
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   383
DcfManager::MostRecent (Time a, Time b, Time c, Time d, Time e, Time f) const
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   384
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   385
  NS_LOG_FUNCTION (this << a << b << c << d << e << f);
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   386
  Time g = Max (a, b);
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   387
  Time h = Max (c, d);
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   388
  Time i = Max (e, f);
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   389
  Time k = Max (g, h);
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   390
  Time retval = Max (k, i);
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   391
  return retval;
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   392
}
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   393
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   394
Time
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   395
DcfManager::MostRecent (Time a, Time b, Time c, Time d, Time e, Time f, Time g) const
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   396
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   397
  NS_LOG_FUNCTION (this << a << b << c << d << e << f << g);
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   398
  Time h = Max (a, b);
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   399
  Time i = Max (c, d);
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   400
  Time j = Max (e, f);
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   401
  Time k = Max (h, i);
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   402
  Time l = Max (j, g);
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   403
  Time retval = Max (k, l);
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   404
  return retval;
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   405
}
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   406
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   407
bool
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   408
DcfManager::IsBusy (void) const
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   409
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   410
  NS_LOG_FUNCTION (this);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   411
  // PHY busy
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   412
  if (m_rxing)
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   413
    {
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   414
      return true;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   415
    }
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   416
  Time lastTxEnd = m_lastTxStart + m_lastTxDuration;
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   417
  if (lastTxEnd > Simulator::Now ())
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   418
    {
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   419
      return true;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   420
    }
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   421
  // NAV busy
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   422
  Time lastNavEnd = m_lastNavStart + m_lastNavDuration;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   423
  if (lastNavEnd > Simulator::Now ())
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   424
    {
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   425
      return true;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   426
    }
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   427
  return false;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   428
}
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   429
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   430
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   431
void
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   432
DcfManager::RequestAccess (DcfState *state)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   433
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   434
  NS_LOG_FUNCTION (this << state);
10883
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   435
  // Deny access if in sleep mode
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   436
  if (m_sleeping)
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   437
    return;
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   438
  UpdateBackoff ();
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   439
  NS_ASSERT (!state->IsAccessRequested ());
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   440
  state->NotifyAccessRequested ();
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   441
  /**
2127
2707cb71f6dc even if an access timer is running, we need to start a backoff if needed
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2122
diff changeset
   442
   * If there is a collision, generate a backoff
2707cb71f6dc even if an access timer is running, we need to start a backoff if needed
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2122
diff changeset
   443
   * by notifying the collision to the user.
2707cb71f6dc even if an access timer is running, we need to start a backoff if needed
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2122
diff changeset
   444
   */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   445
  if (state->GetBackoffSlots () == 0
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   446
      && IsBusy ())
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   447
    {
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   448
      MY_DEBUG ("medium is busy: collision");
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   449
      /* someone else has accessed the medium.
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   450
       * generate a backoff.
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   451
       */
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   452
      state->NotifyCollision ();
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   453
    }
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   454
  DoGrantAccess ();
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   455
  DoRestartAccessTimeoutIfNeeded ();
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   456
}
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   457
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   458
void
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   459
DcfManager::DoGrantAccess (void)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   460
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   461
  NS_LOG_FUNCTION (this);
2103
ae7144199052 add debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2100
diff changeset
   462
  uint32_t k = 0;
ae7144199052 add debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2100
diff changeset
   463
  for (States::const_iterator i = m_states.begin (); i != m_states.end (); k++)
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   464
    {
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   465
      DcfState *state = *i;
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   466
      if (state->IsAccessRequested ()
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   467
          && GetBackoffEndFor (state) <= Simulator::Now () )
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   468
        {
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   469
          /**
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   470
           * This is the first dcf we find with an expired backoff and which
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   471
           * needs access to the medium. i.e., it has data to send.
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   472
           */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   473
          MY_DEBUG ("dcf " << k << " needs access. backoff expired. access granted. slots=" << state->GetBackoffSlots ());
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   474
          i++; // go to the next item in the list.
2103
ae7144199052 add debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2100
diff changeset
   475
          k++;
2130
741d0b976a78 we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2129
diff changeset
   476
          std::vector<DcfState *> internalCollisionStates;
2103
ae7144199052 add debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2100
diff changeset
   477
          for (States::const_iterator j = i; j != m_states.end (); j++, k++)
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   478
            {
2130
741d0b976a78 we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2129
diff changeset
   479
              DcfState *otherState = *j;
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   480
              if (otherState->IsAccessRequested ()
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   481
                  && GetBackoffEndFor (otherState) <= Simulator::Now ())
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   482
                {
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   483
                  MY_DEBUG ("dcf " << k << " needs access. backoff expired. internal collision. slots=" <<
2142
63c08450a4da avoid decrementing by too many backoff slots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2140
diff changeset
   484
                            otherState->GetBackoffSlots ());
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   485
                  /**
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   486
                   * all other dcfs with a lower priority whose backoff
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   487
                   * has expired and which needed access to the medium
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   488
                   * must be notified that we did get an internal collision.
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   489
                   */
2130
741d0b976a78 we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2129
diff changeset
   490
                  internalCollisionStates.push_back (otherState);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   491
                }
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   492
            }
2130
741d0b976a78 we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2129
diff changeset
   493
741d0b976a78 we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2129
diff changeset
   494
          /**
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   495
           * Now, we notify all of these changes in one go. It is necessary to
2130
741d0b976a78 we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2129
diff changeset
   496
           * perform first the calculations of which states are colliding and then
741d0b976a78 we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2129
diff changeset
   497
           * only apply the changes because applying the changes through notification
741d0b976a78 we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2129
diff changeset
   498
           * could change the global state of the manager, and, thus, could change
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   499
           * the result of the calculations.
2130
741d0b976a78 we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2129
diff changeset
   500
           */
741d0b976a78 we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2129
diff changeset
   501
          state->NotifyAccessGranted ();
741d0b976a78 we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2129
diff changeset
   502
          for (std::vector<DcfState *>::const_iterator k = internalCollisionStates.begin ();
741d0b976a78 we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2129
diff changeset
   503
               k != internalCollisionStates.end (); k++)
741d0b976a78 we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2129
diff changeset
   504
            {
741d0b976a78 we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2129
diff changeset
   505
              (*k)->NotifyInternalCollision ();
741d0b976a78 we need to accumulate a record of all changes before applying them in one go.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2129
diff changeset
   506
            }
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   507
          break;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   508
        }
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   509
      i++;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   510
    }
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   511
}
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   512
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   513
void
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   514
DcfManager::AccessTimeout (void)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   515
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   516
  NS_LOG_FUNCTION (this);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   517
  UpdateBackoff ();
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   518
  DoGrantAccess ();
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   519
  DoRestartAccessTimeoutIfNeeded ();
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   520
}
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   521
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   522
Time
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   523
DcfManager::GetAccessGrantStart (void) const
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   524
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   525
  NS_LOG_FUNCTION (this);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   526
  Time rxAccessStart;
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   527
  if (!m_rxing)
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   528
    {
5815
5629104d7747 Bug 674 - EIFS is not handled correctly in DcfManager::GetAccessGrantStart
Kirill Andreev <andreev@iitp.ru>
parents: 5189
diff changeset
   529
      rxAccessStart = m_lastRxEnd + m_sifs;
2099
de25c6d81572 initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2096
diff changeset
   530
      if (!m_lastRxReceivedOk)
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   531
        {
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   532
          rxAccessStart += m_eifsNoDifs;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   533
        }
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   534
    }
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   535
  else
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   536
    {
2105
e883a100109a get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2104
diff changeset
   537
      rxAccessStart = m_lastRxStart + m_lastRxDuration + m_sifs;
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   538
    }
2105
e883a100109a get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2104
diff changeset
   539
  Time busyAccessStart = m_lastBusyStart + m_lastBusyDuration + m_sifs;
e883a100109a get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2104
diff changeset
   540
  Time txAccessStart = m_lastTxStart + m_lastTxDuration + m_sifs;
e883a100109a get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2104
diff changeset
   541
  Time navAccessStart = m_lastNavStart + m_lastNavDuration + m_sifs;
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   542
  Time ackTimeoutAccessStart = m_lastAckTimeoutEnd + m_sifs;
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   543
  Time ctsTimeoutAccessStart = m_lastCtsTimeoutEnd + m_sifs;
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   544
  Time switchingAccessStart = m_lastSwitchingStart + m_lastSwitchingDuration + m_sifs;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   545
  Time accessGrantedStart = MostRecent (rxAccessStart,
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   546
                                        busyAccessStart,
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   547
                                        txAccessStart,
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   548
                                        navAccessStart,
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   549
                                        ackTimeoutAccessStart,
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   550
                                        ctsTimeoutAccessStart,
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   551
                                        switchingAccessStart
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   552
                                        );
2109
345491373a45 do not use GetBackoffSlots directly anymore
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2108
diff changeset
   553
  NS_LOG_INFO ("access grant start=" << accessGrantedStart <<
345491373a45 do not use GetBackoffSlots directly anymore
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2108
diff changeset
   554
               ", rx access start=" << rxAccessStart <<
345491373a45 do not use GetBackoffSlots directly anymore
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2108
diff changeset
   555
               ", busy access start=" << busyAccessStart <<
345491373a45 do not use GetBackoffSlots directly anymore
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2108
diff changeset
   556
               ", tx access start=" << txAccessStart <<
345491373a45 do not use GetBackoffSlots directly anymore
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2108
diff changeset
   557
               ", nav access start=" << navAccessStart);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   558
  return accessGrantedStart;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   559
}
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   560
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   561
Time
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   562
DcfManager::GetBackoffStartFor (DcfState *state)
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   563
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   564
  NS_LOG_FUNCTION (this << state);
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   565
  Time mostRecentEvent = MostRecent (state->GetBackoffStart (),
5816
d3fdc15b065f Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 5815
diff changeset
   566
                                     GetAccessGrantStart () + MicroSeconds (state->GetAifsn () * m_slotTimeUs));
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   567
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   568
  return mostRecentEvent;
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   569
}
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   570
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   571
Time
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   572
DcfManager::GetBackoffEndFor (DcfState *state)
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   573
{
5816
d3fdc15b065f Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 5815
diff changeset
   574
  return GetBackoffStartFor (state) + MicroSeconds (state->GetBackoffSlots () * m_slotTimeUs);
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   575
}
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   576
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   577
void
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   578
DcfManager::UpdateBackoff (void)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   579
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   580
  NS_LOG_FUNCTION (this);
2103
ae7144199052 add debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2100
diff changeset
   581
  uint32_t k = 0;
ae7144199052 add debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2100
diff changeset
   582
  for (States::const_iterator i = m_states.begin (); i != m_states.end (); i++, k++)
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   583
    {
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   584
      DcfState *state = *i;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   585
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   586
      Time backoffStart = GetBackoffStartFor (state);
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   587
      if (backoffStart <= Simulator::Now ())
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   588
        {
5816
d3fdc15b065f Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 5815
diff changeset
   589
          uint32_t nus = (Simulator::Now () - backoffStart).GetMicroSeconds ();
d3fdc15b065f Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 5815
diff changeset
   590
          uint32_t nIntSlots = nus / m_slotTimeUs;
2144
415546638869 The AIFSN has been taken into account in GetBackoffStartFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2142
diff changeset
   591
          uint32_t n = std::min (nIntSlots, state->GetBackoffSlots ());
415546638869 The AIFSN has been taken into account in GetBackoffStartFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2142
diff changeset
   592
          MY_DEBUG ("dcf " << k << " dec backoff slots=" << n);
5816
d3fdc15b065f Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 5815
diff changeset
   593
          Time backoffUpdateBound = backoffStart + MicroSeconds (n * m_slotTimeUs);
2144
415546638869 The AIFSN has been taken into account in GetBackoffStartFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2142
diff changeset
   594
          state->UpdateBackoffSlotsNow (n, backoffUpdateBound);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   595
        }
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   596
    }
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   597
}
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   598
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   599
void
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   600
DcfManager::DoRestartAccessTimeoutIfNeeded (void)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   601
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   602
  NS_LOG_FUNCTION (this);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   603
  /**
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   604
   * Is there a DcfState which needs to access the medium, and,
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   605
   * if there is one, how many slots for AIFS+backoff does it require ?
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   606
   */
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   607
  bool accessTimeoutNeeded = false;
2170
b24ae0343c4f MaxSeconds -> Simulator::GetMaximumSimulationTime
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   608
  Time expectedBackoffEnd = Simulator::GetMaximumSimulationTime ();
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   609
  for (States::const_iterator i = m_states.begin (); i != m_states.end (); i++)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   610
    {
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   611
      DcfState *state = *i;
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2144
diff changeset
   612
      if (state->IsAccessRequested ())
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   613
        {
2129
32f0e5c1a4d6 backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2128
diff changeset
   614
          Time tmp = GetBackoffEndFor (state);
32f0e5c1a4d6 backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2128
diff changeset
   615
          if (tmp > Simulator::Now ())
32f0e5c1a4d6 backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2128
diff changeset
   616
            {
32f0e5c1a4d6 backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2128
diff changeset
   617
              accessTimeoutNeeded = true;
32f0e5c1a4d6 backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2128
diff changeset
   618
              expectedBackoffEnd = std::min (expectedBackoffEnd, tmp);
32f0e5c1a4d6 backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2128
diff changeset
   619
            }
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   620
        }
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   621
    }
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   622
  if (accessTimeoutNeeded)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   623
    {
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   624
      MY_DEBUG ("expected backoff end=" << expectedBackoffEnd);
2129
32f0e5c1a4d6 backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2128
diff changeset
   625
      Time expectedBackoffDelay = expectedBackoffEnd - Simulator::Now ();
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   626
      if (m_accessTimeout.IsRunning ()
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   627
          && Simulator::GetDelayLeft (m_accessTimeout) > expectedBackoffDelay)
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   628
        {
2129
32f0e5c1a4d6 backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2128
diff changeset
   629
          m_accessTimeout.Cancel ();
32f0e5c1a4d6 backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2128
diff changeset
   630
        }
32f0e5c1a4d6 backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2128
diff changeset
   631
      if (m_accessTimeout.IsExpired ())
32f0e5c1a4d6 backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2128
diff changeset
   632
        {
32f0e5c1a4d6 backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2128
diff changeset
   633
          m_accessTimeout = Simulator::Schedule (expectedBackoffDelay,
32f0e5c1a4d6 backoff end time is never in the past.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2128
diff changeset
   634
                                                 &DcfManager::AccessTimeout, this);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   635
        }
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   636
    }
2140
acfd79fc8d65 debugging output is more verbose.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2130
diff changeset
   637
}
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   638
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   639
void
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   640
DcfManager::NotifyRxStartNow (Time duration)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   641
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   642
  NS_LOG_FUNCTION (this << duration);
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   643
  MY_DEBUG ("rx start for=" << duration);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   644
  UpdateBackoff ();
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   645
  m_lastRxStart = Simulator::Now ();
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   646
  m_lastRxDuration = duration;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   647
  m_rxing = true;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   648
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   649
void
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   650
DcfManager::NotifyRxEndOkNow (void)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   651
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   652
  NS_LOG_FUNCTION (this);
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   653
  MY_DEBUG ("rx end ok");
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   654
  m_lastRxEnd = Simulator::Now ();
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   655
  m_lastRxReceivedOk = true;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   656
  m_rxing = false;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   657
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   658
void
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   659
DcfManager::NotifyRxEndErrorNow (void)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   660
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   661
  NS_LOG_FUNCTION (this);
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   662
  MY_DEBUG ("rx end error");
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   663
  m_lastRxEnd = Simulator::Now ();
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   664
  m_lastRxReceivedOk = false;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   665
  m_rxing = false;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   666
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   667
void
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   668
DcfManager::NotifyTxStartNow (Time duration)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   669
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   670
  NS_LOG_FUNCTION (this << duration);
4598
9b07308116ed bug 595: PHY may start receive packet inside SIFS
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
   671
  if (m_rxing)
6063
d9163d8a18c5 Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5816
diff changeset
   672
    {
d9163d8a18c5 Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5816
diff changeset
   673
      //this may be caused only if PHY has started to receive a packet
d9163d8a18c5 Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5816
diff changeset
   674
      //inside SIFS, so, we check that lastRxStart was maximum a SIFS
d9163d8a18c5 Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5816
diff changeset
   675
      //ago
d9163d8a18c5 Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5816
diff changeset
   676
      NS_ASSERT (Simulator::Now () - m_lastRxStart <= m_sifs);
d9163d8a18c5 Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5816
diff changeset
   677
      m_lastRxEnd = Simulator::Now ();
d9163d8a18c5 Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5816
diff changeset
   678
      m_lastRxDuration = m_lastRxEnd - m_lastRxStart;
d9163d8a18c5 Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5816
diff changeset
   679
      m_lastRxReceivedOk = true;
d9163d8a18c5 Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5816
diff changeset
   680
      m_rxing = false;
d9163d8a18c5 Wifi:Fixes in coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5816
diff changeset
   681
    }
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   682
  MY_DEBUG ("tx start for " << duration);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   683
  UpdateBackoff ();
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   684
  m_lastTxStart = Simulator::Now ();
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   685
  m_lastTxDuration = duration;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   686
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   687
void
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
   688
DcfManager::NotifyMaybeCcaBusyStartNow (Time duration)
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   689
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   690
  NS_LOG_FUNCTION (this << duration);
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   691
  MY_DEBUG ("busy start for " << duration);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   692
  UpdateBackoff ();
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   693
  m_lastBusyStart = Simulator::Now ();
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   694
  m_lastBusyDuration = duration;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   695
}
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   696
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   697
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   698
void
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   699
DcfManager::NotifySwitchingStartNow (Time duration)
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   700
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   701
  NS_LOG_FUNCTION (this << duration);
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   702
  Time now = Simulator::Now ();
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   703
  NS_ASSERT (m_lastTxStart + m_lastTxDuration <= now);
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   704
  NS_ASSERT (m_lastSwitchingStart + m_lastSwitchingDuration <= now);
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   705
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   706
  if (m_rxing)
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   707
    {
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   708
      // channel switching during packet reception
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   709
      m_lastRxEnd = Simulator::Now ();
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   710
      m_lastRxDuration = m_lastRxEnd - m_lastRxStart;
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   711
      m_lastRxReceivedOk = true;
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   712
      m_rxing = false;
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   713
    }
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   714
  if (m_lastNavStart + m_lastNavDuration > now)
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   715
    {
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   716
      m_lastNavDuration = now - m_lastNavStart;
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   717
    }
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   718
  if (m_lastBusyStart + m_lastBusyDuration > now)
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   719
    {
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   720
      m_lastBusyDuration = now - m_lastBusyStart;
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   721
    }
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   722
  if (m_lastAckTimeoutEnd > now)
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   723
    {
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   724
      m_lastAckTimeoutEnd = now;
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   725
    }
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   726
  if (m_lastCtsTimeoutEnd > now)
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   727
    {
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   728
      m_lastCtsTimeoutEnd = now;
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   729
    }
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   730
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   731
  // Cancel timeout
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   732
  if (m_accessTimeout.IsRunning ())
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   733
    {
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   734
      m_accessTimeout.Cancel ();
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   735
    }
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   736
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   737
  // Reset backoffs
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   738
  for (States::iterator i = m_states.begin (); i != m_states.end (); i++)
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   739
    {
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   740
      DcfState *state = *i;
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   741
      uint32_t remainingSlots = state->GetBackoffSlots ();
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   742
      if (remainingSlots > 0)
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   743
        {
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   744
          state->UpdateBackoffSlotsNow (remainingSlots, now);
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   745
          NS_ASSERT (state->GetBackoffSlots () == 0);
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   746
        }
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   747
      state->ResetCw ();
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   748
      state->m_accessRequested = false;
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   749
      state->NotifyChannelSwitching ();
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   750
    }
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   751
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   752
  MY_DEBUG ("switching start for " << duration);
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   753
  m_lastSwitchingStart = Simulator::Now ();
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   754
  m_lastSwitchingDuration = duration;
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   755
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   756
}
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5133
diff changeset
   757
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   758
void
10883
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   759
DcfManager::NotifySleepNow (void)
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   760
{
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   761
  NS_LOG_FUNCTION (this);
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   762
  m_sleeping = true;
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   763
  // Cancel timeout
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   764
  if (m_accessTimeout.IsRunning ())
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   765
    {
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   766
      m_accessTimeout.Cancel ();
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   767
    }
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   768
}
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   769
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   770
void
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   771
DcfManager::NotifyWakeupNow (void)
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   772
{
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   773
  NS_LOG_FUNCTION (this);
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   774
  m_sleeping = false;
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   775
  // Reset backoffs
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   776
  for (States::iterator i = m_states.begin (); i != m_states.end (); i++)
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   777
    {
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   778
      DcfState *state = *i;
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   779
      uint32_t remainingSlots = state->GetBackoffSlots ();
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   780
      if (remainingSlots > 0)
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   781
        {
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   782
          state->UpdateBackoffSlotsNow (remainingSlots, Simulator::Now ());
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   783
          NS_ASSERT (state->GetBackoffSlots () == 0);
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   784
        }
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   785
      state->ResetCw ();
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   786
      state->m_accessRequested = false;
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   787
    }
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   788
}
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   789
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10580
diff changeset
   790
void
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   791
DcfManager::NotifyNavResetNow (Time duration)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   792
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   793
  NS_LOG_FUNCTION (this << duration);
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   794
  MY_DEBUG ("nav reset for=" << duration);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   795
  UpdateBackoff ();
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   796
  m_lastNavStart = Simulator::Now ();
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   797
  m_lastNavDuration = duration;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   798
  UpdateBackoff ();
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   799
  /**
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   800
   * If the nav reset indicates an end-of-nav which is earlier
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   801
   * than the previous end-of-nav, the expected end of backoff
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   802
   * might be later than previously thought so, we might need
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   803
   * to restart a new access timeout.
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   804
   */
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   805
  DoRestartAccessTimeoutIfNeeded ();
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   806
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   807
void
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   808
DcfManager::NotifyNavStartNow (Time duration)
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   809
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   810
  NS_LOG_FUNCTION (this << duration);
10211
1af765ed27c8 Bug 1011 - assert failed. file=../src/devices/wifi/dcf-manager.cc
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10200
diff changeset
   811
  NS_ASSERT (m_lastNavStart <= Simulator::Now ());
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   812
  MY_DEBUG ("nav start for=" << duration);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   813
  UpdateBackoff ();
2111
54617d2770c8 handle NAV correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2109
diff changeset
   814
  Time newNavEnd = Simulator::Now () + duration;
54617d2770c8 handle NAV correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2109
diff changeset
   815
  Time lastNavEnd = m_lastNavStart + m_lastNavDuration;
54617d2770c8 handle NAV correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2109
diff changeset
   816
  if (newNavEnd > lastNavEnd)
54617d2770c8 handle NAV correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2109
diff changeset
   817
    {
54617d2770c8 handle NAV correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2109
diff changeset
   818
      m_lastNavStart = Simulator::Now ();
54617d2770c8 handle NAV correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2109
diff changeset
   819
      m_lastNavDuration = duration;
54617d2770c8 handle NAV correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2109
diff changeset
   820
    }
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   821
}
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   822
void
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   823
DcfManager::NotifyAckTimeoutStartNow (Time duration)
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   824
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   825
  NS_LOG_FUNCTION (this << duration);
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7061
diff changeset
   826
  NS_ASSERT (m_lastAckTimeoutEnd < Simulator::Now ());
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   827
  m_lastAckTimeoutEnd = Simulator::Now () + duration;
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   828
}
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   829
void
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   830
DcfManager::NotifyAckTimeoutResetNow ()
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   831
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   832
  NS_LOG_FUNCTION (this);
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   833
  m_lastAckTimeoutEnd = Simulator::Now ();
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   834
  DoRestartAccessTimeoutIfNeeded ();
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   835
}
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   836
void
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   837
DcfManager::NotifyCtsTimeoutStartNow (Time duration)
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   838
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   839
  NS_LOG_FUNCTION (this << duration);
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   840
  m_lastCtsTimeoutEnd = Simulator::Now () + duration;
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   841
}
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   842
void
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   843
DcfManager::NotifyCtsTimeoutResetNow ()
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   844
{
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 9063
diff changeset
   845
  NS_LOG_FUNCTION (this);
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   846
  m_lastCtsTimeoutEnd = Simulator::Now ();
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   847
  DoRestartAccessTimeoutIfNeeded ();
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   848
}
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   849
} // namespace ns3