src/devices/wifi/wifi-mac.cc
author Mirko Banchi <mk.banchi@gmail.com>
Wed, 03 Feb 2010 20:34:52 +0100
changeset 5958 dd0accd82659
parent 5747 a171e73c4dae
child 6183 8a5e1f9db873
permissions -rw-r--r--
add block ack timeouts
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2684
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
     2
/*
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
     3
 * Copyright (c) 2008 INRIA
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
     4
 *
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as 
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
     7
 * published by the Free Software Foundation;
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
     8
 *
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
    12
 * GNU General Public License for more details.
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
    13
 *
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
    14
 * You should have received a copy of the GNU General Public License
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
    15
 * along with this program; if not, write to the Free Software
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
    17
 *
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
    19
 */
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
#include "wifi-mac.h"
4720
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
    21
#include "dcf.h"
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
#include "ns3/uinteger.h"
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
    23
#include "ns3/trace-source-accessor.h"
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
namespace ns3 {
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
NS_OBJECT_ENSURE_REGISTERED (WifiMac);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
Time
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
WifiMac::GetDefaultMaxPropagationDelay (void)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
  // 1000m 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
  return Seconds (1000.0 / 300000000.0);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
Time
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
WifiMac::GetDefaultSlot (void)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
  // 802.11-a specific
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
  return MicroSeconds (9);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
Time
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
WifiMac::GetDefaultSifs (void)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
  // 802.11-a specific
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
  return MicroSeconds (16);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
Time
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
WifiMac::GetDefaultEifsNoDifs (void)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    49
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
  return GetDefaultSifs () + GetDefaultCtsAckDelay ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    51
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    52
Time
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
WifiMac::GetDefaultCtsAckDelay (void)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    55
  // 802.11-a specific: 6mb/s
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    56
  return MicroSeconds (44);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    57
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    58
Time
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    59
WifiMac::GetDefaultCtsAckTimeout (void)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    60
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    61
  /* Cts_Timeout and Ack_Timeout are specified in the Annex C 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    62
     (Formal description of MAC operation, see details on the 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    63
     Trsp timer setting at page 346)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    64
  */
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    65
  Time ctsTimeout = GetDefaultSifs ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    66
  ctsTimeout += GetDefaultCtsAckDelay ();
4509
b2654e0f071d bug 556: DcfManager does not handle AckTimeout properly when there are multiple queues
Kirill V. Andreev <kirillano@yandex.ru>
parents: 4272
diff changeset
    67
  ctsTimeout += MicroSeconds (GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    68
  ctsTimeout += GetDefaultSlot ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    69
  return ctsTimeout;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    71
5958
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    72
Time
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    73
WifiMac::GetDefaultBasicBlockAckDelay (void)
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    74
{
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    75
  // This value must be rivisited
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    76
  return MicroSeconds (250);
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    77
}
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    78
Time
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    79
WifiMac::GetDefaultCompressedBlockAckDelay (void)
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    80
{
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    81
  // This value must be rivisited
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    82
  return MicroSeconds (68);
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    83
}
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    84
Time
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    85
WifiMac::GetDefaultBasicBlockAckTimeout (void)
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    86
{
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    87
  Time blockAckTimeout = GetDefaultSifs ();
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    88
  blockAckTimeout += GetDefaultBasicBlockAckDelay ();
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    89
  blockAckTimeout += MicroSeconds (GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2);
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    90
  blockAckTimeout += GetDefaultSlot ();
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    91
  return blockAckTimeout;
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    92
}
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    93
Time
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    94
WifiMac::GetDefaultCompressedBlockAckTimeout (void)
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    95
{
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    96
  Time blockAckTimeout = GetDefaultSifs ();
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    97
  blockAckTimeout += GetDefaultCompressedBlockAckDelay ();
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    98
  blockAckTimeout += MicroSeconds (GetDefaultMaxPropagationDelay ().GetMicroSeconds () * 2);
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
    99
  blockAckTimeout += GetDefaultSlot ();
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   100
  return blockAckTimeout;
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   101
}
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   102
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   103
void
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   104
WifiMac::SetBasicBlockAckTimeout (Time blockAckTimeout)
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   105
{
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   106
  //this method must be implemented by QoS WifiMacs
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   107
}
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   108
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   109
Time
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   110
WifiMac::GetBasicBlockAckTimeout (void) const
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   111
{
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   112
  //this method must be implemented by QoS WifiMacs
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   113
  return MicroSeconds (0);
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   114
}
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   115
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   116
void
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   117
WifiMac::SetCompressedBlockAckTimeout (Time blockAckTimeout)
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   118
{
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   119
  //this methos must be implemented by QoS WifiMacs
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   120
}
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   121
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   122
Time
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   123
WifiMac::GetCompressedBlockAckTimeout (void) const
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   124
{
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   125
  //this method must be implemented by QoS WifiMacs
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   126
  return MicroSeconds (0);
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   127
}
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   128
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   129
TypeId 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   130
WifiMac::GetTypeId (void)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   131
{
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2599
diff changeset
   132
  static TypeId tid = TypeId ("ns3::WifiMac")
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   133
    .SetParent<Object> ()
3212
0c00342d6a73 improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
   134
    .AddAttribute ("CtsTimeout", "When this timeout expires, the RTS/CTS handshake has failed.",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2686
diff changeset
   135
                   TimeValue (GetDefaultCtsAckTimeout ()),
3747
789e9a21ecbe bug 371: wifi-ap broken
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3599
diff changeset
   136
                   MakeTimeAccessor (&WifiMac::SetCtsTimeout,
789e9a21ecbe bug 371: wifi-ap broken
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3599
diff changeset
   137
                                     &WifiMac::GetCtsTimeout),
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   138
                   MakeTimeChecker ())
3212
0c00342d6a73 improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
   139
    .AddAttribute ("AckTimeout", "When this timeout expires, the DATA/ACK handshake has failed.",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2686
diff changeset
   140
                   TimeValue (GetDefaultCtsAckTimeout ()),
3596
6c39b712a535 move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3212
diff changeset
   141
                   MakeTimeAccessor (&WifiMac::GetAckTimeout,
6c39b712a535 move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3212
diff changeset
   142
                                     &WifiMac::SetAckTimeout),
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   143
                   MakeTimeChecker ())
5958
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   144
    .AddAttribute ("BasicBlockAckTimeout", "When this timeout expires, the BASIC_BLOCK_ACK_REQ/BASIC_BLOCK_ACK handshake has failed.",
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   145
                   TimeValue (GetDefaultBasicBlockAckTimeout ()),
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   146
                   MakeTimeAccessor (&WifiMac::GetBasicBlockAckTimeout,
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   147
                                     &WifiMac::SetBasicBlockAckTimeout),
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   148
                   MakeTimeChecker ())
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   149
    .AddAttribute ("CompressedBlockAckTimeout", "When this timeout expires, the COMPRESSED_BLOCK_ACK_REQ/COMPRESSED_BLOCK_ACK handshake has failed.",
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   150
                   TimeValue (GetDefaultCompressedBlockAckTimeout ()),
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   151
                   MakeTimeAccessor (&WifiMac::GetCompressedBlockAckTimeout,
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   152
                                     &WifiMac::SetCompressedBlockAckTimeout),
dd0accd82659 add block ack timeouts
Mirko Banchi <mk.banchi@gmail.com>
parents: 5747
diff changeset
   153
                   MakeTimeChecker ())
3212
0c00342d6a73 improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
   154
    .AddAttribute ("Sifs", "The value of the SIFS constant.",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2686
diff changeset
   155
                   TimeValue (GetDefaultSifs ()),
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   156
                   MakeTimeAccessor (&WifiMac::SetSifs,
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   157
				     &WifiMac::GetSifs),
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   158
                   MakeTimeChecker ())
3212
0c00342d6a73 improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
   159
    .AddAttribute ("EifsNoDifs", "The value of EIFS-DIFS",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2686
diff changeset
   160
		   TimeValue (GetDefaultEifsNoDifs ()),
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   161
		   MakeTimeAccessor (&WifiMac::SetEifsNoDifs,
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   162
				     &WifiMac::GetEifsNoDifs),
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   163
		   MakeTimeChecker ())
3212
0c00342d6a73 improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
   164
    .AddAttribute ("Slot", "The duration of a Slot.",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2686
diff changeset
   165
                   TimeValue (GetDefaultSlot ()),
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   166
                   MakeTimeAccessor (&WifiMac::SetSlot,
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   167
				     &WifiMac::GetSlot),
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   168
                   MakeTimeChecker ())
3212
0c00342d6a73 improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
   169
    .AddAttribute ("Pifs", "The value of the PIFS constant.",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2686
diff changeset
   170
                   TimeValue (GetDefaultSifs () + GetDefaultSlot ()),
3599
721bd46c15f8 move slot and pifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3596
diff changeset
   171
                   MakeTimeAccessor (&WifiMac::SetPifs,
721bd46c15f8 move slot and pifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3596
diff changeset
   172
                                     &WifiMac::GetPifs),
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   173
                   MakeTimeChecker ())
3212
0c00342d6a73 improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
   174
    .AddAttribute ("MaxPropagationDelay", "The maximum propagation delay. Unused for now.",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2686
diff changeset
   175
                   TimeValue (GetDefaultMaxPropagationDelay ()),
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   176
                   MakeTimeAccessor (&WifiMac::m_maxPropagationDelay),
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   177
                   MakeTimeChecker ())
3212
0c00342d6a73 improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
   178
    .AddAttribute ("MaxMsduSize", "The maximum size of an MSDU accepted by the MAC layer."
0c00342d6a73 improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
   179
                   "This value conforms to the specification.",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2686
diff changeset
   180
		   UintegerValue (2304),
2563
cd5b1cd332fe initialize properly the max msdu field.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2528
diff changeset
   181
		   MakeUintegerAccessor (&WifiMac::m_maxMsduSize),
2599
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2563
diff changeset
   182
		   MakeUintegerChecker<uint16_t> (1,2304))
3212
0c00342d6a73 improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
   183
    .AddAttribute ("Ssid", "The ssid we want to belong to.",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2686
diff changeset
   184
		   SsidValue (Ssid ("default")),
2528
a527ec47b756 avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
   185
		   MakeSsidAccessor (&WifiMac::GetSsid,
a527ec47b756 avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
   186
				     &WifiMac::SetSsid),
a527ec47b756 avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
   187
		   MakeSsidChecker ())
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   188
    .AddTraceSource ("MacTx", 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   189
                     "A packet has been received from higher layers and is being processed in preparation for "
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   190
                     "queueing for transmission.",
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   191
                     MakeTraceSourceAccessor (&WifiMac::m_macTxTrace))
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   192
    .AddTraceSource ("MacTxDrop", 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   193
                     "A packet has been dropped in the MAC layer before being queued for transmission.",
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   194
                     MakeTraceSourceAccessor (&WifiMac::m_macTxDropTrace))
4272
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   195
    .AddTraceSource ("MacPromiscRx", 
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   196
                     "A packet has been received by this device, has been passed up from the physical layer "
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   197
                     "and is being forwarded up the local protocol stack.  This is a promiscuous trace,",
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   198
                     MakeTraceSourceAccessor (&WifiMac::m_macPromiscRxTrace))
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   199
    .AddTraceSource ("MacRx", 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   200
                     "A packet has been received by this device, has been passed up from the physical layer "
4272
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   201
                     "and is being forwarded up the local protocol stack.  This is a non-promiscuous trace,",
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   202
                     MakeTraceSourceAccessor (&WifiMac::m_macRxTrace))
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   203
    .AddTraceSource ("MacRxDrop", 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   204
                     "A packet has been dropped in the MAC layer after it has been passed up from the physical "
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   205
                     "layer.",
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   206
                     MakeTraceSourceAccessor (&WifiMac::m_macRxDropTrace))
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   207
#if 0
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   208
    // Not currently implemented in this device
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   209
    .AddTraceSource ("Sniffer", 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   210
                     "Trace source simulating a non-promiscuous packet sniffer attached to the device",
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   211
                     MakeTraceSourceAccessor (&WifiMac::m_snifferTrace))
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   212
#endif
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   213
    ;
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   214
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   215
  return tid;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   216
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   217
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   218
void 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   219
WifiMac::SetMaxPropagationDelay (Time delay)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   220
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   221
  m_maxPropagationDelay = delay;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   222
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   223
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   224
Time
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   225
WifiMac::GetMsduLifetime (void) const
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   226
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   227
  return Seconds (10);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   228
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   229
Time
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   230
WifiMac::GetMaxPropagationDelay (void) const
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   231
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   232
  return m_maxPropagationDelay;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   233
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   234
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   235
uint32_t 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   236
WifiMac::GetMaxMsduSize (void) const
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   237
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   238
  return m_maxMsduSize;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   239
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   240
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   241
void 
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   242
WifiMac::NotifyTx (Ptr<const Packet> packet)
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   243
{
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   244
  m_macTxTrace (packet);
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   245
}
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   246
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   247
void 
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   248
WifiMac::NotifyTxDrop (Ptr<const Packet> packet) 
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   249
{
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   250
  m_macTxDropTrace (packet);
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   251
}
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3749
diff changeset
   252
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   253
void 
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   254
WifiMac::NotifyRx (Ptr<const Packet> packet) 
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   255
{
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   256
  m_macRxTrace (packet);
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   257
}
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   258
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   259
void 
4272
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   260
WifiMac::NotifyPromiscRx (Ptr<const Packet> packet) 
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   261
{
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   262
  m_macPromiscRxTrace (packet);
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   263
}
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   264
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   265
void 
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   266
WifiMac::NotifyRxDrop (Ptr<const Packet> packet) 
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   267
{
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   268
  m_macRxDropTrace (packet);
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   269
}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   270
4680
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   271
void
4720
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   272
WifiMac::ConfigureStandard (enum WifiPhyStandard standard)
4680
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   273
{
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   274
  switch (standard) {
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   275
  case WIFI_PHY_STANDARD_80211a:
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   276
    Configure80211a ();
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   277
    break;
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   278
  case WIFI_PHY_STANDARD_80211b:
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   279
    Configure80211b ();
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   280
    break;
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   281
  case WIFI_PHY_STANDARD_80211_10Mhz: 
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   282
    Configure80211_10Mhz ();
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   283
    break;
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   284
  case WIFI_PHY_STANDARD_80211_5Mhz:
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   285
    Configure80211_5Mhz ();
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   286
    break;
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   287
  case WIFI_PHY_STANDARD_holland:
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   288
    Configure80211a ();
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   289
    break;
5747
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   290
  case WIFI_PHY_STANDARD_80211p_CCH:
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   291
    Configure80211p_CCH ();
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   292
    break;
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   293
  case WIFI_PHY_STANDARD_80211p_SCH:
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   294
    Configure80211p_SCH ();
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   295
    break;
4680
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   296
  default:
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   297
    NS_ASSERT (false);
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   298
    break;
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   299
  }
4720
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   300
  FinishConfigureStandard (standard);
4680
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   301
}
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   302
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   303
void
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   304
WifiMac::Configure80211a (void)
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   305
{
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   306
  SetSifs(MicroSeconds(16));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   307
  SetSlot(MicroSeconds(9)); 
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   308
  SetEifsNoDifs(MicroSeconds(16+44));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   309
  SetPifs(MicroSeconds(16+9));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   310
  SetCtsTimeout(MicroSeconds(16+44+9+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   311
  SetAckTimeout(MicroSeconds(16+44+9+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2)); 
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   312
}
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   313
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   314
void
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   315
WifiMac::Configure80211b (void)
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   316
{
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   317
  SetSifs(MicroSeconds(10));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   318
  SetSlot(MicroSeconds(20));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   319
  SetEifsNoDifs(MicroSeconds(10+304));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   320
  SetPifs(MicroSeconds(10+20));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   321
  SetCtsTimeout(MicroSeconds(10+304+20+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   322
  SetAckTimeout(MicroSeconds(10+304+20+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2)); 
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   323
}
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   324
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   325
void
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   326
WifiMac::Configure80211_10Mhz (void)
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   327
{
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   328
  SetSifs(MicroSeconds(32));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   329
  SetSlot(MicroSeconds(13)); 
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   330
  SetEifsNoDifs(MicroSeconds(32+88));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   331
  SetPifs(MicroSeconds(32+13));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   332
  SetCtsTimeout(MicroSeconds(32+88+13+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   333
  SetAckTimeout(MicroSeconds(32+88+13+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2)); 
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   334
}
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   335
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   336
void
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   337
WifiMac::Configure80211_5Mhz (void)
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   338
{
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   339
  SetSifs(MicroSeconds(64));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   340
  SetSlot(MicroSeconds(21));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   341
  SetEifsNoDifs(MicroSeconds(64+176));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   342
  SetPifs(MicroSeconds(64+21));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   343
  SetCtsTimeout(MicroSeconds(64+176+21+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   344
  SetAckTimeout(MicroSeconds(64+176+21+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2)); 
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   345
}
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4509
diff changeset
   346
4720
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   347
void
5747
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   348
WifiMac::Configure80211p_CCH (void)
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   349
{
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   350
  SetSifs(MicroSeconds(32));
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   351
  SetSlot(MicroSeconds(16)); 
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   352
  SetEifsNoDifs(MicroSeconds(32+88));
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   353
  SetPifs(MicroSeconds(32+16));
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   354
  SetCtsTimeout(MicroSeconds(32+88+16+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   355
  SetAckTimeout(MicroSeconds(32+88+16+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2)); 
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   356
}
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   357
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   358
void
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   359
WifiMac::Configure80211p_SCH (void)
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   360
{
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   361
  SetSifs(MicroSeconds(32));
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   362
  SetSlot(MicroSeconds(16)); 
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   363
  SetEifsNoDifs(MicroSeconds(32+88));
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   364
  SetPifs(MicroSeconds(32+16));
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   365
  SetCtsTimeout(MicroSeconds(32+88+16+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2));
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   366
  SetAckTimeout(MicroSeconds(32+88+16+GetDefaultMaxPropagationDelay().GetMicroSeconds ()*2)); 
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   367
}
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   368
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   369
void
4720
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   370
WifiMac::ConfigureDcf (Ptr<Dcf> dcf, uint32_t cwmin, uint32_t cwmax, enum AccessClass ac)
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   371
{
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   372
  /* see IEE802.11 section 7.3.2.29 */
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   373
  switch (ac) {
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   374
  case AC_VO:
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   375
    dcf->SetMinCw ((cwmin+1)/4-1);
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   376
    dcf->SetMaxCw ((cwmin+1)/2-1);
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   377
    dcf->SetAifsn (2);
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   378
    break;
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   379
  case AC_VI:
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   380
    dcf->SetMinCw ((cwmin+1)/2-1);
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   381
    dcf->SetMaxCw (cwmin);
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   382
    dcf->SetAifsn (2);
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   383
    break;
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   384
  case AC_BE:
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   385
    dcf->SetMinCw (cwmin);
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   386
    dcf->SetMaxCw (cwmax);
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   387
    dcf->SetAifsn (3);
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   388
    break;
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   389
  case AC_BK:
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   390
    dcf->SetMinCw (cwmin);
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   391
    dcf->SetMaxCw (cwmax);
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   392
    dcf->SetAifsn (7);
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   393
    break;
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   394
  case AC_BE_NQOS:
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   395
    dcf->SetMinCw (cwmin);
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   396
    dcf->SetMaxCw (cwmax);
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   397
    dcf->SetAifsn (2);    
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   398
    break;
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   399
  case AC_UNDEF:
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   400
    NS_FATAL_ERROR ("I don't know what to do with this");
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   401
    break;
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   402
  }
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   403
}
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4680
diff changeset
   404
5747
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   405
void
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   406
WifiMac::ConfigureCCHDcf (Ptr<Dcf> dcf, uint32_t cwmin, uint32_t cwmax, enum AccessClass ac)
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   407
{
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   408
  /* see IEEE 1609.4-2006 section 6.3.1, Table 1 */
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   409
  switch (ac) {
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   410
  case AC_VO:
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   411
    dcf->SetMinCw ((cwmin+1)/4-1);
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   412
    dcf->SetMaxCw ((cwmin+1)/2-1);
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   413
    dcf->SetAifsn (2);
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   414
    break;
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   415
  case AC_VI:
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   416
    dcf->SetMinCw ((cwmin+1)/4-1);
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   417
    dcf->SetMaxCw ((cwmin+1)/2-1);
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   418
    dcf->SetAifsn (3);
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   419
    break;
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   420
  case AC_BE:
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   421
    dcf->SetMinCw ((cwmin+1)/2-1);
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   422
    dcf->SetMaxCw (cwmin);
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   423
    dcf->SetAifsn (6);
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   424
    break;
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   425
  case AC_BK:
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   426
    dcf->SetMinCw (cwmin);
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   427
    dcf->SetMaxCw (cwmax);
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   428
    dcf->SetAifsn (9);
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   429
    break;
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   430
  case AC_BE_NQOS:
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   431
    dcf->SetMinCw (cwmin);
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   432
    dcf->SetMaxCw (cwmax);
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   433
    dcf->SetAifsn (2);    
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   434
    break;
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   435
  case AC_UNDEF:
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   436
    NS_FATAL_ERROR ("I don't know what to do with this");
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   437
    break;
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   438
  }
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 4720
diff changeset
   439
}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   440
} // namespace ns3