src/devices/mesh/mesh-wifi-interface-mac.cc
author Kirill Andreev <andreev@iitp.ru>
Tue, 21 Jul 2009 13:14:52 +0400
changeset 5126 8e06088a785d
parent 5125 b90c6c0af6a3
child 5128 d6e168eba404
permissions -rw-r--r--
Statistics removed from headers
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
     2
/*
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     3
 * Copyright (c) 2009 IITP RAS
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
     4
 *
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     8
 *
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    12
 * GNU General Public License for more details.
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    13
 *
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
    17
 *
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    18
 * Authors: Kirill Andreev <andreev@iitp.ru>
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    19
 *          Pavel Boyko <boyko@iitp.ru>
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    20
 */
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    21
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    22
#include "ns3/mesh-wifi-interface-mac.h"
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    23
#include "ns3/mesh-wifi-beacon.h"
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    24
#include "ns3/log.h"
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    25
#include "ns3/wifi-phy.h"
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    26
#include "ns3/dcf-manager.h"
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    27
#include "ns3/mac-rx-middle.h"
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    28
#include "ns3/mac-low.h"
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    29
#include "ns3/dca-txop.h"
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    30
#include "ns3/random-variable.h"
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    31
#include "ns3/simulator.h"
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
    32
#include "ns3/yans-wifi-phy.h"
5054
49851228eec9 Added interface helper
Kirill Andreev <andreev@iitp.ru>
parents: 5047
diff changeset
    33
#include "ns3/pointer.h"
5115
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 5114
diff changeset
    34
#include "ns3/qos-tag.h"
5054
49851228eec9 Added interface helper
Kirill Andreev <andreev@iitp.ru>
parents: 5047
diff changeset
    35
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    36
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    37
NS_LOG_COMPONENT_DEFINE ("MeshWifiInterfaceMac");
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    38
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    39
namespace ns3 {
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    40
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    41
NS_OBJECT_ENSURE_REGISTERED (MeshWifiInterfaceMac);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    42
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    43
TypeId
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    44
MeshWifiInterfaceMac::GetTypeId ()
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    45
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    46
  static TypeId tid = TypeId ("ns3::MeshWifiInterfaceMac")
4964
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    47
    .SetParent<WifiMac> ()
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    48
    .AddConstructor<MeshWifiInterfaceMac> ()
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    49
    .AddAttribute ("BeaconInterval", "Beacon Interval",
5073
a60c18b05d41 Beacon interval is 0.5s by default
Pavel Boyko <boyko@iitp.ru>
parents: 5071
diff changeset
    50
        TimeValue (Seconds (0.5)),
4964
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    51
        MakeTimeAccessor (&MeshWifiInterfaceMac::m_beaconInterval),
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    52
        MakeTimeChecker ()
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    53
        )
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    54
    .AddAttribute ("RandomStart", "Window when beacon generating starts (uniform random) in seconds",
5073
a60c18b05d41 Beacon interval is 0.5s by default
Pavel Boyko <boyko@iitp.ru>
parents: 5071
diff changeset
    55
        TimeValue (Seconds (0.5)),
4964
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    56
        MakeTimeAccessor (&MeshWifiInterfaceMac::m_randomStart),
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    57
        MakeTimeChecker ()
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    58
        )
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    59
    .AddAttribute ("BeaconGeneration", "Enable/Disable Beaconing.",
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    60
        BooleanValue (true),
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    61
        MakeBooleanAccessor (
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    62
          &MeshWifiInterfaceMac::SetBeaconGeneration,
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    63
          &MeshWifiInterfaceMac::GetBeaconGeneration
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    64
          ),
9107f67330f3 More than one root works
Kirill Andreev <andreev@iitp.ru>
parents: 4950
diff changeset
    65
        MakeBooleanChecker ()
5114
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
    66
        );
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    67
  return tid;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    68
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    69
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    70
MeshWifiInterfaceMac::MeshWifiInterfaceMac ()
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    71
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    72
  NS_LOG_FUNCTION (this);
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
    73
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    74
  m_rxMiddle = new MacRxMiddle ();
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    75
  m_rxMiddle->SetForwardCallback (MakeCallback (&MeshWifiInterfaceMac::Receive, this));
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    76
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    77
  m_low = CreateObject<MacLow> ();
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    78
  m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle));
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    79
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    80
  m_dcfManager = new DcfManager ();
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    81
  m_dcfManager->SetupLowListener (m_low);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    82
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    83
  m_beaconDca = CreateObject<DcaTxop> ();
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    84
  m_beaconDca->SetLow (m_low);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    85
  m_beaconDca->SetMinCw (0);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    86
  m_beaconDca->SetMaxCw (0);
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
    87
  m_beaconDca->SetAifsn (1);
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    88
  m_beaconDca->SetManager (m_dcfManager);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    89
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    90
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    91
MeshWifiInterfaceMac::~MeshWifiInterfaceMac ()
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    92
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    93
  NS_LOG_FUNCTION (this);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    94
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    95
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    96
//-----------------------------------------------------------------------------
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    97
// WifiMac inherited
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    98
//-----------------------------------------------------------------------------
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    99
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   100
MeshWifiInterfaceMac::SetSlot (Time slotTime)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   101
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   102
  NS_LOG_FUNCTION (this << slotTime);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   103
  m_dcfManager->SetSlot (slotTime);
