src/devices/mesh/dot11s/hwmp-protocol-mac.cc
author Kirill Andreev <andreev@iitp.ru>
Wed, 22 Jul 2009 15:56:55 +0400
changeset 5130 b5062e8e0da1
parent 5129 5688b8da4526
child 5132 aee541a30256
permissions -rw-r--r--
Fixed coding style
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     2
/*
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     3
 * Copyright (c) 2008,2009 IITP RAS
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     4
 *
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     8
 *
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    12
 * GNU General Public License for more details.
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    13
 *
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    17
 *
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    18
 * Author: Kirill Andreev <andreev@iitp.ru>
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    19
 */
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    20
4887
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
    21
#include "ns3/mesh-wifi-interface-mac.h"
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
    22
#include "ns3/packet.h"
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    23
#include "ns3/simulator.h"
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    24
#include "ns3/nstime.h"
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    25
#include "ns3/log.h"
4956
aba7cae978ac MeshWifiMacHeader moved to Dot11sMacHeader. test to it is written
Kirill Andreev <andreev@iitp.ru>
parents: 4955
diff changeset
    26
#include "dot11s-mac-header.h"
4887
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
    27
#include "hwmp-protocol.h"
5086
fccfd0073ea3 Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents: 5083
diff changeset
    28
#include "hwmp-protocol-mac.h"
4889
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4887
diff changeset
    29
#include "hwmp-tag.h"
4887
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
    30
#include "ie-dot11s-preq.h"
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
    31
#include "ie-dot11s-prep.h"
5112
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
    32
