src/wifi/model/dcf-manager.h
author Tom Henderson <tomh@tomh.org>
Mon, 28 Sep 2015 20:27:25 -0700
changeset 11676 05ea1489e509
parent 11450 9f4ae69f12b7
permissions -rw-r--r--
bug 2184: Integer overflow in MacLow
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; -*- */
4511
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
     2
/*
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
     3
 * Copyright (c) 2005,2006 INRIA
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
     4
 *
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
     7
 * published by the Free Software Foundation;
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
     8
 *
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
    12
 * GNU General Public License for more details.
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
    13
 *
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
    14
 * You should have received a copy of the GNU General Public License
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
    15
 * along with this program; if not, write to the Free Software
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
    17
 *
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
    19
 */
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
    20
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
    21
#ifndef DCF_MANAGER_H
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
    22
#define DCF_MANAGER_H
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    23
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    24
#include "ns3/nstime.h"
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    25
#include "ns3/event-id.h"
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    26
#include <vector>
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    27
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    28
namespace ns3 {
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    29
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
    30
class WifiPhy;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
    31
class WifiMac;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
    32
class MacLow;
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    33
class PhyListener;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    34
class LowDcfListener;
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
    35
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    36
/**
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    37
 * \brief keep track of the state needed for a single DCF
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    38
 * function.
7139
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    39
 * \ingroup wifi
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    40
 *
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    41
 * Multiple instances of a DcfState can be registered in a single
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    42
 * DcfManager to implement 802.11e-style relative QoS.
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    43
 * DcfState::SetAifsn and DcfState::SetCwBounds allow the user to
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    44
 * control the relative QoS differentiation.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    45
 */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    46
class DcfState
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    47
{
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    48
public:
2100
1b8cc486edd9 initialize more state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2099
diff changeset
    49
  DcfState ();
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    50
  virtual ~DcfState ();
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    51
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    52
  /**
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    53
   * \param aifsn the number of slots which make up an AIFS for a specific DCF.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    54
   *        a DIFS corresponds to an AIFSN = 2.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    55
   *
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    56
   * Calling this method after DcfManager::Add has been called is not recommended.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    57
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    58
  void SetAifsn (uint32_t aifsn);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    59
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    60
   * Set the minimum congestion window size.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    61
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    62
   * \param minCw the minimum congestion window size
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    63
   */
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
    64
  void SetCwMin (uint32_t minCw);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    65
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    66
   * Set the maximum congestion window size.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    67
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    68
   * \param maxCw the maximum congestion window size
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    69
   */
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
    70
  void SetCwMax (uint32_t maxCw);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    71
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    72
   * Return the number of slots that make up an AIFS.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    73
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    74
   * \return the number of slots that make up an AIFS
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    75
   */
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
    76
  uint32_t GetAifsn (void) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    77
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    78
   * Return the minimum congestion window size.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    79
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    80
   * \return the minimum congestion window size
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    81
   */
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
    82
  uint32_t GetCwMin (void) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    83
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    84
   * Return the maximum congestion window size.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    85
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    86
   * \return the maximum congestion window size
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    87
   */
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
    88
  uint32_t GetCwMax (void) const;
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    89
  /**
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    90
   * Update the value of the CW variable to take into account
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    91
   * a transmission success or a transmission abort (stop transmission
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    92
   * of a packet after the maximum number of retransmissions has been
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    93
   * reached). By default, this resets the CW variable to minCW.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    94
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
    95
  void ResetCw (void);
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    96
  /**
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    97
   * Update the value of the CW variable to take into account
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    98
   * a transmission failure. By default, this triggers a doubling
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
    99
   * of CW (capped by maxCW).
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   100
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   101
  void UpdateFailedCw (void);
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   102
  /**
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   103
   * \param nSlots the number of slots of the backoff.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   104
   *
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   105
   * Start a backoff by initializing the backoff counter to the number of
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   106
   * slots specified.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   107
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   108
  void StartBackoffNow (uint32_t nSlots);
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   109
  /**
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   110
   * \returns the current value of the CW variable. The initial value is
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   111
   * minCW.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   112
   */
2138
0e57bc8e2f94 make the GetCw method public to allow DcaTxop to pick a random backoff duration
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2123
diff changeset
   113
  uint32_t GetCw (void) const;
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   114
  /**
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   115
   * \returns true if access has been requested for this DcfState and
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   116
   *          has not been granted already, false otherwise.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   117
   */
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2138
diff changeset
   118
  bool IsAccessRequested (void) const;
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   119
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   120
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   121
private:
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   122
  friend class DcfManager;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   123
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   124
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   125
   * Return the current number of backoff slots.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   126
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   127
   * \return the current number of backoff slots
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   128
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   129
  uint32_t GetBackoffSlots (void) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   130
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   131
   * Return the time when the backoff procedure started.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   132
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   133
   * \return the time when the backoff procedure started
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   134
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   135
  Time GetBackoffStart (void) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   136
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   137
   * Update backoff slots that nSlots has passed.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   138
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   139
   * \param nSlots
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   140
   * \param backoffUpdateBound
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   141
   */
2122
ee136bc4f214 keep track of the last time a backoff was updated.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2107
diff changeset
   142
  void UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   143
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   144
   * Notify that access request has been received.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   145
   */
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2138
diff changeset
   146
  void NotifyAccessRequested (void);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   147
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   148
   * Notify that access has been granted.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   149
   */
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2138
diff changeset
   150
  void NotifyAccessGranted (void);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   151
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   152
   * Notify that collision has occurred.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   153
   */
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2138
diff changeset
   154
  void NotifyCollision (void);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   155
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   156
   * Notify that internal collision has occurred.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   157
   */
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2138
diff changeset
   158
  void NotifyInternalCollision (void);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   159
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   160
   * Notify that the device is switching channel.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   161
   */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   162
  void NotifyChannelSwitching (void);
11159
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   163
  /**
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   164
   * Notify that the device has started to sleep.
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   165
   */
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   166
  void NotifySleep (void);
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   167
  /**
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   168
   * Notify that the device has started to wake up
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   169
   */
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   170
  void NotifyWakeUp (void);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   171
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   172
  /**
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   173
   * Called by DcfManager to notify a DcfState subclass
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   174
   * that access to the medium is granted and can
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   175
   * start immediately.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   176
   */
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2138
diff changeset
   177
  virtual void DoNotifyAccessGranted (void) = 0;
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   178
  /**
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   179
   * Called by DcfManager to notify a DcfState subclass
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   180
   * that an 'internal' collision occured, that is, that
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   181
   * the backoff timer of a higher priority DcfState expired
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   182
   * at the same time and that access was granted to this
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   183
   * higher priority DcfState.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   184
   *
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   185
   * The subclass is expected to start a new backoff by
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   186
   * calling DcfState::StartBackoffNow and DcfManager::RequestAccess
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   187
   * is access is still needed.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   188
   */
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2138
diff changeset
   189
  virtual void DoNotifyInternalCollision (void) = 0;
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   190
  /**
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   191
   * Called by DcfManager to notify a DcfState subclass
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   192
   * that a normal collision occured, that is, that
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   193
   * the medium was busy when access was requested.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   194
   *
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   195
   * The subclass is expected to start a new backoff by
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   196
   * calling DcfState::StartBackoffNow and DcfManager::RequestAccess
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   197
   * is access is still needed.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   198
   */
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2138
diff changeset
   199
  virtual void DoNotifyCollision (void) = 0;
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   200
  /**
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   201
  * Called by DcfManager to notify a DcfState subclass
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   202
  * that a channel switching occured.
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   203
  *
11159
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   204
  * The subclass is expected to flush the queue of packets.
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   205
  */
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   206
  virtual void DoNotifyChannelSwitching (void) = 0;
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   207
  /**
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   208
  * Called by DcfManager to notify a DcfState subclass that the device has
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   209
  * begun to sleep.
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   210
  *
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   211
  * The subclass is expected to re-insert the pending packet into the queue
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   212
  */
11159
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   213
  virtual void DoNotifySleep (void) = 0;
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   214
  /**
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   215
  * Called by DcfManager to notify a DcfState subclass that the device
11159
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   216
  * has begun to wake up.
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   217
  *
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   218
  * The subclass is expected to restart a new backoff by
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   219
  * calling DcfState::StartBackoffNow and DcfManager::RequestAccess
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   220
  * is access is still needed.
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   221
  */
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   222
  virtual void DoNotifyWakeUp (void) = 0;
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   223
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   224
  uint32_t m_aifsn;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   225
  uint32_t m_backoffSlots;
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   226
  //the backoffStart variable is used to keep track of the
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   227
  //time at which a backoff was started or the time at which
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   228
  //the backoff counter was last updated.
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   229
  Time m_backoffStart;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   230
  uint32_t m_cwMin;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   231
  uint32_t m_cwMax;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   232
  uint32_t m_cw;
2145
8f3c8ef34b0a use a simple request/grant scheme for dcf accesses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2138
diff changeset
   233
  bool m_accessRequested;
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   234
};
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   235
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   236
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   237
/**
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   238
 * \brief Manage a set of ns3::DcfState
7139
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
   239
 * \ingroup wifi
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   240
 *
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   241
 * Handle a set of independent ns3::DcfState, each of which represents
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   242
 * a single DCF within a MAC stack. Each ns3::DcfState has a priority
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   243
 * implicitely associated with it (the priority is determined when the
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   244
 * ns3::DcfState is added to the DcfManager: the first DcfState to be
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   245
 * added gets the highest priority, the second, the second highest
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   246
 * priority, and so on.) which is used to handle "internal" collisions.
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   247
 * i.e., when two local DcfState are expected to get access to the
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   248
 * medium at the same time, the highest priority local DcfState wins
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   249
 * access to the medium and the other DcfState suffers a "internal"
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   250
 * collision.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   251
 */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   252
class DcfManager
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   253
{
2096
4e282663666c add missing method implementations
mlacage@thira.inria.fr
parents: 2095
diff changeset
   254
public:
2099
de25c6d81572 initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2096
diff changeset
   255
  DcfManager ();
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
   256
  ~DcfManager ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
   257
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   258
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   259
   * Set up listener for Phy events.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   260
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   261
   * \param phy
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   262
   */
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
   263
  void SetupPhyListener (Ptr<WifiPhy> phy);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   264
  /**
11159
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   265
   * Remove current registered listener for Phy events.
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   266
   *
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   267
   * \param phy
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   268
   */
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   269
  void RemovePhyListener (Ptr<WifiPhy> phy);
b744c32b69bc patch to support IEEE 1609.4 MAC extension in wave module
Junling Bu <linlinjavaer@gmail.com>
parents: 10883
diff changeset
   270
  /**
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   271
   * Set up listener for MacLow events.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   272
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   273
   * \param low
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   274
   */
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
   275
  void SetupLowListener (Ptr<MacLow> low);
2099
de25c6d81572 initialize state variables
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2096
diff changeset
   276
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   277
  /**
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   278
   * \param slotTime the duration of a slot.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   279
   *
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   280
   * It is a bad idea to call this method after RequestAccess or
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   281
   * one of the Notify methods has been invoked.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   282
   */
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
   283
  void SetSlot (Time slotTime);
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   284
  /**
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   285
   * \param sifs the duration of a SIFS.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   286
   *
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   287
   * It is a bad idea to call this method after RequestAccess or
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   288
   * one of the Notify methods has been invoked.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   289
   */
2105
e883a100109a get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2100
diff changeset
   290
  void SetSifs (Time sifs);
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   291
  /**
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
   292
   * \param eifsNoDifs the duration of a EIFS minus the duration of DIFS.
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   293
   *
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   294
   * It is a bad idea to call this method after RequestAccess or
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   295
   * one of the Notify methods has been invoked.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   296
   */
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
   297
  void SetEifsNoDifs (Time eifsNoDifs);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   298
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   299
  /**
4460
d7ad6e210086 move GetEifsNoDifs to DcfManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3905
diff changeset
   300
   * \return value set previously using SetEifsNoDifs.
d7ad6e210086 move GetEifsNoDifs to DcfManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3905
diff changeset
   301
   */
d7ad6e210086 move GetEifsNoDifs to DcfManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3905
diff changeset
   302
  Time GetEifsNoDifs () const;
d7ad6e210086 move GetEifsNoDifs to DcfManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3905
diff changeset
   303
d7ad6e210086 move GetEifsNoDifs to DcfManager
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3905
diff changeset
   304
  /**
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   305
   * \param dcf a new DcfState.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   306
   *
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   307
   * The DcfManager does not take ownership of this pointer so, the callee
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   308
   * must make sure that the DcfState pointer will stay valid as long
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   309
   * as the DcfManager is valid. Note that the order in which DcfState
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   310
   * objects are added to a DcfManager matters: the first DcfState added
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   311
   * has the highest priority, the second DcfState added, has the second
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   312
   * highest priority, etc.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   313
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   314
  void Add (DcfState *dcf);
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   315
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   316
  /**
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   317
   * \param state a DcfState
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   318
   *
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   319
   * Notify the DcfManager that a specific DcfState needs access to the
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   320
   * medium. The DcfManager is then responsible for starting an access
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   321
   * timer and, invoking DcfState::DoNotifyAccessGranted when the access
2282
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   322
   * is granted if it ever gets granted.
6320b3a7f382 add some doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2145
diff changeset
   323
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   324
  void RequestAccess (DcfState *state);
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   325
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   326
  /**
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   327
   * \param duration expected duration of reception
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   328
   *
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   329
   * Notify the DCF that a packet reception started
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   330
   * for the expected duration.
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   331
   */
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   332
  void NotifyRxStartNow (Time duration);
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   333
  /**
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   334
   * Notify the DCF that a packet reception was just
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   335
   * completed successfully.
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   336
   */
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   337
  void NotifyRxEndOkNow (void);
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   338
  /**
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   339
   * Notify the DCF that a packet reception was just
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   340
   * completed unsuccessfully.
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   341
   */
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   342
  void NotifyRxEndErrorNow (void);
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   343
  /**
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   344
   * \param duration expected duration of transmission
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   345
   *
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   346
   * Notify the DCF that a packet transmission was
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   347
   * just started and is expected to last for the specified
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   348
   * duration.
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   349
   */
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   350
  void NotifyTxStartNow (Time duration);
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   351
  /**
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   352
   * \param duration expected duration of cca busy period
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   353
   *
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   354
   * Notify the DCF that a CCA busy period has just started.
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   355
   */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
   356
  void NotifyMaybeCcaBusyStartNow (Time duration);
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   357
  /**
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5053
diff changeset
   358
   * \param duration expected duration of channel switching period
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5053
diff changeset
   359
   *
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5053
diff changeset
   360
   * Notify the DCF that a channel switching period has just started.
6273
8d70de29d514 spell check, mostly in comments.
Andrey Mazo <mazo@iitp.ru>
parents: 5816
diff changeset
   361
   * During switching state, new packets can be enqueued in DcaTxop/EdcaTxop
5192
fb3d57fd97e4 Doxy doc for Wifi channel switching
Ramon Bauza
parents: 5189
diff changeset
   362
   * but they won't access to the medium until the end of the channel switching.
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5053
diff changeset
   363
   */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   364
  void NotifySwitchingStartNow (Time duration);
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5053
diff changeset
   365
  /**
10883
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10483
diff changeset
   366
   * Notify the DCF that the device has been put in sleep mode.
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10483
diff changeset
   367
   */
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10483
diff changeset
   368
  void NotifySleepNow (void);
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10483
diff changeset
   369
  /**
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10483
diff changeset
   370
   * Notify the DCF that the device has been resumed from sleep mode.
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10483
diff changeset
   371
   */
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10483
diff changeset
   372
  void NotifyWakeupNow (void);
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10483
diff changeset
   373
  /**
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   374
   * \param duration the value of the received NAV.
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   375
   *
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   376
   * Called at end of rx
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   377
   */
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   378
  void NotifyNavResetNow (Time duration);
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   379
  /**
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   380
   * \param duration the value of the received NAV.
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   381
   *
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   382
   * Called at end of rx
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   383
   */
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   384
  void NotifyNavStartNow (Time duration);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   385
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   386
   * Notify that ACK timer has started for the given duration.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   387
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   388
   * \param duration
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   389
   */
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
   390
  void NotifyAckTimeoutStartNow (Time duration);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   391
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   392
   * Notify that ACK timer has resetted.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   393
   */
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
   394
  void NotifyAckTimeoutResetNow ();
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   395
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   396
   * Notify that CTS timer has started for the given duration.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   397
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   398
   * \param duration
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   399
   */
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
   400
  void NotifyCtsTimeoutStartNow (Time duration);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   401
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   402
   * Notify that CTS timer has resetted.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   403
   */
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
   404
  void NotifyCtsTimeoutResetNow ();
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   405
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   406
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   407
private:
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   408
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   409
   * Update backoff slots for all DcfStates.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   410
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   411
  void UpdateBackoff (void);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   412
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   413
   * Return the most recent time.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   414
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   415
   * \param a
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   416
   * \param b
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   417
   *
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   418
   * \return the most recent time
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   419
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   420
  Time MostRecent (Time a, Time b) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   421
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   422
   * Return the most recent time.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   423
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   424
   * \param a
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   425
   * \param b
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   426
   * \param c
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   427
   *
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   428
   * \return the most recent time
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   429
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   430
  Time MostRecent (Time a, Time b, Time c) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   431
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   432
   * Return the most recent time.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   433
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   434
   * \param a
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   435
   * \param b
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   436
   * \param c
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   437
   * \param d
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   438
   *
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   439
   * \return the most recent time
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   440
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   441
  Time MostRecent (Time a, Time b, Time c, Time d) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   442
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   443
   * Return the most recent time.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   444
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   445
   * \param a
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   446
   * \param b
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   447
   * \param c
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   448
   * \param d
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   449
   * \param e
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   450
   * \param f
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   451
   *
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   452
   * \return the most recent time
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   453
   */
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
   454
  Time MostRecent (Time a, Time b, Time c, Time d, Time e, Time f) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   455
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   456
   * Return the most recent time.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   457
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   458
   * \param a
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   459
   * \param b
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   460
   * \param c
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   461
   * \param d
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   462
   * \param e
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   463
   * \param f
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   464
   * \param g
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   465
   *
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   466
   * \return the most recent time
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   467
   */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   468
  Time MostRecent (Time a, Time b, Time c, Time d, Time e, Time f, Time g) const;
2095
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
   * Access will never be granted to the medium _before_
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   471
   * the time returned by this method.
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   472
   *
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   473
   * \returns the absolute time at which access could start to be granted
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   474
   */
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   475
  Time GetAccessGrantStart (void) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   476
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   477
   * Return the time when the backoff procedure
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   478
   * started for the given DcfState.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   479
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   480
   * \param state
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   481
   *
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   482
   * \return the time when the backoff procedure started
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   483
   */
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   484
  Time GetBackoffStartFor (DcfState *state);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   485
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   486
   * Return the time when the backoff procedure
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   487
   * ended (or will ended) for the given DcfState.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   488
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   489
   * \param state
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   490
   *
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   491
   * \return the time when the backoff procedure ended (or will ended)
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   492
   */
2107
9adb9e6d7bc7 improve debugging output. introduce GetBackoffStartFor and GetBackoffEndFor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2105
diff changeset
   493
  Time GetBackoffEndFor (DcfState *state);
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   494
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   495
  void DoRestartAccessTimeoutIfNeeded (void);
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   496
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   497
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   498
   * Called when access timeout should occur
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   499
   * (e.g. backoff procedure expired).
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   500
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   501
  void AccessTimeout (void);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   502
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   503
   * Grant access to DCF
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   504
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   505
  void DoGrantAccess (void);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   506
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   507
   * Check if the device is busy sending or receiving,
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   508
   * or NAV busy.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   509
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   510
   * \return true if the device is busy,
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   511
   *         false otherwise
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   512
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   513
  bool IsBusy (void) const;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   514
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   515
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   516
   * typedef for a vector of DcfStates
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
   517
   */
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   518
  typedef std::vector<DcfState *> States;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   519
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   520
  States m_states;
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
   521
  Time m_lastAckTimeoutEnd;
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4460
diff changeset
   522
  Time m_lastCtsTimeoutEnd;
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   523
  Time m_lastNavStart;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   524
  Time m_lastNavDuration;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   525
  Time m_lastRxStart;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   526
  Time m_lastRxDuration;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   527
  bool m_lastRxReceivedOk;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   528
  Time m_lastRxEnd;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   529
  Time m_lastTxStart;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   530
  Time m_lastTxDuration;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   531
  Time m_lastBusyStart;
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   532
  Time m_lastBusyDuration;
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   533
  Time m_lastSwitchingStart;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   534
  Time m_lastSwitchingDuration;
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   535
  bool m_rxing;
10883
d919e7194e23 add support for a Wifi sleep mode
Stefano Avallone <stefano.avallone@unina.it>
parents: 10483
diff changeset
   536
  bool m_sleeping;
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2282
diff changeset
   537
  Time m_eifsNoDifs;
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   538
  EventId m_accessTimeout;
5816
d3fdc15b065f Bug 695 - DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 5192
diff changeset
   539
  uint32_t m_slotTimeUs;
2105
e883a100109a get rid of MacParameters from DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2100
diff changeset
   540
  Time m_sifs;
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   541
  PhyListener* m_phyListener;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   542
  LowDcfListener* m_lowListener;
2095
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   543
};
f6ec39e97e4b a new (wholy untested) Dcf implementation
mlacage@thira.inria.fr
parents:
diff changeset
   544
11450
9f4ae69f12b7 cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 11159
diff changeset
   545
} //namespace ns3
4511
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
   546
d373c2f06a29 bug 581: error in double include of dcf-manager.h
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4509
diff changeset
   547
#endif /* DCF_MANAGER_H */