5047
b68f194a346c Fixed setting slot and sifs time to mac-low
Kirill Andreev <andreev@iitp.ru>
parents: 5038
diff changeset
   104
  m_low->SetSlotTime (slotTime);
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   105
  m_slot = slotTime;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   106
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   107
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   108
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   109
MeshWifiInterfaceMac::SetSifs (Time sifs)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   110
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   111
  NS_LOG_FUNCTION (this << sifs);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   112
  m_dcfManager->SetSifs (sifs);
5047
b68f194a346c Fixed setting slot and sifs time to mac-low
Kirill Andreev <andreev@iitp.ru>
parents: 5038
diff changeset
   113
  m_low->SetSifs (sifs);
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   114
  m_sifs = sifs;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   115
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   116
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   117
MeshWifiInterfaceMac::SetAckTimeout (Time ackTimeout)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   118
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   119
  m_low->SetAckTimeout (ackTimeout);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   120
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   121
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   122
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   123
MeshWifiInterfaceMac::SetCtsTimeout (Time ctsTimeout)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   124
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   125
  m_low->SetCtsTimeout (ctsTimeout);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   126
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   127
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   128
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   129
MeshWifiInterfaceMac::SetPifs (Time pifs)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   130
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   131
  NS_LOG_FUNCTION (this << pifs);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   132
  m_pifs = pifs;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   133
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   134
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   135
MeshWifiInterfaceMac::SetEifsNoDifs (Time eifsNoDifs)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   136
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   137
  NS_LOG_FUNCTION (this << eifsNoDifs);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   138
  m_dcfManager->SetEifsNoDifs (eifsNoDifs);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   139
  m_eifsNoDifs = eifsNoDifs;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   140
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   141
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   142
Time
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   143
MeshWifiInterfaceMac::GetSlot () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   144
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   145
  return m_slot;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   146
}
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   147
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   148
Time
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   149
MeshWifiInterfaceMac::GetSifs () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   150
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   151
  return m_sifs;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   152
}
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   153
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   154
Time
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   155
MeshWifiInterfaceMac::GetEifsNoDifs () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   156
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   157
  return m_eifsNoDifs;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   158
}
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   159
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   160
Time
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   161
MeshWifiInterfaceMac::GetAckTimeout () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   162
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   163
  return m_low->GetAckTimeout ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   164
}
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   165
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   166
Time
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   167
MeshWifiInterfaceMac::GetCtsTimeout () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   168
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   169
  return m_low->GetCtsTimeout ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   170
}
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   171
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   172
Time
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   173
MeshWifiInterfaceMac::GetPifs () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   174
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   175
  return m_low->GetPifs ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   176
}
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   177
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   178
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   179
MeshWifiInterfaceMac::SetWifiPhy (Ptr<WifiPhy> phy)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   180
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   181
  NS_LOG_FUNCTION (this << phy);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   182
  m_phy = phy;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   183
  m_dcfManager->SetupPhyListener (phy);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   184
  m_low->SetPhy (phy);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   185
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   186
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   187
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   188
MeshWifiInterfaceMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   189
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   190
  NS_LOG_FUNCTION (this << stationManager);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   191
  m_stationManager = stationManager;
