src/devices/mesh/mesh-point-device.cc
author Kirill Andreev <andreev@iitp.ru>
Thu, 18 Jun 2009 16:50:52 +0400
changeset 5084 ddf23699f0b7
parent 5083 5b154b30a8a1
child 5091 15b8fe26aa0d
permissions -rw-r--r--
Initial flame implementation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     2
/*
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     3
 * Copyright (c) 2008,2009 IITP RAS
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     4
 *
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     8
 *
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    12
 * GNU General Public License for more details.
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    13
 *
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    17
 *
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    18
 * Author: Kirill Andreev <andreev@iitp.ru>
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4815
diff changeset
    19
 *         Pavel Boyko <boyko@iitp.ru>
4793
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
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    22
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    23
#include "ns3/node.h"
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    24
#include "ns3/packet.h"
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    25
#include "ns3/log.h"
4967
ba4b79124d30 Fix after update from ns-3-dev: substitute removed NetDevice::GetName() method.
Andrey Mazo <mazo@iitp.ru>
parents: 4953
diff changeset
    26
#include "ns3/pointer.h"
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4815
diff changeset
    27
#include "ns3/mesh-point-device.h"
4985
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
    28
#include "ns3/wifi-net-device.h"
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
    29
#include "ns3/mesh-wifi-interface-mac.h"
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    30
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    31
NS_LOG_COMPONENT_DEFINE ("MeshPointDevice");
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    32
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    33
namespace ns3 {
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    34
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    35
NS_OBJECT_ENSURE_REGISTERED (MeshPointDevice);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    36
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    37
TypeId
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    38
MeshPointDevice::GetTypeId ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    39
{
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    40
  static TypeId tid = TypeId ("ns3::MeshPointDevice")
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    41
                      .SetParent<NetDevice> ()
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    42
                      .AddConstructor<MeshPointDevice> ()
4928
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
    43
                      .AddAttribute ("RoutingProtocol", "The mesh routing protocol used by this mesh point.",
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
    44
                          PointerValue (),
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
    45
                          MakePointerAccessor (&MeshPointDevice::GetRoutingProtocol,
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
    46
                                               &MeshPointDevice::SetRoutingProtocol),
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
    47
                          MakePointerChecker<MeshL2RoutingProtocol> ())
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    48
                      ;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    49
  return tid;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    50
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    51
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    52
MeshPointDevice::MeshPointDevice () : m_ifIndex (0), m_mtu(1500)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    53
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    54
  NS_LOG_FUNCTION_NOARGS ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    55
  m_channel = CreateObject<BridgeChannel> ();
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    56
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    57
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    58
MeshPointDevice::~MeshPointDevice ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    59
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    60
  NS_LOG_FUNCTION_NOARGS ();
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    61
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    62
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    63
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    64
MeshPointDevice::DoDispose ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    65
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    66
  NS_LOG_FUNCTION_NOARGS ();
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    67
  for (std::vector< Ptr<NetDevice> >::iterator iter = m_ifaces.begin (); iter != m_ifaces.end (); iter++)
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    68
    *iter = 0;
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    69
  m_ifaces.clear ();
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    70
  m_node = 0;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    71
  NetDevice::DoDispose ();
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    72
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    73
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    74
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    75
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    76
// NetDevice interface implementation
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    77
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    78
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    79
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    80
MeshPointDevice::ReceiveFromDevice (Ptr<NetDevice> incomingPort, Ptr<const Packet> packet, uint16_t protocol,
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    81
                                       Address const &src, Address const &dst, PacketType packetType)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    82
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    83
  NS_LOG_FUNCTION_NOARGS ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    84
  NS_LOG_DEBUG ("UID is " << packet->GetUid ());
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    85
  const Mac48Address src48 = Mac48Address::ConvertFrom (src);
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    86
  const Mac48Address dst48 = Mac48Address::ConvertFrom (dst);
5083
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
    87
  uint16_t& realProtocol = protocol;
4953
0226369989a3 Added {} in 'if' where ASSERT exists
Kirill Andreev <andreev@iitp.ru>
parents: 4947
diff changeset
    88
  NS_LOG_DEBUG ("SRC="<<src48<<", DST = "<<dst48<<", I am: "<<m_address);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    89
  if (!m_promiscRxCallback.IsNull ())
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    90
    m_promiscRxCallback (this, packet, protocol, src, dst, packetType);
5057
95a72c98f08d Added dot11s installator, fixed bug with adding tag in proactive mode of HWMP
Kirill Andreev <andreev@iitp.ru>
parents: 4996
diff changeset
    91
  if(dst48.IsGroup ())
4947
c665ebbe99a7 Bugfixes
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
    92
  {
5083
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
    93
    Ptr<Packet> packet_copy = packet->Copy ();
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
    94
    if(m_removeRoutingStuff (incomingPort->GetIfIndex(), src48, dst48, packet_copy, realProtocol))
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
    95
    {
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
    96
      m_rxCallback (this, packet_copy, realProtocol, src);
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
    97
      Forward (incomingPort, packet, protocol, src48, dst48);
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
    98
    }
4947
c665ebbe99a7 Bugfixes
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
    99
    return;
c665ebbe99a7 Bugfixes
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   100
  }
c665ebbe99a7 Bugfixes
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   101
  if(dst48 == m_address)
5084
ddf23699f0b7 Initial flame implementation
Kirill Andreev <andreev@iitp.ru>
parents: 5083
diff changeset
   102
  {
5083
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
   103
    Ptr<Packet> packet_copy = packet->Copy ();
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
   104
    if(m_removeRoutingStuff (incomingPort->GetIfIndex (), src48, dst48, packet_copy, realProtocol))
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
   105
    {
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
   106
      m_rxCallback (this, packet_copy, realProtocol, src);
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
   107
    }
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
   108
    return;
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
   109
  }
4947
c665ebbe99a7 Bugfixes
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   110
  else
c665ebbe99a7 Bugfixes
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   111
    Forward (incomingPort, packet->Copy (), protocol, src48, dst48);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   112
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   113
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   114
void
5070
c70964936d2e added 'const' label to packet in MeshPointDevice::Forward and
Kirill Andreev <andreev@iitp.ru>
parents: 5068
diff changeset
   115
MeshPointDevice::Forward (Ptr<NetDevice> inport, Ptr<const Packet> packet,
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   116
                             uint16_t protocol, const Mac48Address src, const Mac48Address dst)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   117
{
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   118
  // pass through routing protocol
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   119
  m_requestRoute (inport->GetIfIndex(), src, dst, packet, protocol, m_myResponse);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   120
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   121
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   122
void
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   123
MeshPointDevice::SetName (const std::string name)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   124
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   125
  NS_LOG_FUNCTION_NOARGS ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   126
  m_name = name;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   127
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   128
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   129
std::string
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   130
MeshPointDevice::GetName () const
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   131
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   132
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   133
  return m_name;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   134
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   135
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   136
void
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   137
MeshPointDevice::SetIfIndex (const uint32_t index)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   138
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   139
  NS_LOG_FUNCTION_NOARGS ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   140
  m_ifIndex = index;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   141
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   142
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   143
uint32_t
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   144
MeshPointDevice::GetIfIndex () const
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   145
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   146
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   147
  return m_ifIndex;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   148
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   149
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   150
Ptr<Channel>
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   151
MeshPointDevice::GetChannel () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   152
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   153
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   154
  return m_channel;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   155
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   156
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   157
Address
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   158
MeshPointDevice::GetAddress () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   159
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   160
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   161
  return m_address;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   162
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   163
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   164
bool
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   165
MeshPointDevice::SetMtu (const uint16_t mtu)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   166
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   167
  NS_LOG_FUNCTION_NOARGS ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   168
  m_mtu = mtu;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   169
  return true;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   170
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   171
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   172
uint16_t
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   173
MeshPointDevice::GetMtu () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   174
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   175
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   176
  return m_mtu;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   177
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   178
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   179
bool
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   180
MeshPointDevice::IsLinkUp () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   181
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   182
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   183
  return true;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   184
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   185
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   186
void
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   187
MeshPointDevice::SetLinkChangeCallback (Callback<void> callback)
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   188
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   189
  // do nothing
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   190
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   191
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   192
bool
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   193
MeshPointDevice::IsBroadcast () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   194
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   195
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   196
  return true;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   197
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   198
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   199
Address
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   200
MeshPointDevice::GetBroadcast () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   201
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   202
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   203
  return Mac48Address ("ff:ff:ff:ff:ff:ff");
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   204
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   205
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   206
bool
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   207
MeshPointDevice::IsMulticast () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   208
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   209
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   210
  return true;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   211
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   212
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   213
Address
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   214
MeshPointDevice::GetMulticast (Ipv4Address multicastGroup) const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   215
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   216
  NS_LOG_FUNCTION (this << multicastGroup);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   217
  Mac48Address multicast = Mac48Address::GetMulticast (multicastGroup);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   218
  return multicast;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   219
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   220
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   221
bool
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   222
MeshPointDevice::IsPointToPoint () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   223
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   224
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   225
  return false;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   226
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   227
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   228
bool
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   229
MeshPointDevice::IsBridge () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   230
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   231
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   232
  return false;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   233
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   234
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   235
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   236
bool
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   237
MeshPointDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   238
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   239
  const Mac48Address dst48 = Mac48Address::ConvertFrom (dest);
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   240
  return m_requestRoute (m_ifIndex, m_address, dst48, packet, protocolNumber, m_myResponse);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   241
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   242
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   243
bool
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   244
MeshPointDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address& dest, uint16_t protocolNumber)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   245
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   246
  const Mac48Address src48 = Mac48Address::ConvertFrom (src);
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   247
  const Mac48Address dst48 = Mac48Address::ConvertFrom (dest);
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   248
  return m_requestRoute (m_ifIndex, src48, dst48, packet, protocolNumber, m_myResponse);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   249
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   250
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   251
Ptr<Node>
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   252
MeshPointDevice::GetNode () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   253
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   254
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   255
  return m_node;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   256
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   257
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   258
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   259
MeshPointDevice::SetNode (Ptr<Node> node)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   260
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   261
  NS_LOG_FUNCTION_NOARGS ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   262
  m_node = node;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   263
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   264
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   265
bool
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   266
MeshPointDevice::NeedsArp () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   267
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   268
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   269
  return true;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   270
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   271
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   272
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   273
MeshPointDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   274
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   275
  NS_LOG_FUNCTION_NOARGS ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   276
  m_rxCallback = cb;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   277
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   278
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   279
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   280
MeshPointDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   281
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   282
  NS_LOG_FUNCTION_NOARGS ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   283
  m_promiscRxCallback = cb;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   284
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   285
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   286
bool
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   287
MeshPointDevice::SupportsSendFrom () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   288
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   289
  NS_LOG_FUNCTION_NOARGS ();
4986
73ca74882f12 don't allow bridge mesh points
Pavel Boyko <boyko@iitp.ru>
parents: 4985
diff changeset
   290
  return false; // don't allow to bridge mesh network with something else.
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   291
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   292
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   293
Address
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   294
MeshPointDevice::GetMulticast (Ipv6Address addr) const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   295
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   296
  NS_LOG_FUNCTION (this << addr);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   297
  return Mac48Address::GetMulticast (addr);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   298
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   299
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   300
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   301
// Interfaces
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   302
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   303
uint32_t
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   304
MeshPointDevice::GetNInterfaces () const
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   305
{
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   306
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   307
  return m_ifaces.size ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   308
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   309
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   310
Ptr<NetDevice>
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   311
MeshPointDevice::GetInterface (uint32_t n) const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   312
{
4932
Kirill Andreev <andreev@iitp.ru>
parents: 4928
diff changeset
   313
  for(std::vector< Ptr<NetDevice> >::const_iterator i = m_ifaces.begin (); i != m_ifaces.end (); i ++)
Kirill Andreev <andreev@iitp.ru>
parents: 4928
diff changeset
   314
    if((*i)->GetIfIndex() == n)
Kirill Andreev <andreev@iitp.ru>
parents: 4928
diff changeset
   315
      return (*i);
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5060
diff changeset
   316
  
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5060
diff changeset
   317
  NS_FATAL_ERROR ("Mesh point interface is not found by index");
4932
Kirill Andreev <andreev@iitp.ru>
parents: 4928
diff changeset
   318
  return 0;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   319
}
4888
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   320
std::vector<Ptr<NetDevice> >
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   321
MeshPointDevice::GetInterfaces () const
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   322
{
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   323
  return m_ifaces;
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   324
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   325
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   326
MeshPointDevice::AddInterface (Ptr<NetDevice> iface)
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   327
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   328
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   329
  
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   330
  NS_ASSERT (iface != this);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   331
  if (!Mac48Address::IsMatchingType (iface->GetAddress ()))
4953
0226369989a3 Added {} in 'if' where ASSERT exists
Kirill Andreev <andreev@iitp.ru>
parents: 4947
diff changeset
   332
  {
4985
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   333
    NS_FATAL_ERROR ("Device does not support eui 48 addresses: cannot be used as a mesh point interface.");
4953
0226369989a3 Added {} in 'if' where ASSERT exists
Kirill Andreev <andreev@iitp.ru>
parents: 4947
diff changeset
   334
  }
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   335
  if (!iface->SupportsSendFrom ())
4953
0226369989a3 Added {} in 'if' where ASSERT exists
Kirill Andreev <andreev@iitp.ru>
parents: 4947
diff changeset
   336
  {
4985
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   337
    NS_FATAL_ERROR ("Device does not support SendFrom: cannot be used as a mesh point interface.");
4953
0226369989a3 Added {} in 'if' where ASSERT exists
Kirill Andreev <andreev@iitp.ru>
parents: 4947
diff changeset
   338
  }
4985
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   339
  
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   340
  // Mesh point has MAC address of it's first interface
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   341
  if (m_ifaces.empty()) 
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   342
    m_address = Mac48Address::ConvertFrom (iface->GetAddress ());
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   343
  
4985
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   344
  const WifiNetDevice * wifiNetDev = dynamic_cast<const WifiNetDevice *> (PeekPointer (iface));
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   345
  if (wifiNetDev == 0)
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   346
    NS_FATAL_ERROR ("Device is not a WiFi NIC: cannot be used as a mesh point interface.");
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   347
      
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   348
  MeshWifiInterfaceMac * ifaceMac = dynamic_cast<MeshWifiInterfaceMac *> (PeekPointer (wifiNetDev->GetMac ()));
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   349
  if (ifaceMac == 0)
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   350
    NS_FATAL_ERROR ("WiFi device doesn't have correct MAC installed: cannot be used as a mesh point interface.");
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   351
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   352
  ifaceMac->SetMeshPointAddress (m_address);
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   353
  
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   354
  // Receive frames from this interface
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   355
  m_node->RegisterProtocolHandler (MakeCallback (&MeshPointDevice::ReceiveFromDevice, this),
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   356
                                   0, iface, /*promiscuous = */true);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   357
  
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   358
  m_ifaces.push_back (iface);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   359
  m_channel->AddChannel (iface->GetChannel ());
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   360
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   361
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   362
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   363
// Protocols
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   364
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   365
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4815
diff changeset
   366