#include "ie-dot11s-rann.h"
4813
e4e2c44d27cd All mesh related filed moved to devices/mesh. Let the refactoring begins!
Pavel Boyko <boyko@iitp.ru>
parents: 4812
diff changeset
    33
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    34
namespace ns3
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    35
{
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    36
namespace dot11s
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    37
{
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    38
5086
fccfd0073ea3 Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents: 5083
diff changeset
    39
NS_LOG_COMPONENT_DEFINE ("HwmpProtocolMac");
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    40
HwmpProtocolMac::HwmpProtocolMac (uint32_t ifIndex, Ptr<HwmpProtocol> protocol) :
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    41
  m_ifIndex (ifIndex), m_protocol (protocol)
4887
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
    42
{
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
    43
}
5086
fccfd0073ea3 Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents: 5083
diff changeset
    44
HwmpProtocolMac::~HwmpProtocolMac ()
4887
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
    45
{
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
    46
}
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
    47
void
5086
fccfd0073ea3 Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents: 5083
diff changeset
    48
HwmpProtocolMac::SetParent (Ptr<MeshWifiInterfaceMac> parent)
4887
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
    49
{
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
    50
  m_parent = parent;
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
    51
}
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    52
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    53
bool
5086
fccfd0073ea3 Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents: 5083
diff changeset
    54
HwmpProtocolMac::ReceiveData (Ptr<Packet> packet, const WifiMacHeader & header)
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    55
{
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    56
  NS_ASSERT (header.IsData ());
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    57
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    58
  MeshHeader meshHdr;
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    59
  HwmpTag tag;
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
    60
  if (packet->PeekPacketTag (tag))
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    61
    {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    62
      NS_FATAL_ERROR ("HWMP tag is not supposed to be received by network");
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    63
    }
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    64
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
    65
  packet->RemoveHeader (meshHdr);
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    66
  m_stats.rxData++;
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    67
  m_stats.rxDataBytes += packet->GetSize ();
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    68
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    69
  //TODO: address extension
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    70
  Mac48Address destination;
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    71
  Mac48Address source;
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    72
  switch (meshHdr.GetAddressExt ())
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    73
    {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    74
  case 0:
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    75
    source = header.GetAddr4 ();
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    76
    destination = header.GetAddr3 ();
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    77
    break;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    78
  default:
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    79
    NS_FATAL_ERROR (
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    80
        "6-address scheme is not yet supported and 4-address extension is not supposed to be used for data frames.");
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    81
    };
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    82
  tag.SetSeqno (meshHdr.GetMeshSeqno ());
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    83
  tag.SetTtl (meshHdr.GetMeshTtl ());
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
    84
  packet->AddPacketTag (tag);
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    85
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    86
  if ((destination == Mac48Address::GetBroadcast ()) && (m_protocol->DropDataFrame (meshHdr.GetMeshSeqno (),
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    87
      source)))
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
    88
    {
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    89
      return false;
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    90
    }
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    91
  return true;
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    92
}
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    93
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    94
bool
5086
fccfd0073ea3 Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents: 5083
diff changeset
    95
HwmpProtocolMac::ReceiveAction (Ptr<Packet> packet, const WifiMacHeader & header)
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    96
{
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    97
  m_stats.rxMgt++;
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    98
  m_stats.rxMgtBytes += packet->GetSize ();
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
    99
  WifiMeshActionHeader actionHdr;
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
   100
  packet->RemoveHeader (actionHdr);
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
   101
  WifiMeshActionHeader::ActionValue actionValue = actionHdr.GetAction ();
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   102
  if (actionHdr.GetCategory () != WifiMeshActionHeader::MESH_PATH_SELECTION)
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   103
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   104
      return true;
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   105
    }
5112
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   106
  IeRann rann;
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   107
  IePreq preq;
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   108
  IePrep prep;
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   109
  IePerr perr;
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   110
  while (packet->RemoveHeader (rann))
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   111
    {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   112
      NS_LOG_WARN ("RANN is not supported!");
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   113
    }
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   114
  while (packet->RemoveHeader (preq))
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   115
    {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   116
      m_stats.rxPreq++;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   117
      if (preq.GetOriginatorAddress () == m_protocol->GetAddress ())
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   118
        {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   119
          continue;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   120
        }
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   121
      if (preq.GetTtl () == 0)
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   122
        {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   123
          continue;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   124
        }
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   125
      preq.DecrementTtl ();
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   126
      m_protocol->ReceivePreq (preq, header.GetAddr2 (), m_ifIndex, header.GetAddr3 (),
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   127
          m_parent->GetLinkMetric (header.GetAddr2 ()));
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   128
    }
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   129
  while (packet->RemoveHeader (prep))
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   130
    {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   131
      m_stats.rxPrep++;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   132
      if (prep.GetTtl () == 0)
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   133
        {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   134
          continue;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   135
        }
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   136
      prep.DecrementTtl ();
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   137
      m_protocol->ReceivePrep (prep, header.GetAddr2 (), m_ifIndex, header.GetAddr3 (),
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   138
          m_parent->GetLinkMetric (header.GetAddr2 ()));
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   139
    }
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   140
  std::vector<IePerr::FailedDestination> failedDestinations;
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   141
  while (packet->RemoveHeader (perr))
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   142
    {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   143
      m_stats.rxPerr++;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   144
      std::vector<IePerr::FailedDestination> destinations = perr.GetAddressUnitVector ();
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   145
      for (std::vector<IePerr::FailedDestination>::const_iterator i = destinations.begin (); i
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   146
          != destinations.end (); i++)
5130
b5062e8e0da1 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5129
diff changeset
   147
        {
b5062e8e0da1 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5129
diff changeset
   148
          failedDestinations.push_back (*i);
b5062e8e0da1 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5129
diff changeset
   149
        }
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   150
    }
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   151
  if (failedDestinations.size () > 0)
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   152
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   153
      m_protocol->ReceivePerr (failedDestinations, header.GetAddr2 (), m_ifIndex, header.GetAddr3 ());
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   154
    }
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   155
  NS_ASSERT (packet->GetSize () == 0);
5112
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   156
  return false;
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
   157
}
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
   158
4887
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
   159
bool
5086
fccfd0073ea3 Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents: 5083
diff changeset
   160
HwmpProtocolMac::Receive (Ptr<Packet> packet, const WifiMacHeader & header)
4887
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
   161
{
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5057
diff changeset
   162
  if (header.IsData ())
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   163
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   164
      return ReceiveData (packet, header);
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   165
    }
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   166
  else
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   167
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   168
      if (header.IsAction ())
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   169
        {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   170
          return ReceiveAction (packet, header);
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   171
        }
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   172
      else
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   173
        {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   174
          return true; // don't care
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   175
        }
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   176
    }
4887
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
   177
}
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
   178
bool
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   179
HwmpProtocolMac::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Address from,
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   180
    Mac48Address to)
4887
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
   181
{
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   182
  if (!header.IsData ())
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   183
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   184
      return true;
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   185
    }
4889
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4887
diff changeset
   186
  HwmpTag tag;
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   187
  bool tagExists = packet->RemovePacketTag (tag);