5114
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   192
  for (Queues::const_iterator i = m_queues.begin (); i != m_queues.end (); i ++)
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   193
  {
5114
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   194
    i->second->SetWifiRemoteStationManager (stationManager);
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   195
  }
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   196
  m_beaconDca->SetWifiRemoteStationManager (stationManager);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   197
  m_low->SetWifiRemoteStationManager (stationManager);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   198
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   199
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   200
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   201
MeshWifiInterfaceMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   202
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   203
  NS_LOG_FUNCTION (this << packet << to << from);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   204
  ForwardDown (packet, from, to);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   205
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   206
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   207
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   208
MeshWifiInterfaceMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   209
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   210
  NS_LOG_FUNCTION (this << packet << to);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   211
  ForwardDown (packet, m_low->GetAddress (), to);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   212
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   213
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   214
bool
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   215
MeshWifiInterfaceMac::SupportsSendFrom () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   216
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   217
  return true;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   218
}
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   219
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   220
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   221
MeshWifiInterfaceMac::SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   222
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   223
  NS_LOG_FUNCTION (this);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   224
  m_upCallback = upCallback;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   225
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   226
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   227
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   228
MeshWifiInterfaceMac::SetLinkUpCallback (Callback<void> linkUp)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   229
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   230
  NS_LOG_FUNCTION (this);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   231
  if (!linkUp.IsNull ())
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   232
    {
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   233
      linkUp ();
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   234
    }
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   235
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   236
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   237
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   238
MeshWifiInterfaceMac::SetLinkDownCallback (Callback<void> linkDown)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   239
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   240
  NS_LOG_FUNCTION (this);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   241
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   242
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   243
Mac48Address
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   244
MeshWifiInterfaceMac::GetAddress () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   245
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   246
  return m_address;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   247
}
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   248
Mac48Address
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   249
MeshWifiInterfaceMac::GetBssid () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   250
{
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   251
  return m_address;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   252
}
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   253
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   254
Ssid
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   255
MeshWifiInterfaceMac::GetSsid () const
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   256
{
4865
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   257
  return m_meshId;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   258
}
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   259
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   260
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   261
MeshWifiInterfaceMac::SetAddress (Mac48Address address)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   262
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   263
  NS_LOG_FUNCTION (address);
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   264
  m_low->SetAddress (address);
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   265
  m_address = address;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   266
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   267
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   268
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   269
MeshWifiInterfaceMac::SetSsid (Ssid ssid)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   270
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   271
  NS_LOG_FUNCTION (ssid);
4865
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   272
  m_meshId = ssid;
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   273
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   274
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   275
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   276
MeshWifiInterfaceMac::DoDispose ()
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   277
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   278
  NS_LOG_FUNCTION (this);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   279
  delete m_rxMiddle;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   280
  delete m_dcfManager;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   281
  //Delete smart pointers:
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   282
  m_rxMiddle = 0;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   283
  m_low = 0;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   284
  m_dcfManager = 0;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   285
  m_phy = 0;
