src/devices/wifi/dca-txop.cc
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 17 Apr 2008 13:42:25 -0700
changeset 2965 4b28e9740e3b
parent 2784 49006cbbfac7
child 2972 d76553495b91
permissions -rw-r--r--
get rid of Attribute class. Use AttributeValue subclasses directly.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2005 INRIA
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 */
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
1974
0d6b3bead74a replace cassert by ns3/assert.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1969
diff changeset
    21
#include "ns3/assert.h"
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
#include "ns3/packet.h"
1979
d535a38b7fc4 convert TRACE to NS_LOG
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1974
diff changeset
    23
#include "ns3/log.h"
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    24
#include "ns3/simulator.h"
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    25
#include "ns3/node.h"
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    26
#include "ns3/uinteger.h"
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
#include "dca-txop.h"
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    29
#include "dcf-manager.h"
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
#include "mac-low.h"
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
#include "wifi-mac-queue.h"
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
#include "mac-tx-middle.h"
2268
0e57ac711220 introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2165
diff changeset
    33
#include "wifi-mac-trailer.h"
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    34
#include "wifi-mac.h"
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    35
#include "random-stream.h"
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
1979
d535a38b7fc4 convert TRACE to NS_LOG
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1974
diff changeset
    37
NS_LOG_COMPONENT_DEFINE ("DcaTxop");
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    39
#define MY_DEBUG(x) \
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    40
  NS_LOG_DEBUG (Simulator::Now () << " " << m_low->GetMac ()->GetAddress () << " " << x)
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    41
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
namespace ns3 {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    45
class DcaTxop::Dcf : public DcfState
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    46
{
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
public:
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    48
  Dcf (DcaTxop *txop)
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    49
    : m_txop (txop)
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    50
  {}
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    51
private:
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    52
  virtual void DoNotifyAccessGranted (void) {
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    53
    m_txop->NotifyAccessGranted ();
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
  }
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    55
  virtual void DoNotifyInternalCollision (void) {
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    56
    m_txop->NotifyInternalCollision ();
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    57
  }
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    58
  virtual void DoNotifyCollision (void) {
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
    59
    m_txop->NotifyCollision ();
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    60
  }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    61
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    62
  DcaTxop *m_txop;
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    63
};
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    64
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    65
class DcaTxop::TransmissionListener : public MacLowTransmissionListener {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    66
public:
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    67
  TransmissionListener (DcaTxop *txop)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    68
    : MacLowTransmissionListener (),
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    69
      m_txop (txop) {}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
      
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    71
  virtual ~TransmissionListener () {}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    72
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    73
  virtual void GotCts (double snr, WifiMode txMode) {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
    m_txop->GotCts (snr, txMode);
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    75
  }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
  virtual void MissedCts (void) {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    77
    m_txop->MissedCts ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    78
  }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    79
  virtual void GotAck (double snr, WifiMode txMode) {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    80
    m_txop->GotAck (snr, txMode);
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    81
  }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    82
  virtual void MissedAck (void) {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    83
    m_txop->MissedAck ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    84
  }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    85
  virtual void StartNext (void) {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    86
    m_txop->StartNext ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    87
  }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    88
  virtual void Cancel (void) {
2091
9ef23a8f0980 handle cancel events
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2087
diff changeset
    89
    m_txop->Cancel ();
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    90
  }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    91
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    92
private:
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    93
  DcaTxop *m_txop;
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    94
};
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    95
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    96
TypeId 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    97
DcaTxop::GetTypeId (void)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    98
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
    99
  static TypeId tid = TypeId ("DcaTxop")
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   100
    .SetParent<Object> ()
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   101
    .AddConstructor<DcaTxop> ()
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   102
    .AddAttribute ("MinCw", "XXX",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2784
diff changeset
   103
                   UintegerValue (15),
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   104
                   MakeUintegerAccessor (&DcaTxop::SetMinCw,
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   105
                                         &DcaTxop::GetMinCw),
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   106
                   MakeUintegerChecker<uint32_t> ())
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   107
    .AddAttribute ("MaxCw", "XXX",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2784
diff changeset
   108
                   UintegerValue (1023),
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   109
                   MakeUintegerAccessor (&DcaTxop::SetMaxCw,
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   110
                                         &DcaTxop::GetMaxCw),
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   111
                   MakeUintegerChecker<uint32_t> ())
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   112
    .AddAttribute ("Aifsn", "XXX",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2784
diff changeset
   113
                   UintegerValue (2),
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   114
                   MakeUintegerAccessor (&DcaTxop::SetAifsn,
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   115
                                         &DcaTxop::GetAifsn),
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   116
                   MakeUintegerChecker<uint32_t> ())
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   117
    ;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   118
  return tid;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   119
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   120
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   121
DcaTxop::DcaTxop ()
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   122
  : m_manager (0),
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   123
    m_currentPacket (0)
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   124
{
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   125
  m_transmissionListener = new DcaTxop::TransmissionListener (this);
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   126
  m_dcf = new DcaTxop::Dcf (this);
2592
3ebf97150166 get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2530
diff changeset
   127
  m_queue = CreateObject<WifiMacQueue> ();
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   128
  m_rng = new RealRandomStream ();
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   129
  m_txMiddle = new MacTxMiddle ();
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   130
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   131
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   132
DcaTxop::~DcaTxop ()
2530
05f9cec44621 avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
   133
{}
05f9cec44621 avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
   134
05f9cec44621 avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
   135
void
05f9cec44621 avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
   136
DcaTxop::DoDispose (void)
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   137
{
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   138
  delete m_transmissionListener;
2001
00f8a2a9cd89 get rid of the dcf
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1979
diff changeset
   139
  delete m_dcf;
2165
6acd0dca66f9 avoid memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2161
diff changeset
   140
  delete m_rng;
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   141
  delete m_txMiddle;
2087
2914851fd238 zeroify the members after deleting them to improve debugging.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2054
diff changeset
   142
  m_transmissionListener = 0;
2914851fd238 zeroify the members after deleting them to improve debugging.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2054
diff changeset
   143
  m_dcf = 0;
2165
6acd0dca66f9 avoid memory leak
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2161
diff changeset
   144
  m_rng = 0;
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   145
  m_txMiddle = 0;
2530
05f9cec44621 avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
   146
  m_queue = 0;
05f9cec44621 avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
   147
  m_low = 0;
05f9cec44621 avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
   148
  m_stationManager = 0;
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   149
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   150
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   151
void
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   152
DcaTxop::SetManager (DcfManager *manager)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   153
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   154
  m_manager = manager;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   155
  m_manager->Add (m_dcf);
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   156
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   157
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   158
void 
2350
0b54480c4fd1 Hook trace sources into the trace system. Add WifiTrace to give a 'simple' API to tracing wifi-specific sources.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2349
diff changeset
   159
DcaTxop::SetLow (Ptr<MacLow> low)
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   160
{
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   161
  m_low = low;
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   162
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   163
void 
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   164
DcaTxop::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> remoteManager)
2268
0e57ac711220 introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2165
diff changeset
   165
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   166
  m_stationManager = remoteManager;
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   167
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   168
void 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   169
DcaTxop::SetTxOkCallback (TxOk callback)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   170
{
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   171
  m_txOkCallback = callback;
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   172
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   173
void 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   174
DcaTxop::SetTxFailedCallback (TxFailed callback)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   175
{
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   176
  m_txFailedCallback = callback;
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   177
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   178
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   179
void 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   180
DcaTxop::SetMaxQueueSize (uint32_t size)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   181
{
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   182
  m_queue->SetMaxSize (size);
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   183
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   184
void 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   185
DcaTxop::SetMaxQueueDelay (Time delay)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   186
{
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   187
  m_queue->SetMaxDelay (delay);
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   188
}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   189
void 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   190
DcaTxop::SetMinCw (uint32_t minCw)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   191
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   192
  m_dcf->SetCwMin (minCw);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   193
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   194
void 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   195
DcaTxop::SetMaxCw (uint32_t maxCw)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   196
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   197
  m_dcf->SetCwMax (maxCw);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   198
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   199
void 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   200
DcaTxop::SetAifsn (uint32_t aifsn)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   201
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   202
  m_dcf->SetAifsn (aifsn);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   203
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   204
uint32_t 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   205
DcaTxop::GetMinCw (void) const
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   206
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   207
  return m_dcf->GetCwMin ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   208
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   209
uint32_t 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   210
DcaTxop::GetMaxCw (void) const
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   211
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   212
  return m_dcf->GetCwMax ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   213
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   214
uint32_t 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   215
DcaTxop::GetAifsn (void) const
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   216
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   217
  return m_dcf->GetAifsn ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   218
}
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   219
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   220
void 
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   221
DcaTxop::Queue (Ptr<const Packet> packet, WifiMacHeader const &hdr)
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   222
{
2268
0e57ac711220 introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2165
diff changeset
   223
  WifiMacTrailer fcs;
0e57ac711220 introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2165
diff changeset
   224
  uint32_t fullPacketSize = hdr.GetSerializedSize () + packet->GetSize () + fcs.GetSerializedSize ();
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   225
  WifiRemoteStation *station = GetStation (hdr.GetAddr1 ());
2268
0e57ac711220 introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2165
diff changeset
   226
  station->PrepareForQueue (packet, fullPacketSize);
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   227
  m_queue->Enqueue (packet, hdr);
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   228
  StartAccessIfNeeded ();
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   229
}
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   230
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   231
WifiRemoteStation *
2349
b1df486516a4 allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2270
diff changeset
   232
DcaTxop::GetStation (Mac48Address ad) const
b1df486516a4 allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2270
diff changeset
   233
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   234
  return m_stationManager->Lookup (ad);
2349
b1df486516a4 allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2270
diff changeset
   235
}
b1df486516a4 allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2270
diff changeset
   236
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   237
void
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   238
DcaTxop::RestartAccessIfNeeded (void)
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   239
{
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   240
  if ((m_currentPacket != 0 ||
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   241
       !m_queue->IsEmpty ()) &&
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   242
      !m_dcf->IsAccessRequested ())
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   243
    {
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   244
      m_manager->RequestAccess (m_dcf);
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   245
    }
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   246
}
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   247
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   248
void
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   249
DcaTxop::StartAccessIfNeeded (void)
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   250
{
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   251
  if (m_currentPacket == 0 &&
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   252
      !m_queue->IsEmpty () &&
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   253
      !m_dcf->IsAccessRequested ())
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   254
    {
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   255
      m_manager->RequestAccess (m_dcf);
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   256
    }
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   257
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   258
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   259
2350
0b54480c4fd1 Hook trace sources into the trace system. Add WifiTrace to give a 'simple' API to tracing wifi-specific sources.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2349
diff changeset
   260
Ptr<MacLow>
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   261
DcaTxop::Low (void)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   262
{
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   263
  return m_low;
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   264
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   265
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   266
bool
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   267
DcaTxop::NeedRts (void)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   268
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   269
  WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ());
2349
b1df486516a4 allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2270
diff changeset
   270
  return station->NeedRts (m_currentPacket);
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   271
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   272
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   273
bool
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   274
DcaTxop::NeedRtsRetransmission (void)
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   275
{
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   276
  WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ());
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   277
  return station->NeedRtsRetransmission (m_currentPacket);
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   278
}
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   279
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   280
bool
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   281
DcaTxop::NeedDataRetransmission (void)
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   282
{
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   283
  WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ());
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   284
  return station->NeedDataRetransmission (m_currentPacket);
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   285
}
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   286
bool
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   287
DcaTxop::NeedFragmentation (void)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   288
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   289
  WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ());
2349
b1df486516a4 allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2270
diff changeset
   290
  return station->NeedFragmentation (m_currentPacket);
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   291
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   292
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   293
uint32_t
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   294
DcaTxop::GetNFragments (void)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   295
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   296
  WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ());
2349
b1df486516a4 allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2270
diff changeset
   297
  return station->GetNFragments (m_currentPacket);
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   298
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   299
void
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   300
DcaTxop::NextFragment (void)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   301
{
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   302
  m_fragmentNumber++;
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   303
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   304
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   305
uint32_t
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   306
DcaTxop::GetFragmentSize (void)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   307
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   308
  WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ());
2349
b1df486516a4 allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2270
diff changeset
   309
  return station->GetFragmentSize (m_currentPacket, m_fragmentNumber);
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   310
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   311
bool
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   312
DcaTxop::IsLastFragment (void) 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   313
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   314
  WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ());
