src/devices/mesh/dot11s/hwmp-protocol.cc
author Kirill Andreev <andreev@iitp.ru>
Thu, 26 Mar 2009 20:13:54 +0300
changeset 4889 279b07de3327
parent 4888 dec245c213ab
child 4891 b8db474bce60
permissions -rw-r--r--
Fixrd bugs with address extensions, broadcast frames can go through L2Routing
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
 * Authors: 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
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    21
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    22
#include "hwmp-protocol.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
    23
#include "hwmp-mac-plugin.h"
4889
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
    24
#include "hwmp-tag.h"
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    25
#include "ns3/log.h"
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    26
#include "ns3/simulator.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 "ns3/packet.h"
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4813
diff changeset
    28
#include "ns3/mesh-point-device.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
    29
#include "ns3/wifi-net-device.h"
4888
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4887
diff changeset
    30
#include "ns3/mesh-point-device.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
    31
#include "ns3/mesh-wifi-interface-mac.h"
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    32
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    33
NS_LOG_COMPONENT_DEFINE ("HwmpProtocol");
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4813
diff changeset
    34
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    35
namespace ns3 {
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    36
namespace dot11s {
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    37
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    38
NS_OBJECT_ENSURE_REGISTERED (HwmpProtocol);
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    39
TypeId
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    40
HwmpProtocol::GetTypeId ()
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    41
{
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    42
  static TypeId tid = TypeId ("ns3::HwmpProtocol")
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    43
                      .SetParent<MeshL2RoutingProtocol> ()
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    44
                      .AddConstructor<HwmpProtocol> ();
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    45
  return tid;
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    46
}
4889
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
    47
HwmpProtocol::HwmpProtocol ():
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    48
//    m_rtable (CreateObject<HwmpRtable> ()),
4889
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
    49
    m_dataSeqno(0),
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
    50
    m_hwmpSeqno(0),
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
    51
    m_maxTtl (32)
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    52
//    m_broadcastPerr (false)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    53
{
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    54
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    55
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    56
HwmpProtocol::~HwmpProtocol ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    57
{
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    58
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    59
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    60
void
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    61
HwmpProtocol::DoDispose ()
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
    62
{
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    63
#if 0
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
    64
  for (std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.begin (); i != m_timeoutDatabase.end(); i ++)
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
    65
    i->second.Cancel ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
    66
  m_timeoutDatabase.clear ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
    67
  m_seqnoDatabase.clear ();
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    68
  m_rtable = 0;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    69
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    70
  /**
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    71
   * clear routing queue:
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    72
   */
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    73
  for (
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
    74
    std::map<Mac48Address, std::queue<QueuedPacket> >::iterator i =  m_rqueue.begin ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
    75
    i != m_rqueue.end ();
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    76
    i++
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    77
  )
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    78
    {
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    79
      while (1)
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    80
        {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
    81
          if (i->second.empty ())
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    82
            break;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
    83
          i->second.pop ();
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    84
        }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    85
    }
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
    86
  m_rqueue.clear ();
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    87
  /**
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    88
   * clear HWMP states
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    89
   */
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
    90
  for (unsigned int i = 0; i < m_hwmpStates.size (); i ++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    91
    m_hwmpStates[i] = 0;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
    92
  m_hwmpStates.clear ();
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    93
#endif
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    94
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    95
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    96
bool
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
    97
HwmpProtocol::RequestRoute (
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    98
  uint32_t sourceIface,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    99
  const Mac48Address source,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   100
  const Mac48Address destination,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   101
  Ptr<Packet> packet,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   102
  uint16_t protocolType, //ethrnet 'Protocol' field
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4813
diff changeset
   103
  MeshL2RoutingProtocol::RouteReplyCallback routeReply
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   104
)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   105
{
4888
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4887
diff changeset
   106
  NS_LOG_UNCOND("Packet has come!");
4889
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   107
  //HwmpRtable::LookupResult result;
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   108
  HwmpTag tag;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   109
  if (sourceIface == GetMeshPoint ()->GetIfIndex())
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4813
diff changeset
   110
    // packet from level 3
4889
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   111
  {
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   112
    NS_LOG_UNCOND("Packet from upper layer. Broadcast frame");
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   113
    NS_ASSERT (!packet->FindFirstMatchingTag(tag));
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   114
    //Filling TAG:
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   115
    tag.SetSeqno (m_dataSeqno++);
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   116
    tag.SetAddress (Mac48Address::GetBroadcast());
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   117
    tag.SetTtl (m_maxTtl);
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   118
    if (m_dataSeqno == 0xffffffff)
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   119
      m_dataSeqno = 0;
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   120
    packet->AddTag(tag);
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   121
    if (destination == Mac48Address::GetBroadcast ())
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   122
    {
4889
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   123
      //Reply immediately
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   124
      routeReply (true, packet, source, destination, protocolType, 0xffffffff);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   125
    }
4889
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   126
    else
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   127
    {
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   128
      //NS_ASSERT(false);
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   129
    }
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   130
  }
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   131
  else
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4813
diff changeset
   132
    // packet from own interface
4889
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   133
  {
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   134
    NS_ASSERT (packet->FindFirstMatchingTag(tag));
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   135
    if (destination == Mac48Address::GetBroadcast ())
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   136
      //reply immediately
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   137
      routeReply (true, packet, source, destination, protocolType, 0xffffffff);
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   138
    else
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   139
    {
4889
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   140
      //NS_ASSERT(false);
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   141
    }
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   142
  }
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   143
#if 0
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   144
      if (destination == Mac48Address::GetBroadcast ())
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   145
        {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   146
          std::map<Mac48Address, uint32_t>::iterator i = m_seqnoDatabase.find (source);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   147
          if (i == m_seqnoDatabase.end ())
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   148
            m_seqnoDatabase[source] = tag.GetSeqno ();
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   149
          else
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   150
            {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   151
              if (i->second >= tag.GetSeqno ())
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   152
                return false;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   153
              m_seqnoDatabase[source] = tag.GetSeqno ();
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   154
            }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   155
        }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   156
    }
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   157
  if (tag.GetTtl () == 0)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   158
    return false;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   159
  tag.DecrementTtl ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   160
  if (destination == Mac48Address::GetBroadcast ())
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   161
    {
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   162
      //add RA tag RA = broadcast
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   163
      packet->RemoveAllTags ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   164
      packet->AddTag (tag);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   165
      routeReply (
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   166
        true,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   167
        packet,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   168
        source,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   169
        destination,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   170
        protocolType,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   171
        HwmpRtable::PORT_ANY
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   172
      );
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   173
      return true;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   174
    }
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   175
  result = m_rtable->LookupReactive (destination);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   176
  if (result.retransmitter == Mac48Address::GetBroadcast ())
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   177
    {
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   178
      //no actual route exists, queue packet and start route
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   179
      //discover procedure
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   180
      if (sourceIface != GetMeshPoint ()->GetIfIndex())
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   181
        {
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   182
          //Start path error procedure:
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   183
          NS_LOG_DEBUG ("Must Send PERR");
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   184
          std::vector<HwmpRtable::FailedDestination> destinations;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   185
          HwmpRtable::FailedDestination dst;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   186
          dst.seqnum = m_rtable->RequestSeqnum (destination);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   187
          dst.destination = destination;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   188
          destinations.push_back (dst);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   189
          StartPathErrorProcedure (destinations, result.ifIndex);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   190
        }
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4813
diff changeset
   191
      MeshL2RoutingProtocol::QueuedPacket pkt;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   192
      packet->RemoveAllTags ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   193
      packet->AddTag (tag);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   194
      pkt.pkt = packet;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   195
      pkt.dst = destination;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   196
      pkt.src = source;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   197
      pkt.protocol = protocolType;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   198
      pkt.reply = routeReply;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   199
      pkt.inPort = sourceIface;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   200
      QueuePacket (pkt);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   201
      for (unsigned int i = 0; i< m_requestCallback.size (); i++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   202
        {
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   203
          if ((m_modes[i] == REACTIVE) || (m_modes[i] == ROOT))
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   204
            {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   205
              if (ShouldSendPreq (destination))
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   206
                m_requestCallback[i] (destination);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   207
            }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   208
          else
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   209
            {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   210
              NS_ASSERT (false);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   211
              //PROACTIVE mode
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   212
              //lookup a default route
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   213
              result = m_rtable->LookupProactive (m_hwmpStates[i]->GetAssociatedIfaceId());
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   214
              if (result.retransmitter == Mac48Address::GetBroadcast ())
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   215
                {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   216
                  m_rtable->DeleteProactivePath (m_hwmpStates[i]->GetAssociatedIfaceId());
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   217
                  m_modes[i] = REACTIVE;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   218
                  if (ShouldSendPreq (destination))
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   219
                    m_requestCallback[i] (destination);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   220
                  continue;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   221
                }
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   222
              tag.SetAddress (result.retransmitter);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   223
              packet->RemoveAllTags ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   224
              packet->AddTag (tag);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   225
              routeReply (
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   226
                true,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   227
                packet,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   228
                source,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   229
                destination,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   230
                protocolType,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   231
                result.ifIndex
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   232
              );
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   233
            }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   234
        }
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   235
      for (unsigned int i = 0; i< m_requestCallback.size (); i++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   236
        {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   237
          m_requestCallback[i] (Mac48Address("00:00:00:00:00:19"));
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   238
        }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   239
    }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   240
  else
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   241
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   242
      tag.SetAddress (result.retransmitter);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   243
      packet->RemoveAllTags ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   244
      packet->AddTag (tag);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   245
      routeReply (
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   246
        true,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   247
        packet,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   248
        source,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   249
        destination,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   250
        protocolType,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   251
        result.ifIndex
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   252
      );
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   253
    }
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   254
#endif
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   255
  return true;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   256
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   257
bool
4888
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4887
diff changeset
   258
HwmpProtocol::Install (Ptr<MeshPointDevice> mp)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   259
{
4888
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4887
diff changeset
   260
  m_mp = mp;
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4887
diff changeset
   261
  std::vector<Ptr<NetDevice> > interfaces = mp->GetInterfaces ();
4887
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
   262
  for (std::vector<Ptr<NetDevice> >::iterator i = interfaces.begin (); i != interfaces.end(); i++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   263
    {
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   264
      //Checking netdevice:
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   265
      const WifiNetDevice * wifiNetDev = dynamic_cast<const WifiNetDevice *> (PeekPointer (*i));
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   266
      if (wifiNetDev == NULL)
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   267
        return false;
4887
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
   268
      MeshWifiInterfaceMac * mac = dynamic_cast<MeshWifiInterfaceMac *> (PeekPointer (wifiNetDev->GetMac ()));
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
   269
      if (mac == NULL)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   270
        return false;
4887
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
   271
      //Installing plugins:
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
   272
      Ptr<HwmpMacPlugin> hwmpMac = Create<HwmpMacPlugin> (wifiNetDev->GetIfIndex (), this);
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
   273
      m_interfaces[wifiNetDev->GetIfIndex ()] = hwmpMac;
cbf02c77d5c1 HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents: 4886
diff changeset
   274
      mac->InstallPlugin (hwmpMac);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   275
    }
4888
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4887
diff changeset
   276
  mp->SetRoutingProtocol(this);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   277
  return true;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   278
}
4889
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   279
bool
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   280
HwmpProtocol::DropDataFrame(uint32_t seqno, Mac48Address source)
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   281
{
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   282
  std::map<Mac48Address, uint32_t,std::less<Mac48Address> >::iterator i = m_lastDataSeqno.find (source);
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   283
  if (i == m_lastDataSeqno.end ())
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   284
    m_lastDataSeqno[source] = seqno;
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   285
  else
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   286
  {
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   287
    if (i->second >= seqno)
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   288
      return true;
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   289
    m_lastDataSeqno[source] = seqno;
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   290
  }
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   291
  return false;
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   292
}
279b07de3327 Fixrd bugs with address extensions, broadcast frames can go through L2Routing
Kirill Andreev <andreev@iitp.ru>
parents: 4888
diff changeset
   293
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   294
#if 0
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   295
void
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   296
HwmpProtocol::DisablePort (uint32_t port)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   297
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   298
  int position = 0;
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   299
  for (std::vector<Ptr<HwmpProtocolState> >::iterator i = m_hwmpStates.begin (); i != m_hwmpStates.end(); i++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   300
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   301
      if ((*i)->GetAssociatedIfaceId () == port)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   302
        {
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   303
          m_states[position] = DISABLED;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   304
          m_hwmpStates[position]->Disable ();
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   305
          return;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   306
        }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   307
      position ++;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   308
    }
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   309
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   310
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   311
void
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   312
HwmpProtocol::EnablePort (uint32_t port)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   313
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   314
  int position = 0;
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   315
  for (std::vector<Ptr<HwmpProtocolState> >::iterator i = m_hwmpStates.begin (); i != m_hwmpStates.end(); i++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   316
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   317
      if ((*i)->GetAssociatedIfaceId () == port)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   318
        {
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   319
          m_states[position] = ENABLED;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   320
          m_hwmpStates[position]->Enable ();
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   321
          return;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   322
        }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   323
      position ++;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   324
    }
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   325
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   326
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   327
void
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   328
HwmpProtocol::SetRoot (uint32_t port)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   329
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   330
  int position = 0;
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   331
  for (std::vector<Ptr<HwmpProtocolState> >::iterator i = m_hwmpStates.begin (); i != m_hwmpStates.end(); i++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   332
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   333
      if (((*i)->GetAssociatedIfaceId () == port)||(port == HwmpRtable::PORT_ANY))
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   334
        {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   335
          if (m_hwmpStates[position]->SetRoot ())
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   336
            {
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   337
              m_modes[position] = ROOT;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   338
              NS_LOG_DEBUG ("I am proactive");
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   339
            }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   340
        }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   341
      position ++;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   342
    }
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   343
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   344
void
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   345
HwmpProtocol::SetProactive (uint32_t port)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   346
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   347
  int position = 0;
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   348
  for (std::vector<Ptr<HwmpProtocolState> >::iterator i = m_hwmpStates.begin (); i != m_hwmpStates.end(); i++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   349
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   350
      if ((*i)->GetAssociatedIfaceId () == port)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   351
        {
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   352
          m_modes[position] = PROACTIVE;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   353
          return;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   354
        }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   355
      position ++;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   356
    }
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   357
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   358
bool
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   359
HwmpProtocol::IsRoot (uint32_t port)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   360
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   361
  int position = 0;
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   362
  for (std::vector<Ptr<HwmpProtocolState> >::iterator i = m_hwmpStates.begin (); i != m_hwmpStates.end(); i++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   363
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   364
      if ((*i)->GetAssociatedIfaceId () == port)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   365
        if (m_modes[position] == ROOT)
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   366
          return true;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   367
      position ++;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   368
    }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   369
  return false;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   370
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   371
void
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   372
HwmpProtocol::UnSetRoot (uint32_t port)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   373
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   374
  int position = 0;
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   375
  for (std::vector<Ptr<HwmpProtocolState> >::iterator i = m_hwmpStates.begin (); i != m_hwmpStates.end(); i++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   376
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   377
      if (((*i)->GetAssociatedIfaceId () == port)||(port == HwmpRtable::PORT_ANY))
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   378
        {
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   379
          m_modes[position] = REACTIVE;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   380
          m_hwmpStates[position]->UnSetRoot ();
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   381
        }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   382
      position ++;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   383
    }
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   384
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   385
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   386
void
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   387
HwmpProtocol::ObtainRoutingInformation (
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   388
  HwmpProtocolState::INFO info
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   389
)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   390
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   391
  switch (info.type)
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   392
    {
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   393
    case HwmpProtocolState::INFO_PREP:
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   394
      if (info.me != info.source)
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   395
        {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   396
          m_rtable->AddPrecursor (info.source, info.outPort, info.nextHop);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   397
          m_rtable->AddPrecursor (info.destination, info.outPort, info.prevHop);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   398
          NS_LOG_DEBUG ("path to "<<info.source<<" precursor is "<<info.nextHop);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   399
          NS_LOG_DEBUG ("path to "<<info.destination<<" precursor is "<<info.prevHop);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   400
        }
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   401
    case HwmpProtocolState::INFO_PREQ:
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   402
      m_rtable->AddReactivePath (
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   403
        info.destination,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   404
        info.nextHop,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   405
        info.outPort,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   406
        info.metric,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   407
        info.lifetime,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   408
        info.dsn);
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   409
      SendAllPossiblePackets (info.destination);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   410
      break;
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   411
    case HwmpProtocolState::INFO_PERR:
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   412
      //delete first subentry
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   413
    case HwmpProtocolState::INFO_PROACTIVE:
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   414
      //add information to the root MP.
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   415
      m_rtable->AddProactivePath (
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   416
        info.metric,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   417
        info.destination,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   418
        info.nextHop,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   419
        info.outPort,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   420
        info.lifetime,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   421
        info.dsn);
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   422
      //Set mode as PROACTIVE:
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   423
      SetProactive (info.outPort);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   424
      break;
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   425
    case HwmpProtocolState::INFO_NEW_PEER:
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   426
#if 0
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   427
      m_rtable->AddReactivePath (
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   428
        info.destination,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   429
        info.nextHop,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   430
        info.outPort,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   431
        info.metric,
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   432
        Seconds (0),
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   433
        0);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   434
#endif
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   435
      break;
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   436
    case HwmpProtocolState::INFO_FAILED_PEER:
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   437
      /**
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   438
       * Conditions for generating PERR
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   439
       */
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   440
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   441
      NS_LOG_DEBUG ("Failed peer"<<info.destination);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   442
      std::vector<HwmpRtable::FailedDestination> failedDestinations =
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   443
        m_rtable->GetUnreachableDestinations (info.destination, info.outPort);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   444
      /**
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   445
       * Entry about peer does not contain seqnum
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   446
       */
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   447
      HwmpRtable::FailedDestination peer;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   448
      peer.destination = info.destination;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   449
      peer.seqnum = 0;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   450
      failedDestinations.push_back (peer);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   451
      StartPathErrorProcedure (failedDestinations, info.outPort);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   452
    }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   453
    break;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   454
    default:
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   455
      return;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   456
    }
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   457
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   458
4797
9902003078aa Removed unneeded word "struct", fixed mobility model, fixed random variable
Kirill Andreev <andreev@iitp.ru>
parents: 4793
diff changeset
   459
HwmpRtable::LookupResult
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   460
HwmpProtocol::RequestRouteForAddress (const Mac48Address& dst)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   461
{
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   462
  return m_rtable->LookupReactive (dst);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   463
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   464
4797
9902003078aa Removed unneeded word "struct", fixed mobility model, fixed random variable
Kirill Andreev <andreev@iitp.ru>
parents: 4793
diff changeset
   465
HwmpRtable::LookupResult
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   466
HwmpProtocol::RequestRootPathForPort (uint32_t port)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   467
{
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   468
  return m_rtable->LookupProactive (port);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   469
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   470
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   471
void
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   472
HwmpProtocol::StartPathErrorProcedure (std::vector<HwmpRtable::FailedDestination> destinations, uint32_t port)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   473
{
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   474
  NS_LOG_DEBUG ("START PERR");
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   475
  for (unsigned int i  = 0; i < m_hwmpStates.size (); i++)
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   476
    if (m_hwmpStates[i]->GetAssociatedIfaceId () == port)
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   477
      m_pathErrorCallback[i] (destinations);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   478
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   479
std::vector<Mac48Address>
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   480
HwmpProtocol::GetRetransmittersForFailedDestinations (std::vector<HwmpRtable::FailedDestination> failedDest, uint32_t port)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   481
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   482
  std::vector<Mac48Address> retransmitters;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   483
  if (m_broadcastPerr)
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   484
    retransmitters.push_back (Mac48Address::GetBroadcast());
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   485
  else
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   486
    for (unsigned int i = 0; i < failedDest.size (); i ++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   487
      {
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   488
        std::vector<Mac48Address> precursors =
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   489
          m_rtable->GetPrecursors (failedDest[i].destination, port);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   490
        for (unsigned int j = 0; j < precursors.size (); j++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   491
          {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   492
            for (unsigned int k = 0; k < retransmitters.size (); k ++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   493
              if (retransmitters[k] == precursors[j])
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   494
                break;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   495
            retransmitters.push_back (precursors[j]);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   496
          }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   497
      }
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   498
  for (unsigned int i = 0; i < failedDest.size (); i ++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   499
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   500
      m_rtable->DeleteReactivePath (failedDest[i].destination, port);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   501
      m_rtable->DeleteProactivePath (failedDest[i].destination, port);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   502
    }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   503
  return retransmitters;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   504
}
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   505
#endif
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   506
void
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   507
HwmpProtocol::SetMaxQueueSize (int maxPacketsPerDestination)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   508
{
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   509
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   510
bool
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   511
HwmpProtocol::QueuePacket (MeshL2RoutingProtocol::QueuedPacket packet)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   512
{
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   513
#if 0
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   514
  if ((int)m_rqueue[packet.dst].size () > m_maxQueueSize)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   515
    return false;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   516
  m_rqueue[packet.dst].push (packet);
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   517
#endif
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   518
  return true;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   519
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   520
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4813
diff changeset
   521
MeshL2RoutingProtocol::QueuedPacket
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   522
HwmpProtocol::DequeuePacket (Mac48Address dst)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   523
{
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4813
diff changeset
   524
  MeshL2RoutingProtocol::QueuedPacket retval;
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   525
#if 0
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   526
  retval.pkt = NULL;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   527
  //Ptr<Packet> in this structure is NULL when queue is empty
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   528
  std::map<Mac48Address, std::queue<QueuedPacket> >:: iterator i = m_rqueue.find (dst);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   529
  if (i == m_rqueue.end ())
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   530
    return retval;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   531
  if ((int)m_rqueue[dst].size () == 0)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   532
    return retval;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   533
  if ((int)i->second.size () == 0)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   534
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   535
      m_rqueue.erase (i);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   536
      return retval;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   537
    }
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   538
  retval = m_rqueue[dst].front ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   539
  m_rqueue[dst].pop ();
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   540
#endif
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   541
  return retval;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   542
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   543
void
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   544
HwmpProtocol::SendAllPossiblePackets (Mac48Address dst)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   545
{
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   546
#if 0
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   547
  HwmpRtable::LookupResult result = m_rtable->LookupReactive (dst);
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4813
diff changeset
   548
  MeshL2RoutingProtocol::QueuedPacket packet;
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   549
  while (1)
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   550
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   551
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   552
      packet = DequeuePacket (dst);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   553
      if (packet.pkt == NULL)
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   554
        return;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   555
      //set RA tag for retransmitter:
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   556
      HwmpProtocolTag tag;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   557
      NS_ASSERT (packet.pkt->FindFirstMatchingTag(tag));
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   558
      tag.SetAddress (result.retransmitter);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   559
      NS_ASSERT (result.retransmitter != Mac48Address::GetBroadcast());
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   560
      packet.pkt->RemoveAllTags ();
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   561
      packet.pkt->AddTag (tag);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   562
      packet.reply (true, packet.pkt, packet.src, packet.dst, packet.protocol, result.ifIndex);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   563
    }
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   564
#endif
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   565
}
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   566
#if 0
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   567
bool
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   568
HwmpProtocol::ShouldSendPreq (Mac48Address dst)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   569
{
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   570
  std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.find (dst);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   571
  if (i == m_timeoutDatabase.end ())
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   572
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   573
      m_timeoutDatabase[dst] = Simulator::Schedule (
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   574
                                 MilliSeconds (2*(dot11sParameters::dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())),
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   575
                                 &HwmpProtocol::RetryPathDiscovery, this, dst, 0);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   576
      return true;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   577
    }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   578
  return false;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   579
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   580
void
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   581
HwmpProtocol::RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   582
{
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   583
  HwmpRtable::LookupResult result = m_rtable->LookupReactive (dst);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   584
  if (result.retransmitter != Mac48Address::GetBroadcast ())
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   585
    {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   586
      std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.find (dst);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   587
      NS_ASSERT (i !=  m_timeoutDatabase.end());
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   588
      m_timeoutDatabase.erase (i);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   589
      return;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   590
    }
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   591
  numOfRetry++;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   592
  if (numOfRetry > dot11sParameters::dot11MeshHWMPmaxPREQretries)
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   593
    {
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4813
diff changeset
   594
      MeshL2RoutingProtocol::QueuedPacket packet;
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   595
      //purge queue and delete entry from retryDatabase
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   596
      while (1)
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   597
        {
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   598
          packet = DequeuePacket (dst);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   599
          if (packet.pkt == NULL)
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   600
            break;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   601
          packet.reply (false, packet.pkt, packet.src, packet.dst, packet.protocol, HwmpRtable::MAX_METRIC);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   602
        }
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   603
      std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.find (dst);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   604
      NS_ASSERT (i !=  m_timeoutDatabase.end());
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   605
      m_timeoutDatabase.erase (i);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   606
      return;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   607
    }
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   608
  for (unsigned int i = 0; i < m_requestCallback.size (); i++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   609
    if ((m_modes[i] == REACTIVE) || (m_modes[i] == ROOT))
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   610
      m_requestCallback[i] (dst);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   611
  m_timeoutDatabase[dst] = Simulator::Schedule (
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4837
diff changeset
   612
                             MilliSeconds (2*(dot11sParameters::dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())),
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   613
                             &HwmpProtocol::RetryPathDiscovery, this, dst, numOfRetry);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   614
}
4886
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   615
#endif
bdbf21835837 HWMP rolled to "initial position"
Kirill Andreev <andreev@iitp.ru>
parents: 4883
diff changeset
   616
} //namespace dot11s
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   617
} //namespace ns3