5114
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   286
  m_queues.clear ();
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   287
  m_beaconSendEvent.Cancel ();
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   288
  m_beaconDca = 0;
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   289
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   290
  WifiMac::DoDispose ();
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   291
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   292
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   293
//-----------------------------------------------------------------------------
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   294
// Plugins
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   295
//-----------------------------------------------------------------------------
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   296
void
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   297
MeshWifiInterfaceMac::InstallPlugin ( Ptr<MeshWifiInterfaceMacPlugin> plugin)
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   298
{
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   299
  NS_LOG_FUNCTION (this);
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   300
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   301
  plugin->SetParent (this);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   302
  m_plugins.push_back (plugin);
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   303
}
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   304
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   305
//-----------------------------------------------------------------------------
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   306
// Switch channels
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   307
//-----------------------------------------------------------------------------
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   308
uint16_t MeshWifiInterfaceMac::GetFrequencyChannel () const
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   309
{
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   310
  NS_LOG_FUNCTION (this);
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   311
  NS_ASSERT (m_phy != 0); // need PHY to set/get channel
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   312
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   313
  Ptr<YansWifiPhy> phy = m_phy->GetObject<YansWifiPhy> ();
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   314
  if (phy != 0)
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   315
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   316
      return phy->GetChannelNumber ();
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   317
    }
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   318
  else
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   319
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   320
      return 0;
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   321
    }
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   322
}
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   323
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   324
void MeshWifiInterfaceMac::SwitchFrequencyChannel (uint16_t new_id)
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   325
{
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   326
  NS_LOG_FUNCTION (this);
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   327
  NS_ASSERT (m_phy != 0); // need PHY to set/get channel
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   328
  /* TODO
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   329
   *
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   330
   * Correct channel switching is:
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   331
   *
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   332
   * 1. Interface down, e.g. to stop packets from layer 3
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   333
   * 2. Wait before all output queues will be empty
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   334
   * 3. Switch PHY channel
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   335
   * 4. Interface up
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   336
   *
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   337
   * Now we use dirty channel switch -- just change frequency
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   338
   */
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   339
  Ptr<YansWifiPhy> phy = m_phy->GetObject<YansWifiPhy> ();
5118
3a0893ec9819 ChannelId -> ChannelNumber and also in the base class WifiPhy
Pavel Boyko <boyko@iitp.ru>
parents: 5098
diff changeset
   340
  phy->SetChannelNumber (new_id);
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   341
  // Don't know NAV on new channel
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   342
  m_dcfManager->NotifyNavResetNow (Seconds (0));
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   343
}
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   344
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   345
//-----------------------------------------------------------------------------
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   346
// Forward frame up/down
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   347
//-----------------------------------------------------------------------------
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   348
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   349
MeshWifiInterfaceMac::ForwardUp (Ptr<Packet> packet, Mac48Address src, Mac48Address dst)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   350
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   351
  NS_LOG_FUNCTION (this << packet << src);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   352
  m_upCallback (packet, src, dst);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   353
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   354
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   355
void
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   356
MeshWifiInterfaceMac::ForwardDown (Ptr<const Packet> const_packet, Mac48Address from, Mac48Address to)
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   357
{
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   358
  // copy packet to allow modifications
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   359
  Ptr<Packet> packet = const_packet->Copy ();
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   360
  WifiMacHeader hdr;
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   361
  hdr.SetTypeData ();
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   362
  hdr.SetAddr2 (GetAddress ());
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   363
  hdr.SetAddr3 (to);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   364
  hdr.SetAddr4 (from);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   365
  hdr.SetDsFrom ();
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   366
  hdr.SetDsTo ();
5115
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 5114
diff changeset
   367
  // Fill QoS fields:
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 5114
diff changeset
   368
  hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 5114
diff changeset
   369
  hdr.SetQosNoEosp ();
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 5114
diff changeset
   370
  hdr.SetQosNoAmsdu ();
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 5114
diff changeset
   371
  hdr.SetQosTxopLimit (0);
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   372
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   373
  // Address 1 is unknwon here. Routing plugin is responsible to correctly set it.
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   374
  hdr.SetAddr1 (Mac48Address ());
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   375
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   376
  // Filter packet through all installed plugins
5002
4ff127c1f6fa Filtering outgoing frames if peer link does not exist. Fixed order of going
Kirill Andreev <andreev@iitp.ru>
parents: 4985
diff changeset
   377
  for (PluginList::const_iterator i = m_plugins.end()-1; i != m_plugins.begin()-1; i--)
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   378
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   379
      bool drop = ! ((*i)->UpdateOutcomingFrame(packet, hdr, from, to));
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   380
      if (drop)
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   381
        {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   382
          return; // plugin drops frame
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   383
        }
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   384
    }
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   385
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   386
  // Assert that address1 is set. Assert will fail e.g. if there is no installed routing plugin.
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   387
  NS_ASSERT (hdr.GetAddr1() != Mac48Address() );
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   388
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   389
  // Queue frame
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   390
  WifiRemoteStation *destination = m_stationManager->Lookup (to);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   391
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   392
  if (destination->IsBrandNew ())
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   393
    {
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   394
      // in adhoc mode, we assume that every destination
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   395
      // supports all the rates we support.
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   396
      for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   397
        {
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   398
          destination->AddSupportedMode (m_phy->GetMode (i));
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   399
        }
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   400
      destination->RecordDisassociated ();
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   401
    }
5115
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 5114
diff changeset
   402
  //Classify: application sets a tag, which is removed here
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 5114
diff changeset
   403
  // Get Qos tag:
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 5114
diff changeset
   404
  AccessClass ac = AC_BE;
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 5114
diff changeset
   405
  QosTag tag;
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   406
  if (packet->RemovePacketTag (tag))
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   407
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   408
      ac = QosUtilsMapTidToAc (tag.Get ());
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   409
    }
5015
e460e29f9f78 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5014
diff changeset
   410
  m_stats.sentFrames ++;
e460e29f9f78 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5014
diff changeset
   411
  m_stats.sentBytes += packet->GetSize ();