5008
9650fb0087d2 Revert commit [c259eaefdd7f]. Make compiler happy.
Andrey Mazo <mazo@iitp.ru>
parents: 5002
diff changeset
   188
  if (!tagExists)
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   189
    {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   190
      NS_FATAL_ERROR ("HWMP tag must exist at this point");
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   191
    }
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   192
  m_stats.txData++;
5038
0b8f9da17a56 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5037
diff changeset
   193
  m_stats.txDataBytes += packet->GetSize ();
4994
2c25f9c66604 Dot11sMacHeader renamed to MeshHeader to correspond standard
Pavel Boyko <boyko@iitp.ru>
parents: 4991
diff changeset
   194
  MeshHeader meshHdr;
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   195
  meshHdr.SetMeshSeqno (tag.GetSeqno ());
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   196
  meshHdr.SetMeshTtl (tag.GetTtl ());
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   197
  packet->AddHeader (meshHdr);
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   198
  header.SetAddr1 (tag.GetAddress ());
4887
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
   199
  return true;
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
   200
}
5112
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   201
WifiMeshActionHeader
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   202
HwmpProtocolMac::GetWifiMeshActionHeader ()
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   203
{
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   204
  WifiMeshActionHeader actionHdr;
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   205
  WifiMeshActionHeader::ActionValue action;
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   206
  action.pathSelection = WifiMeshActionHeader::PATH_SELECTION;
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   207
  actionHdr.SetAction (WifiMeshActionHeader::MESH_PATH_SELECTION, action);
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   208
  return actionHdr;
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   209
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   210
void
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   211
HwmpProtocolMac::SendPreq (IePreq preq)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   212
{
5107
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   213
  NS_LOG_FUNCTION_NOARGS ();
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   214
  std::vector<IePreq> preq_vector;
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   215
  preq_vector.push_back (preq);
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   216
  SendPreq (preq_vector);
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   217
}
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   218
void
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   219
HwmpProtocolMac::SendPreq (std::vector<IePreq> preq)
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   220
{
5107
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   221
  Ptr<Packet> packet = Create<Packet> ();
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   222
  for (std::vector<IePreq>::const_iterator i = preq.begin (); i != preq.end (); i++)
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   223
    {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   224
      packet->AddHeader (*i);
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   225
    }
5112
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   226
  packet->AddHeader (GetWifiMeshActionHeader ());
4926
a9382a693fa1 PREQ queue bugfix, tested proactive mode, removed unnseded debug messages
Kirill Andreev <andreev@iitp.ru>
parents: 4925
diff changeset
   227
  //create 802.11 header:
a9382a693fa1 PREQ queue bugfix, tested proactive mode, removed unnseded debug messages
Kirill Andreev <andreev@iitp.ru>
parents: 4925
diff changeset
   228
  WifiMacHeader hdr;
4968
ff5a2162d492 MulthopAction -> Action management frames in 802.11s according to std
Pavel Boyko <boyko@iitp.ru>
parents: 4965
diff changeset
   229
  hdr.SetAction ();
4926
a9382a693fa1 PREQ queue bugfix, tested proactive mode, removed unnseded debug messages
Kirill Andreev <andreev@iitp.ru>
parents: 4925
diff changeset
   230
  hdr.SetDsNotFrom ();
a9382a693fa1 PREQ queue bugfix, tested proactive mode, removed unnseded debug messages
Kirill Andreev <andreev@iitp.ru>
parents: 4925
diff changeset
   231
  hdr.SetDsNotTo ();
a9382a693fa1 PREQ queue bugfix, tested proactive mode, removed unnseded debug messages
Kirill Andreev <andreev@iitp.ru>
parents: 4925
diff changeset
   232
  hdr.SetAddr2 (m_parent->GetAddress ());
4996
33f418524356 Fixed routing information with neighbours, fixed address3 in management
Kirill Andreev <andreev@iitp.ru>
parents: 4984
diff changeset
   233
  hdr.SetAddr3 (m_protocol->GetAddress ());
4926
a9382a693fa1 PREQ queue bugfix, tested proactive mode, removed unnseded debug messages
Kirill Andreev <andreev@iitp.ru>
parents: 4925
diff changeset
   234
  //Send Management frame
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   235
  std::vector<Mac48Address> receivers = m_protocol->GetPreqReceivers (m_ifIndex);
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   236
  for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != receivers.end (); i++)
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   237
    {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   238
      hdr.SetAddr1 (*i);
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   239
      m_stats.txPreq++;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   240
      m_stats.txMgt++;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   241
      m_stats.txMgtBytes += packet->GetSize ();
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   242
      m_parent->SendManagementFrame (packet, hdr);
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   243
    }
5107
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   244
}
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   245
void
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   246
HwmpProtocolMac::RequestDestination (Mac48Address dst, uint32_t originator_seqno, uint32_t dst_seqno)
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   247
{
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   248
  NS_LOG_FUNCTION_NOARGS ();
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   249
  for (std::vector<IePreq>::iterator i = m_myPreq.begin (); i != m_myPreq.end (); i++)
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   250
    {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   251
      if (i->IsFull ())
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   252
        {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   253
          continue;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   254
        }
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   255
      NS_ASSERT (i->GetDestCount () > 0);
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   256
      i->AddDestinationAddressElement (m_protocol->GetDoFlag (), m_protocol->GetRfFlag (), dst, dst_seqno);
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   257
    }
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   258
  IePreq preq;
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   259
  preq.SetHopcount (0);
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   260
  preq.SetTTL (m_protocol->GetMaxTtl ());
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   261
  preq.SetPreqID (m_protocol->GetNextPreqId ());
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   262
  preq.SetOriginatorAddress (m_protocol->GetAddress ());
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   263
  preq.SetOriginatorSeqNumber (originator_seqno);
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   264
  preq.SetLifetime (m_protocol->GetActivePathLifetime ());
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   265
  preq.AddDestinationAddressElement (m_protocol->GetDoFlag (), m_protocol->GetRfFlag (), dst, dst_seqno);
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   266
  m_myPreq.push_back (preq);
5107
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   267
  SendMyPreq ();
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   268
}
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   269
void
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   270
HwmpProtocolMac::SendMyPreq ()
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   271
{
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   272
  NS_LOG_FUNCTION_NOARGS ();
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   273
  if (m_preqTimer.IsRunning ())
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   274
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   275
      return;
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   276
    }
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   277
  if (m_myPreq.size () == 0)
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   278
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   279
      return;
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   280
    }