void
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   367
MeshPointDevice::SetRoutingProtocol (Ptr<MeshL2RoutingProtocol> protocol)
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   368
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   369
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   370
  
4985
8dbdba66f5e1 Mehs point MAC address is now known to all interfaces and included into beacons as Address3
Pavel Boyko <boyko@iitp.ru>
parents: 4967
diff changeset
   371
  NS_ASSERT_MSG (PeekPointer(protocol->GetMeshPoint()) == this, "Routing protocol must be installed on mesh point to be useful.");
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4815
diff changeset
   372
  
4928
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   373
  m_routingProtocol = protocol;
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   374
  m_requestRoute = MakeCallback (&MeshL2RoutingProtocol::RequestRoute, protocol);
5083
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
   375
  m_removeRoutingStuff = MakeCallback (&MeshL2RoutingProtocol::RemoveRoutingStuff, protocol);
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   376
  m_myResponse = MakeCallback (&MeshPointDevice::DoSend, this);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   377
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   378
4928
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   379
Ptr<MeshL2RoutingProtocol>
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   380
MeshPointDevice::GetRoutingProtocol () const
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   381
{
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   382
  return m_routingProtocol;
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   383
}
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   384
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   385
void
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   386
MeshPointDevice::DoSend (bool success, Ptr<Packet> packet, Mac48Address src, Mac48Address dst, uint16_t protocol, uint32_t outIface)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   387
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   388
  if (!success)
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   389
    {
4996
33f418524356 Fixed routing information with neighbours, fixed address3 in management
Kirill Andreev <andreev@iitp.ru>
parents: 4987
diff changeset
   390
      NS_LOG_DEBUG ("Resolve failed");
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   391
      return;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   392
    }
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   393
  // Ok, now I know the route, just SendFrom
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   394
  if (outIface != 0xffffffff)
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   395
    GetInterface (outIface)->SendFrom(packet, src, dst, protocol);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   396
  else
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   397
    for (std::vector<Ptr<NetDevice> >::iterator i = m_ifaces.begin (); i != m_ifaces.end(); i++)
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   398
      (*i) -> SendFrom (packet, src, dst, protocol);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   399
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   400
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   401
} // namespace ns3