5115
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 5114
diff changeset
   412
  NS_ASSERT(m_queues.find(ac) != m_queues.end ());
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 5114
diff changeset
   413
  m_queues[ac]->Queue (packet, hdr);
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   414
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   415
4865
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   416
void
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   417
MeshWifiInterfaceMac::SendManagementFrame (Ptr<Packet> packet, const WifiMacHeader& hdr)
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   418
{
5002
4ff127c1f6fa Filtering outgoing frames if peer link does not exist. Fixed order of going
Kirill Andreev <andreev@iitp.ru>
parents: 4985
diff changeset
   419
  //Filter management frames:
4ff127c1f6fa Filtering outgoing frames if peer link does not exist. Fixed order of going
Kirill Andreev <andreev@iitp.ru>
parents: 4985
diff changeset
   420
  WifiMacHeader header = hdr;
4ff127c1f6fa Filtering outgoing frames if peer link does not exist. Fixed order of going
Kirill Andreev <andreev@iitp.ru>
parents: 4985
diff changeset
   421
  for (PluginList::const_iterator i = m_plugins.end()-1; i != m_plugins.begin()-1; i--)
4ff127c1f6fa Filtering outgoing frames if peer link does not exist. Fixed order of going
Kirill Andreev <andreev@iitp.ru>
parents: 4985
diff changeset
   422
    {
4ff127c1f6fa Filtering outgoing frames if peer link does not exist. Fixed order of going
Kirill Andreev <andreev@iitp.ru>
parents: 4985
diff changeset
   423
      bool drop = ! ((*i)->UpdateOutcomingFrame(packet, header, Mac48Address (), Mac48Address ()));
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   424
      if (drop)
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   425
        {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   426
          return; // plugin drops frame
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   427
        }
5002
4ff127c1f6fa Filtering outgoing frames if peer link does not exist. Fixed order of going
Kirill Andreev <andreev@iitp.ru>
parents: 4985
diff changeset
   428
    }
5015
e460e29f9f78 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5014
diff changeset
   429
  m_stats.sentFrames ++;
e460e29f9f78 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5014
diff changeset
   430
  m_stats.sentBytes += packet->GetSize ();
5114
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   431
  Queues::iterator i = m_queues.find (AC_VO);
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   432
  if (i == m_queues.end ())
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   433
  {
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   434
    NS_FATAL_ERROR("Voice queue is not set up!");
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   435
  }
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   436
  m_queues[AC_VO]->Queue (packet, header);
4865
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   437
}
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   438
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   439
SupportedRates
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   440
MeshWifiInterfaceMac::GetSupportedRates () const
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   441
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   442
  // set the set of supported rates and make sure that we indicate
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   443
  // the Basic Rate set in this set of supported rates.
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   444
  SupportedRates rates;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   445
  for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   446
    {
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   447
      WifiMode mode = m_phy->GetMode (i);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   448
      rates.AddSupportedRate (mode.GetDataRate ());
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   449
    }
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   450
  // set the basic rates
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   451
  for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   452
    {
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   453
      WifiMode mode = m_stationManager->GetBasicMode (j);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   454
      rates.SetBasicRate (mode.GetDataRate ());
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   455
    }
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   456
  return rates;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   457
}
4865
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   458
bool
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   459
MeshWifiInterfaceMac::CheckSupportedRates(SupportedRates rates) const
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   460
{
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   461
  for (uint32_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   462
  {
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   463
    WifiMode mode = m_stationManager->GetBasicMode (i);
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   464
    if (!rates.IsSupportedRate (mode.GetDataRate ()))
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   465
      {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   466
        return false;
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   467
      }
4865
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   468
  }
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   469
  return true;
e331ed5d3662 Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents: 4857
diff changeset
   470
}
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   471
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   472
//-----------------------------------------------------------------------------
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   473
// Beacons
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   474
//-----------------------------------------------------------------------------
4929
1689c94d7442 802.11s helper (ns3::dot11s::MeshWifiHelper) refactored
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   475
void 
1689c94d7442 802.11s helper (ns3::dot11s::MeshWifiHelper) refactored
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   476
MeshWifiInterfaceMac::SetRandomStartDelay (Time interval)
1689c94d7442 802.11s helper (ns3::dot11s::MeshWifiHelper) refactored
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   477
{
1689c94d7442 802.11s helper (ns3::dot11s::MeshWifiHelper) refactored
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   478
  NS_LOG_FUNCTION (this << interval);
1689c94d7442 802.11s helper (ns3::dot11s::MeshWifiHelper) refactored
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   479
  m_randomStart = interval;
1689c94d7442 802.11s helper (ns3::dot11s::MeshWifiHelper) refactored
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   480
}
1689c94d7442 802.11s helper (ns3::dot11s::MeshWifiHelper) refactored
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   481
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   482
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   483
MeshWifiInterfaceMac::SetBeaconInterval (Time interval)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   484
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   485
  NS_LOG_FUNCTION (this << interval);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   486
  m_beaconInterval = interval;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   487
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   488
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   489
Time
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   490
MeshWifiInterfaceMac::GetBeaconInterval () const
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   491
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   492
  return m_beaconInterval;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   493
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   494
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   495
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   496
MeshWifiInterfaceMac::SetBeaconGeneration (bool enable)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   497
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   498
  NS_LOG_FUNCTION (this << enable);
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   499
  if (enable)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   500
    {
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   501
      // Now start sending beacons after some random delay (to avoid collisions)
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   502
      UniformVariable coefficient (0.0, m_randomStart.GetSeconds());
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   503
      Time randomStart = Seconds (coefficient.GetValue());
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   504
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   505
      m_beaconSendEvent = Simulator::Schedule (randomStart, &MeshWifiInterfaceMac::SendBeacon, this);
4855
0b5980b04249 Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   506
      m_tbtt = Simulator::Now() + randomStart;
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   507
    }
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   508
  else
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   509
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   510
      // stop sending beacons
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   511
      m_beaconSendEvent.Cancel ();
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   512
    }
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   513
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   514
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   515
bool
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   516
MeshWifiInterfaceMac::GetBeaconGeneration () const
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   517
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   518
  return m_beaconSendEvent.IsRunning ();
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   519
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   520
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   521
Time
4855
0b5980b04249 Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   522
MeshWifiInterfaceMac::GetTbtt () const
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   523
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   524
  return m_tbtt;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   525
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   526
4857
ddfb13420455 Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents: 4855
diff changeset
   527