5107
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   281
  //reschedule sending PREQ
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   282
  NS_ASSERT (!m_preqTimer.IsRunning ());
5107
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   283
  m_preqTimer = Simulator::Schedule (m_protocol->GetPreqMinInterval (), &HwmpProtocolMac::SendMyPreq, this);
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   284
  SendPreq (m_myPreq);
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   285
  m_myPreq.clear ();
4900
0c34a34208f2 restructured precursors in rtable
Kirill Andreev <andreev@iitp.ru>
parents: 4896
diff changeset
   286
}
0c34a34208f2 restructured precursors in rtable
Kirill Andreev <andreev@iitp.ru>
parents: 4896
diff changeset
   287
void
5086
fccfd0073ea3 Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents: 5083
diff changeset
   288
HwmpProtocolMac::SendPrep (IePrep prep, Mac48Address receiver)
4900
0c34a34208f2 restructured precursors in rtable
Kirill Andreev <andreev@iitp.ru>
parents: 4896
diff changeset
   289
{
5107
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   290
  NS_LOG_FUNCTION_NOARGS ();
4895
b68a1309a89e First PREQ delivered
Kirill Andreev <andreev@iitp.ru>
parents: 4894
diff changeset
   291
  //Create packet
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   292
  Ptr<Packet> packet = Create<Packet> ();
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   293
  packet->AddHeader (prep);
5112
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   294
  packet->AddHeader (GetWifiMeshActionHeader ());
4895
b68a1309a89e First PREQ delivered
Kirill Andreev <andreev@iitp.ru>
parents: 4894
diff changeset
   295
  //create 802.11 header:
b68a1309a89e First PREQ delivered
Kirill Andreev <andreev@iitp.ru>
parents: 4894
diff changeset
   296
  WifiMacHeader hdr;
4968
ff5a2162d492 MulthopAction -> Action management frames in 802.11s according to std
Pavel Boyko <boyko@iitp.ru>
parents: 4965
diff changeset
   297
  hdr.SetAction ();
4895
b68a1309a89e First PREQ delivered
Kirill Andreev <andreev@iitp.ru>
parents: 4894
diff changeset
   298
  hdr.SetDsNotFrom ();
b68a1309a89e First PREQ delivered
Kirill Andreev <andreev@iitp.ru>
parents: 4894
diff changeset
   299
  hdr.SetDsNotTo ();
4900
0c34a34208f2 restructured precursors in rtable
Kirill Andreev <andreev@iitp.ru>
parents: 4896
diff changeset
   300
  hdr.SetAddr1 (receiver);
4895
b68a1309a89e First PREQ delivered
Kirill Andreev <andreev@iitp.ru>
parents: 4894
diff changeset
   301
  hdr.SetAddr2 (m_parent->GetAddress ());
4996
33f418524356 Fixed routing information with neighbours, fixed address3 in management
Kirill Andreev <andreev@iitp.ru>
parents: 4984
diff changeset
   302
  hdr.SetAddr3 (m_protocol->GetAddress ());
4895
b68a1309a89e First PREQ delivered
Kirill Andreev <andreev@iitp.ru>
parents: 4894
diff changeset
   303
  //Send Management frame
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   304
  m_stats.txPrep++;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   305
  m_stats.txMgt++;
5038
0b8f9da17a56 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5037
diff changeset
   306
  m_stats.txMgtBytes += packet->GetSize ();
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   307
  m_parent->SendManagementFrame (packet, hdr);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   308
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   309
void
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   310
HwmpProtocolMac::ForwardPerr (std::vector<IePerr::FailedDestination> failedDestinations, std::vector<
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   311
    Mac48Address> receivers)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   312
{
5107
ec4196c70800 Fixed PREQ propagation, added comments to PREQ information element
Kirill Andreev <andreev@iitp.ru>
parents: 5098
diff changeset
   313
  NS_LOG_FUNCTION_NOARGS ();
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   314
  Ptr<Packet> packet = Create<Packet> ();
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   315
  IePerr perr;
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   316
  for (std::vector<IePerr::FailedDestination>::const_iterator i = failedDestinations.begin (); i
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   317
      != failedDestinations.end (); i++)
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   318
    {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   319
      if (!perr.IsFull ())
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   320
        {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   321
          perr.AddAddressUnit (*i);
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   322
        }
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   323
      else
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   324
        {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   325
          packet->AddHeader (perr);
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   326
          perr.ResetPerr ();
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   327
        }
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   328
    }
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   329
  if (perr.GetNumOfDest () > 0)
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   330
    {
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   331
      packet->AddHeader (perr);
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   332
    }
5112
762835be2902 Action values are made in accordance with Draft3.0
Kirill Andreev <andreev@iitp.ru>
parents: 5111
diff changeset
   333
  packet->AddHeader (GetWifiMeshActionHeader ());
5111
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   334
  //create 802.11 header:
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   335
  WifiMacHeader hdr;
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   336
  hdr.SetAction ();
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   337
  hdr.SetDsNotFrom ();
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   338
  hdr.SetDsNotTo ();
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   339
  hdr.SetAddr2 (m_parent->GetAddress ());
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   340
  hdr.SetAddr3 (m_protocol->GetAddress ());
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   341
  if (receivers.size () >= m_protocol->GetUnicastPerrThreshold ())
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   342
    {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   343
      receivers.clear ();
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   344
      receivers.push_back (Mac48Address::GetBroadcast ());
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   345
    }
5111
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   346
  //Send Management frame
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   347
  for (std::vector<Mac48Address>::const_iterator i = m_myPerr.receivers.begin (); i
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   348
      != m_myPerr.receivers.end (); i++)
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   349
    {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   350
      hdr.SetAddr1 (*i);
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   351
      m_stats.txPerr++;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   352
      m_stats.txMgt++;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   353
      m_stats.txMgtBytes += packet->GetSize ();
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   354
      m_parent->SendManagementFrame (packet, hdr);
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   355
    }
5111
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   356
}
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   357
void
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   358
HwmpProtocolMac::InitiatePerr (std::vector<IePerr::FailedDestination> failedDestinations, std::vector<
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   359
    Mac48Address> receivers)
5111
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   360
{
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   361
  //All duplicates in PERR are checked here, and there is no reason to
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   362
  //check it at any athoer place
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   363
    {
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   364
      std::vector<Mac48Address>::const_iterator end = receivers.end ();
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   365
      for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != end; i++)
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   366
        {
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   367
          bool should_add = true;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   368
          for (std::vector<Mac48Address>::const_iterator j = m_myPerr.receivers.begin (); j
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   369
              != m_myPerr.receivers.end (); j++)
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   370
            {
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   371
              if ((*i) == (*j))
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   372
                {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   373
                  should_add = false;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   374
                }
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   375
            }
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   376
          if (should_add)
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   377
            {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   378
              m_myPerr.receivers.push_back (*i);
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   379
            }
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   380
        }
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   381
    }
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   382
    {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   383
      std::vector<IePerr::FailedDestination>::const_iterator end = failedDestinations.end ();
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   384
      for (std::vector<IePerr::FailedDestination>::const_iterator i = failedDestinations.begin (); i != end; i++)
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   385
        {
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   386
          bool should_add = true;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   387
          for (std::vector<IePerr::FailedDestination>::const_iterator j = m_myPerr.destinations.begin (); j
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   388
              != m_myPerr.destinations.end (); j++)
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   389
            {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   390
              if (((*i).destination == (*j).destination) && ((*j).seqnum > (*i).seqnum))
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   391
                {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   392
                  should_add = false;
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   393
                }
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   394
            }
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   395
          if (should_add)
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   396
            {
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   397
              m_myPerr.destinations.push_back (*i);
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   398
            }
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   399
        }
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   400
    }
5111
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   401
  SendMyPerr ();
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   402
}
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   403
void
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   404
HwmpProtocolMac::SendMyPerr ()
5111
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   405
{
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   406
  NS_LOG_FUNCTION_NOARGS ();
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   407
  if (m_perrTimer.IsRunning ())
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   408
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   409
      return;
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   410
    }