2349
b1df486516a4 allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2270
diff changeset
   315
  return station->IsLastFragment (m_currentPacket, m_fragmentNumber);
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   316
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   317
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   318
uint32_t
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   319
DcaTxop::GetNextFragmentSize (void) 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   320
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   321
  WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ());
2349
b1df486516a4 allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2270
diff changeset
   322
  return station->GetFragmentSize (m_currentPacket, m_fragmentNumber + 1);
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   323
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   324
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   325
Ptr<Packet>
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   326
DcaTxop::GetFragmentPacket (WifiMacHeader *hdr)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   327
{
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   328
  *hdr = m_currentHdr;
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   329
  hdr->SetFragmentNumber (m_fragmentNumber);
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   330
  uint32_t startOffset = m_fragmentNumber * GetFragmentSize ();
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   331
  Ptr<Packet> fragment;
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   332
  if (IsLastFragment ()) 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   333
    {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   334
      hdr->SetNoMoreFragments ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   335
    } 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   336
  else 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   337
    {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   338
      hdr->SetMoreFragments ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   339
    }
2349
b1df486516a4 allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2270
diff changeset
   340
  fragment = m_currentPacket->CreateFragment (startOffset, 
b1df486516a4 allow rate control algorithms to control more per-packet parameters.
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2270
diff changeset
   341
                                             GetFragmentSize ());
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   342
  return fragment;
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   343
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   344
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   345
bool 
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   346
DcaTxop::NeedsAccess (void) const
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   347
{
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   348
  return !m_queue->IsEmpty () || m_currentPacket != 0;
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   349
}
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   350
void 
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   351
DcaTxop::NotifyAccessGranted (void)
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   352
{
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   353
  if (m_currentPacket == 0) 
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   354
    {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   355
      if (m_queue->IsEmpty ()) 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   356
        {
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   357
          MY_DEBUG ("queue empty");
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   358
          return;
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   359
        }
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   360
      m_currentPacket = m_queue->Dequeue (&m_currentHdr);
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   361
      NS_ASSERT (m_currentPacket != 0);
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   362
      uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   363
      m_currentHdr.SetSequenceNumber (sequence);
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   364
      m_currentHdr.SetFragmentNumber (0);
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   365
      m_currentHdr.SetNoMoreFragments ();
2161
f5086fb78018 make sure that the retry bit is correctly initialized
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2159
diff changeset
   366
      m_currentHdr.SetNoRetry ();
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   367
      m_fragmentNumber = 0;
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   368
      MY_DEBUG ("dequeued size="<<m_currentPacket->GetSize ()<<
2092
885ebd975e88 set the retry bit and use it to filter duplicates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2091
diff changeset
   369
                    ", to="<<m_currentHdr.GetAddr1 ()<<
885ebd975e88 set the retry bit and use it to filter duplicates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2091
diff changeset
   370
                    ", seq="<<m_currentHdr.GetSequenceControl ()); 
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   371
    }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   372
  MacLowTransmissionParameters params;
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   373
  params.DisableOverrideDurationId ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   374
  if (m_currentHdr.GetAddr1 ().IsBroadcast ()) 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   375
    {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   376
      params.DisableRts ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   377
      params.DisableAck ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   378
      params.DisableNextData ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   379
      Low ()->StartTransmission (m_currentPacket,
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   380
                                 &m_currentHdr,
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   381
                                 params,
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   382
                                 m_transmissionListener);
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   383
      m_currentPacket = 0;
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   384
      m_dcf->ResetCw ();
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   385
      m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   386
      MY_DEBUG ("tx broadcast");
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   387
    } 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   388
  else 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   389
    {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   390
      params.EnableAck ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   391
      
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   392
      if (NeedFragmentation ()) 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   393
        {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   394
          params.DisableRts ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   395
          WifiMacHeader hdr;
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   396
          Ptr<Packet> fragment = GetFragmentPacket (&hdr);
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   397
          if (IsLastFragment ()) 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   398
            {
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   399
              MY_DEBUG ("fragmenting last fragment size="<<fragment->GetSize ());
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   400
              params.DisableNextData ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   401
            } 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   402
          else 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   403
            {
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   404
              MY_DEBUG ("fragmenting size="<<fragment->GetSize ());
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   405
              params.EnableNextData (GetNextFragmentSize ());
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   406
            }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   407
          Low ()->StartTransmission (fragment, &hdr, params, 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   408
                                     m_transmissionListener);
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   409
        } 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   410
      else 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   411
        {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   412
          if (NeedRts ()) 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   413
            {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   414
              params.EnableRts ();
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   415
              MY_DEBUG ("tx unicast rts");
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   416
            } 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   417
          else 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   418
            {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   419
              params.DisableRts ();
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   420
              MY_DEBUG ("tx unicast");
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   421
            }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   422
          params.DisableNextData ();
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   423
          Low ()->StartTransmission (m_currentPacket, &m_currentHdr,
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   424
                                     params, m_transmissionListener);
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   425
        }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   426
    }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   427
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   428
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   429
void 
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   430
DcaTxop::NotifyInternalCollision (void)
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   431
{
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   432
  NotifyCollision ();
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   433
}
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   434
void 
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   435
DcaTxop::NotifyCollision (void)
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   436
{
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   437
  MY_DEBUG ("collision");
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   438
  m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   439
  RestartAccessIfNeeded ();
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   440
}
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   441
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   442
void 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   443
DcaTxop::GotCts (double snr, WifiMode txMode)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   444
{
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   445
  MY_DEBUG ("got cts");
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   446
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   447
void 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   448
DcaTxop::MissedCts (void)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   449
{
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   450
  MY_DEBUG ("missed cts");
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   451
  if (!NeedRtsRetransmission ())
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   452
    {
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   453
      MY_DEBUG ("Cts Fail");
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   454
      WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ());
2270
7eb30e93d305 use the new MacStation::Report*Failed methods.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2268
diff changeset
   455
      station->ReportFinalRtsFailed ();
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   456
      // to reset the dcf.
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   457
      m_currentPacket = 0;
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   458
      m_dcf->ResetCw ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   459
    } 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   460
  else 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   461
    {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   462
      m_dcf->UpdateFailedCw ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   463
    }
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   464
  m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   465
  RestartAccessIfNeeded ();
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   466
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   467
void 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   468
DcaTxop::GotAck (double snr, WifiMode txMode)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   469
{
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   470
  if (!NeedFragmentation () ||
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   471
      IsLastFragment ()) 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   472
    {
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   473
      MY_DEBUG ("got ack. tx done.");
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   474
      if (!m_txOkCallback.IsNull ()) 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   475
        {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   476
          m_txOkCallback (m_currentHdr);
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   477
        }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   478
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   479
      /* we are not fragmenting or we are done fragmenting
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   480
       * so we can get rid of that packet now.
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   481
       */
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   482
      m_currentPacket = 0;
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   483
      m_dcf->ResetCw ();
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   484
      m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   485
      RestartAccessIfNeeded ();
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   486
    } 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   487
  else 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   488
    {
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   489
      MY_DEBUG ("got ack. tx not done, size="<<m_currentPacket->GetSize ());
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   490
    }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   491
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   492
void 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   493
DcaTxop::MissedAck (void)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   494
{
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   495
  MY_DEBUG ("missed ack");
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   496
  if (!NeedDataRetransmission ()) 
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   497
    {
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   498
      MY_DEBUG ("Ack Fail");
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2508
diff changeset
   499
      WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ());
2270
7eb30e93d305 use the new MacStation::Report*Failed methods.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2268
diff changeset
   500
      station->ReportFinalDataFailed ();
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   501
      // to reset the dcf.    
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   502
      m_currentPacket = 0;
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   503
      m_dcf->ResetCw ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   504
    } 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   505
  else 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   506
    {
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2592
diff changeset
   507
      MY_DEBUG ("Retransmit");
2092
885ebd975e88 set the retry bit and use it to filter duplicates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2091
diff changeset
   508
      m_currentHdr.SetRetry ();
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   509
      if (!m_txFailedCallback.IsNull ()) 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   510
        {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   511
          m_txFailedCallback (m_currentHdr);
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   512
        }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   513
      m_dcf->UpdateFailedCw ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   514
    }
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   515
  m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   516
  RestartAccessIfNeeded ();
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   517
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   518
void 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   519
DcaTxop::StartNext (void)
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   520
{
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   521
  MY_DEBUG ("start next packet fragment");
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   522
  /* this callback is used only for fragments. */
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   523
  NextFragment ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   524
  WifiMacHeader hdr;
2159
20f882e85b4a port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2146
diff changeset
   525
  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   526
  MacLowTransmissionParameters params;
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   527
  params.EnableAck ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   528
  params.DisableRts ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   529
  params.DisableOverrideDurationId ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   530
  if (IsLastFragment ()) 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   531
    {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   532
      params.DisableNextData ();
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   533
    } 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   534
  else 
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   535
    {
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   536
      params.EnableNextData (GetNextFragmentSize ());
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   537
    }
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   538
  Low ()->StartTransmission (fragment, &hdr, params, m_transmissionListener);
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   539
}
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   540
2091
9ef23a8f0980 handle cancel events
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2087
diff changeset
   541
void
9ef23a8f0980 handle cancel events
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2087
diff changeset
   542
DcaTxop::Cancel (void)
9ef23a8f0980 handle cancel events
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2087
diff changeset
   543
{
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   544
  MY_DEBUG ("transmission cancelled");
2091
9ef23a8f0980 handle cancel events
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2087
diff changeset
   545
  /**
2094
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   546
   * This happens in only one case: in an AP, you have two DcaTxop:
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   547
   *   - one is used exclusively for beacons and has a high priority.
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   548
   *   - the other is used for everything else and has a normal
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   549
   *     priority.
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   550
   *
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   551
   * If the normal queue tries to send a unicast data frame, but 
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   552
   * if the tx fails (ack timeout), it starts a backoff. If the beacon
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   553
   * queue gets a tx oportunity during this backoff, it will trigger
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   554
   * a call to this Cancel function.
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   555
   *
2146
40ad60ac9912 replace Dcf with DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2094
diff changeset
   556
   * Since we are already doing a backoff, we will get access to
2094
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   557
   * the medium when we can, we have nothing to do here. We just 
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   558
   * ignore the cancel event and wait until we are given again a 
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   559
   * tx oportunity.
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   560
   *
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   561
   * Note that this is really non-trivial because each of these
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   562
   * frames is assigned a sequence number from the same sequence 
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   563
   * counter (because this is a non-802.11e device) so, the scheme
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   564
   * described here fails to ensure in-order delivery of frames
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   565
   * at the receiving side. This, however, does not matter in
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   566
   * this case because we assume that the receiving side does not
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   567
   * update its <seq,ad> tupple for packets whose destination
ba3caa8ee26d do nothing on cancel and explain why.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2092
diff changeset
   568
   * address is a broadcast address.
2091
9ef23a8f0980 handle cancel events
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2087
diff changeset
   569
   */
9ef23a8f0980 handle cancel events
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2087
diff changeset
   570
}
9ef23a8f0980 handle cancel events
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2087
diff changeset
   571
1929
437bba482899 add DcaTxop to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   572
} // namespace ns3