void MeshWifiInterfaceMac::ShiftTbtt (Time shift)
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   528
{
4857
ddfb13420455 Added new peer manager class, an old one we keep without change
Kirill Andreev <andreev@iitp.ru>
parents: 4855
diff changeset
   529
  // User of ShiftTbtt () must take care don't shift it to the past
4855
0b5980b04249 Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   530
  NS_ASSERT (GetTbtt() + shift > Simulator::Now());
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   531
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   532
  m_tbtt += shift;
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   533
  // Shift scheduled event
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   534
  Simulator::Cancel (m_beaconSendEvent);
4855
0b5980b04249 Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   535
  m_beaconSendEvent = Simulator::Schedule (GetTbtt () - Simulator::Now(), &MeshWifiInterfaceMac::SendBeacon, this);
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   536
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   537
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   538
void
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   539
MeshWifiInterfaceMac::ScheduleNextBeacon ()
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   540
{
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   541
  m_tbtt += GetBeaconInterval ();
4855
0b5980b04249 Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   542
  m_beaconSendEvent = Simulator::Schedule (GetBeaconInterval(), &MeshWifiInterfaceMac::SendBeacon, this);
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   543
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   544
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   545
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   546
MeshWifiInterfaceMac::SendBeacon ()
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   547
{
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   548
  NS_LOG_FUNCTION (this);
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   549
  NS_LOG_DEBUG (GetAddress() <<" is sending beacon");
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   550
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   551
  NS_ASSERT (! m_beaconSendEvent.IsRunning());
4855
0b5980b04249 Restructured helper: switch to new mac, now only beacon functionality works
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   552
  NS_ASSERT (Simulator::Now().GetMicroSeconds() == GetTbtt().GetMicroSeconds());     // assert that beacon is just on time
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   553
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   554
  // Form & send beacon
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   555
  MeshWifiBeacon beacon (GetSsid (), GetSupportedRates (), m_beaconInterval.GetMicroSeconds ());
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   556
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   557
  // Ask all plugins to add their specific information elements to beacon
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   558
  for (PluginList::const_iterator i = m_plugins.begin(); i != m_plugins.end(); ++i)
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   559
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   560
      (*i)->UpdateBeacon (beacon);
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   561
    }
4985
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   562
  m_beaconDca->Queue (beacon.CreatePacket(), beacon.CreateHeader(GetAddress (), GetMeshPointAddress ()));
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   563
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   564
  ScheduleNextBeacon ();
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   565
}
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   566
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   567
void
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   568
MeshWifiInterfaceMac::Receive (Ptr<Packet> packet, WifiMacHeader const *hdr)
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   569
{
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   570
  // Process beacon
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   571
  if ((hdr->GetAddr1() != GetAddress()) && (hdr->GetAddr1() != Mac48Address::GetBroadcast()))
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   572
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   573
      return;
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   574
    }
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   575
  if (hdr->IsBeacon ())
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   576
    {
5014
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   577
      m_stats.recvBeacons ++;
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   578
      MgtBeaconHeader beacon_hdr;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   579
      Mac48Address from = hdr->GetAddr2 ();
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   580
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   581
      packet->PeekHeader (beacon_hdr);
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   582
4869
bf6f699d4e03 Debug messages fixed
Kirill Andreev <andreev@iitp.ru>
parents: 4865
diff changeset
   583
      NS_LOG_DEBUG ("Beacon received from "<<hdr->GetAddr2()<<
bf6f699d4e03 Debug messages fixed
Kirill Andreev <andreev@iitp.ru>
parents: 4865
diff changeset
   584
                   " I am "<<GetAddress ()<<
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   585
                   " at "<<Simulator::Now ().GetMicroSeconds ()<<
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   586
                   " microseconds");
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   587
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   588
      // update supported rates
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5054
diff changeset
   589
      if (beacon_hdr.GetSsid ().IsEqual (GetSsid()))
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   590
        {
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   591
          SupportedRates rates = beacon_hdr.GetSupportedRates ();
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   592
          WifiRemoteStation * peerSta = m_stationManager->Lookup (hdr->GetAddr2 ());
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   593
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   594
          for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   595
          {
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   596
            WifiMode mode = m_phy->GetMode (i);
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   597
            if (rates.IsSupportedRate (mode.GetDataRate ()))
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   598
              {
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   599
                peerSta->AddSupportedMode (mode);
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   600
                if (rates.IsBasicRate (mode.GetDataRate ()))
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   601
                  {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   602
                    m_stationManager->AddBasicMode (mode);
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   603
                  }
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   604
              }
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   605
          }
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   606
        }
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   607
    }
5014
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   608
  else
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   609
  {
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   610
    m_stats.recvBytes += packet->GetSize ();
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   611
    m_stats.recvFrames ++;
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   612
  }
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   613
  // Filter frame through all installed plugins
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   614
  for (PluginList::iterator i = m_plugins.begin (); i != m_plugins.end(); ++i)
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   615
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   616
      bool drop = ! ((*i)->Receive(packet, *hdr));
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   617
      if (drop)
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   618
        {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   619
          return; // plugin drops frame
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   620
        }
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   621
    }