5111
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   411
  m_perrTimer = Simulator::Schedule (m_protocol->GetPerrMinInterval (), &HwmpProtocolMac::SendMyPerr, this);
5113
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   412
  ForwardPerr (m_myPerr.destinations, m_myPerr.receivers);
a912d4372406 PREQ, PREP overflow is handled correctly
Kirill Andreev <andreev@iitp.ru>
parents: 5112
diff changeset
   413
  m_myPerr.destinations.clear ();
5111
018748653ea8 Fixed PERR propagation
Kirill Andreev <andreev@iitp.ru>
parents: 5109
diff changeset
   414
  m_myPerr.receivers.clear ();
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   415
}
4944
779b641cff5a Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents: 4943
diff changeset
   416
uint32_t
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   417
HwmpProtocolMac::GetLinkMetric (Mac48Address peerAddress) const
4944
779b641cff5a Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents: 4943
diff changeset
   418
{
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5113
diff changeset
   419
  return m_parent->GetLinkMetric (peerAddress);
4944
779b641cff5a Unicast chain instead of broadcast data frame added. Metric
Kirill Andreev <andreev@iitp.ru>
parents: 4943
diff changeset
   420
}
4950
1163cfb03b9b Broadcast is not forwarded twice into the same channel
Kirill Andreev <andreev@iitp.ru>
parents: 4949
diff changeset
   421
uint16_t
5086
fccfd0073ea3 Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents: 5083
diff changeset
   422
HwmpProtocolMac::GetChannelId () const
4950
1163cfb03b9b Broadcast is not forwarded twice into the same channel
Kirill Andreev <andreev@iitp.ru>
parents: 4949
diff changeset
   423
{
1163cfb03b9b Broadcast is not forwarded twice into the same channel
Kirill Andreev <andreev@iitp.ru>
parents: 4949
diff changeset
   424
  return m_parent->GetFrequencyChannel ();
1163cfb03b9b Broadcast is not forwarded twice into the same channel
Kirill Andreev <andreev@iitp.ru>
parents: 4949
diff changeset
   425
}
5126
8e06088a785d Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents: 5125
diff changeset
   426
HwmpProtocolMac::Statistics::Statistics () :
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   427
  txPreq (0), rxPreq (0), txPrep (0), rxPrep (0), txPerr (0), rxPerr (0), txMgt (0), txMgtBytes (0),
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   428
      rxMgt (0), rxMgtBytes (0), txData (0), txDataBytes (0), rxData (0), rxDataBytes (0)
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   429
{
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   430
}
5012
c81291702113 Statistics - almost done
Kirill Andreev <andreev@iitp.ru>
parents: 5008
diff changeset
   431