4934
345b49df838b Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents: 4929
diff changeset
   622
5115
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 5114
diff changeset
   623
  // Check if QoS tag exists and add it:
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 5114
diff changeset
   624
  if (hdr->IsQosData ())
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   625
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   626
      packet->AddPacketTag (QosTag (hdr->GetQosTid ()));
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   627
    }
4844
3c38e23fa821 Basic MAC plugins functionality implemented
Pavel Boyko <boyko@iitp.ru>
parents: 4843
diff changeset
   628
  // Forward data up
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   629
  if (hdr->IsData ())
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   630
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4844
diff changeset
   631
      ForwardUp (packet, hdr->GetAddr4(), hdr->GetAddr3());
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   632
    }
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   633
}
4985
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   634
4944
779b641cff5a Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents: 4934
diff changeset
   635
uint32_t
779b641cff5a Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents: 4934
diff changeset
   636
MeshWifiInterfaceMac::GetLinkMetric (Mac48Address peerAddress)
779b641cff5a Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents: 4934
diff changeset
   637
{
4946
f97e16db1d79 Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   638
  uint32_t metric = 1;
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   639
  if (!m_linkMetricCallback.IsNull ())
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   640
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   641
      metric = m_linkMetricCallback(peerAddress, this);
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   642
    }
4946
f97e16db1d79 Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   643
  return metric;
f97e16db1d79 Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   644
}
4985
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   645
4946
f97e16db1d79 Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   646
void
f97e16db1d79 Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   647
MeshWifiInterfaceMac::SetLinkMetricCallback (Callback<uint32_t, Mac48Address, Ptr<MeshWifiInterfaceMac> > cb)
f97e16db1d79 Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   648
{
f97e16db1d79 Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   649
  m_linkMetricCallback = cb;
f97e16db1d79 Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   650
}
4985
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   651
4946
f97e16db1d79 Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   652
Ptr<WifiRemoteStationManager>
f97e16db1d79 Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   653
MeshWifiInterfaceMac::GetStationManager()
f97e16db1d79 Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   654
{
f97e16db1d79 Added airtime link metric. packet error rate is not done yet
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   655
  return m_stationManager;
4944
779b641cff5a Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents: 4934
diff changeset
   656
}
4985
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   657
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   658
void
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   659
MeshWifiInterfaceMac::SetMeshPointAddress (Mac48Address a)
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   660
{
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   661
  m_mpAddress = a;
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   662
}
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   663
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   664
Mac48Address 
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   665
MeshWifiInterfaceMac::GetMeshPointAddress () const
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   666
{
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   667
  return m_mpAddress;
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4964
diff changeset
   668
}
5014
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   669
//Statistics:
5126
8e06088a785d Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents: 5125
diff changeset
   670