void
5086
fccfd0073ea3 Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents: 5083
diff changeset
   432
HwmpProtocolMac::Statistics::Print (std::ostream & os) const
5012
c81291702113 Statistics - almost done
Kirill Andreev <andreev@iitp.ru>
parents: 5008
diff changeset
   433
{
5015
e460e29f9f78 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5013
diff changeset
   434
  os << "<Statistics "
5038
0b8f9da17a56 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5037
diff changeset
   435
    "txPreq= \"" << txPreq << "\"\n"
0b8f9da17a56 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5037
diff changeset
   436
    "txPrep=\"" << txPrep << "\"\n"
0b8f9da17a56 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5037
diff changeset
   437
    "txPerr=\"" << txPerr << "\"\n"
0b8f9da17a56 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5037
diff changeset
   438
    "rxPreq=\"" << rxPreq << "\"\n"
0b8f9da17a56 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5037
diff changeset
   439
    "rxPrep=\"" << rxPrep << "\"\n"
0b8f9da17a56 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5037
diff changeset
   440
    "rxPerr=\"" << rxPerr << "\"\n"
0b8f9da17a56 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5037
diff changeset
   441
    "txMgt=\"" << txMgt << "\"\n"
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   442
    "txMgtBytes=\"" << txMgtBytes << "\"\n"
5038
0b8f9da17a56 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5037
diff changeset
   443
    "rxMgt=\"" << rxMgt << "\"\n"
5098
13ded9ff11c4 XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents: 5086
diff changeset
   444
    "rxMgtBytes=\"" << rxMgtBytes << "\"\n"
5038
0b8f9da17a56 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5037
diff changeset
   445
    "txData=\"" << txData << "\"\n"
5098
13ded9ff11c4 XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents: 5086
diff changeset
   446
    "txDataBytes=\"" << txDataBytes << "\"\n"
5038
0b8f9da17a56 Statistics fixed
Kirill Andreev <andreev@iitp.ru>
parents: 5037
diff changeset
   447
    "rxData=\"" << rxData << "\"\n"
5098
13ded9ff11c4 XML reports simplified for better parsing
Pavel Boyko <boyko@iitp.ru>
parents: 5086
diff changeset
   448
    "rxDataBytes=\"" << rxDataBytes << "\"/>\n";
5012
c81291702113 Statistics - almost done
Kirill Andreev <andreev@iitp.ru>
parents: 5008
diff changeset
   449
}
c81291702113 Statistics - almost done
Kirill Andreev <andreev@iitp.ru>
parents: 5008
diff changeset
   450
void
5086
fccfd0073ea3 Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents: 5083
diff changeset
   451
HwmpProtocolMac::Report (std::ostream & os) const
5012
c81291702113 Statistics - almost done
Kirill Andreev <andreev@iitp.ru>
parents: 5008
diff changeset
   452
{
5086
fccfd0073ea3 Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents: 5083
diff changeset
   453
  os << "<HwmpProtocolMac\n"
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   454
    "address =\"" << m_parent->GetAddress () << "\">\n";
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   455
  m_stats.Print (os);
5086
fccfd0073ea3 Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents: 5083
diff changeset
   456
  os << "</HwmpProtocolMac>\n";
5012
c81291702113 Statistics - almost done
Kirill Andreev <andreev@iitp.ru>
parents: 5008
diff changeset
   457
}
5013
290579bb1c1b ResetStats added
Kirill Andreev <andreev@iitp.ru>
parents: 5012
diff changeset
   458
void
5086
fccfd0073ea3 Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents: 5083
diff changeset
   459
HwmpProtocolMac::ResetStats ()
5013
290579bb1c1b ResetStats added
Kirill Andreev <andreev@iitp.ru>
parents: 5012
diff changeset
   460
{
290579bb1c1b ResetStats added
Kirill Andreev <andreev@iitp.ru>
parents: 5012
diff changeset
   461
  m_stats = Statistics::Statistics ();
290579bb1c1b ResetStats added
Kirill Andreev <andreev@iitp.ru>
parents: 5012
diff changeset
   462
}
290579bb1c1b ResetStats added
Kirill Andreev <andreev@iitp.ru>
parents: 5012
diff changeset
   463
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4884
diff changeset
   464
} //namespace dot11s
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   465
}//namespace ns3