MeshWifiInterfaceMac::Statistics::Statistics () :
8e06088a785d Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents: 5125
diff changeset
   671
  recvBeacons (0),
8e06088a785d Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents: 5125
diff changeset
   672
  sentFrames (0),
8e06088a785d Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents: 5125
diff changeset
   673
  sentBytes (0),
8e06088a785d Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents: 5125
diff changeset
   674
  recvFrames (0),
8e06088a785d Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents: 5125
diff changeset
   675
  recvBytes (0)
8e06088a785d Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents: 5125
diff changeset
   676
{}
5014
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   677
void
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   678
MeshWifiInterfaceMac::Statistics::Print (std::ostream & os) const
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   679
{
5015
e460e29f9f78 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5014
diff changeset
   680
  os << "<Statistics "
5098
13ded9ff11c4 XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents: 5073
diff changeset
   681
    // TODO txBeacons
5038
0b8f9da17a56 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5020
diff changeset
   682
    "rxBeacons=\"" << recvBeacons << "\" "
0b8f9da17a56 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5020
diff changeset
   683
    "txFrames=\"" << sentFrames << "\" "
5098
13ded9ff11c4 XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents: 5073
diff changeset
   684
    "txBytes=\"" << sentBytes << "\" "
5038
0b8f9da17a56 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5020
diff changeset
   685
    "rxFrames=\"" << recvFrames << "\" "
5098
13ded9ff11c4 XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents: 5073
diff changeset
   686
    "rxBytes=\"" << recvBytes << "\"/>\n";
5014
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   687
}
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   688
void
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   689
MeshWifiInterfaceMac::Report (std::ostream & os) const
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   690
{
5015
e460e29f9f78 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5014
diff changeset
   691
  os << "<Interface "
5098
13ded9ff11c4 XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents: 5073
diff changeset
   692
    "BeaconInterval=\"" << GetBeaconInterval ().GetSeconds() << "\" "
5015
e460e29f9f78 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5014
diff changeset
   693
    "Channel=\"" << GetFrequencyChannel () << "\" "
e460e29f9f78 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5014
diff changeset
   694
    "Address = \"" << GetAddress () << "\">\n";
5014
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   695
  m_stats.Print (os);
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   696
  os << "</Interface>\n";
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   697
}
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   698
void
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   699
MeshWifiInterfaceMac::ResetStats ()
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   700
{
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   701
  m_stats = Statistics::Statistics ();
3bfccc1d8e01 Interface stats added
Kirill Andreev <andreev@iitp.ru>
parents: 5002
diff changeset
   702
}
5054
49851228eec9 Added interface helper
Kirill Andreev <andreev@iitp.ru>
parents: 5047
diff changeset
   703
void
5114
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   704
MeshWifiInterfaceMac::SetQueue (Ptr<DcaTxop> queue, AccessClass ac)
5054
49851228eec9 Added interface helper
Kirill Andreev <andreev@iitp.ru>
parents: 5047
diff changeset
   705
{
5114
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   706
  Queues::iterator i = m_queues.find(ac);
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   707
  if (i != m_queues.end ())
5114
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   708
  {
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   709
    NS_LOG_WARN("Queue is already set!");
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   710
    return;
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   711
  }
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   712
  m_queues.insert (std::make_pair(ac, queue));
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   713
  m_queues[ac]->SetLow (m_low);
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   714
  m_queues[ac]->SetManager (m_dcfManager);
5054
49851228eec9 Added interface helper
Kirill Andreev <andreev@iitp.ru>
parents: 5047
diff changeset
   715
}
49851228eec9 Added interface helper
Kirill Andreev <andreev@iitp.ru>
parents: 5047
diff changeset
   716
Ptr<DcaTxop>
5114
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   717
MeshWifiInterfaceMac::GetQueue (AccessClass ac)
5054
49851228eec9 Added interface helper
Kirill Andreev <andreev@iitp.ru>
parents: 5047
diff changeset
   718
{
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5123
diff changeset
   719
  Queues::iterator i = m_queues.find (ac);
5114
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   720
  if(i != m_queues.end ())
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   721
  {
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   722
    NS_LOG_WARN("Queue is not found! Check access class!");
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   723
    return 0;
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   724
  }
505e762ea818 Initial QoS implementation in 802.11s
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   725
  return i->second;
5054
49851228eec9 Added interface helper
Kirill Andreev <andreev@iitp.ru>
parents: 5047
diff changeset
   726
}
4843
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   727
} // namespace ns3
f65f22ef327e MeshWifiInterfaceMac just added and beacon generation refactored
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
   728