src/mesh/model/mesh-point-device.cc
author Tom Henderson <tomh@tomh.org>
Tue, 05 May 2015 19:07:17 -0700
changeset 11373 03ebade19d98
parent 11014 afbd865a0935
permissions -rw-r--r--
SetGroupName for mesh module
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents: 7178
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
4793
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
#include "ns3/node.h"
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    23
#include "ns3/packet.h"
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    24
#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
    25
#include "ns3/pointer.h"
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4815
diff changeset
    26
#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
    27
#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
    28
#include "ns3/mesh-wifi-interface-mac.h"
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    29
10968
2d29fee2b7b8 [Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10652
diff changeset
    30
namespace ns3 {
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    31
10968
2d29fee2b7b8 [Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10652
diff changeset
    32
NS_LOG_COMPONENT_DEFINE ("MeshPointDevice");
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    33
10652
dc18deba4502 [doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10410
diff changeset
    34
NS_OBJECT_ENSURE_REGISTERED (MeshPointDevice);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    35
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    36
TypeId
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    37
MeshPointDevice::GetTypeId ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    38
{
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    39
  static TypeId tid = TypeId ("ns3::MeshPointDevice")
7178
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
    40
    .SetParent<NetDevice> ()
11373
03ebade19d98 SetGroupName for mesh module
Tom Henderson <tomh@tomh.org>
parents: 11014
diff changeset
    41
    .SetGroupName ("Dsr")
7178
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
    42
    .AddConstructor<MeshPointDevice> ()
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
    43
    .AddAttribute ("Mtu", "The MAC-level Maximum Transmission Unit",
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
    44
                   UintegerValue (0xffff),
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
    45
                   MakeUintegerAccessor (&MeshPointDevice::SetMtu,
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
    46
                                         &MeshPointDevice::GetMtu),
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
    47
                   MakeUintegerChecker<uint16_t> ())
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
    48
    .AddAttribute ( "RoutingProtocol",
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
    49
                    "The mesh routing protocol used by this mesh point.",
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
    50
                    PointerValue (),
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
    51
                    MakePointerAccessor (
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    52
                      &MeshPointDevice::GetRoutingProtocol, &MeshPointDevice::SetRoutingProtocol),
7178
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
    53
                    MakePointerChecker<
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
    54
                      MeshL2RoutingProtocol> ());
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    55
  return tid;
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
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    58
MeshPointDevice::MeshPointDevice () :
6183
8a5e1f9db873 [bug 822] Move Mtu attribute from NetDevice base class to subclasses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 5422
diff changeset
    59
  m_ifIndex (0)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    60
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
    61
  NS_LOG_FUNCTION (this);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    62
  m_channel = CreateObject<BridgeChannel> ();
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    63
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    64
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    65
MeshPointDevice::~MeshPointDevice ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    66
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
    67
  NS_LOG_FUNCTION (this);
5416
9800d5479341 release Ptrs in mesh-point-device
Craig Dowell <craigdo@ee.washington.edu>
parents: 5180
diff changeset
    68
  m_node = 0;
9800d5479341 release Ptrs in mesh-point-device
Craig Dowell <craigdo@ee.washington.edu>
parents: 5180
diff changeset
    69
  m_channel = 0;
9800d5479341 release Ptrs in mesh-point-device
Craig Dowell <craigdo@ee.washington.edu>
parents: 5180
diff changeset
    70
  m_routingProtocol = 0;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    71
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    72
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    73
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    74
MeshPointDevice::DoDispose ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    75
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
    76
  NS_LOG_FUNCTION (this);
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    77
  for (std::vector<Ptr<NetDevice> >::iterator iter = m_ifaces.begin (); iter != m_ifaces.end (); iter++)
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5101
diff changeset
    78
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5101
diff changeset
    79
      *iter = 0;
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5101
diff changeset
    80
    }
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    81
  m_ifaces.clear ();
5422
21a4f34518ff bug 711: example mesh/mesh fails valgrind.
Andrey Mazo <mazo@iitp.ru>
parents: 5416
diff changeset
    82
  m_node = 0;
21a4f34518ff bug 711: example mesh/mesh fails valgrind.
Andrey Mazo <mazo@iitp.ru>
parents: 5416
diff changeset
    83
  m_channel = 0;
21a4f34518ff bug 711: example mesh/mesh fails valgrind.
Andrey Mazo <mazo@iitp.ru>
parents: 5416
diff changeset
    84
  m_routingProtocol = 0;
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    85
  NetDevice::DoDispose ();
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    86
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    87
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    88
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    89
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    90
// NetDevice interface implementation
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    91
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    92
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    93
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    94
MeshPointDevice::ReceiveFromDevice (Ptr<NetDevice> incomingPort, Ptr<const Packet> packet, uint16_t protocol,
7178
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
    95
                                    Address const &src, Address const &dst, PacketType packetType)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    96
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
    97
  NS_LOG_FUNCTION (this << incomingPort << packet);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    98
  NS_LOG_DEBUG ("UID is " << packet->GetUid ());
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    99
  const Mac48Address src48 = Mac48Address::ConvertFrom (src);
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   100
  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
   101
  uint16_t& realProtocol = protocol;
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   102
  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
   103
  if (!m_promiscRxCallback.IsNull ())
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   104
    {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   105
      m_promiscRxCallback (this, packet, protocol, src, dst, packetType);
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   106
    }
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   107
  if (dst48.IsGroup ())
5083
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
   108
    {
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   109
      Ptr<Packet> packet_copy = packet->Copy ();
5163
f1119f03b7a9 Code review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5156
diff changeset
   110
      if (m_routingProtocol->RemoveRoutingStuff (incomingPort->GetIfIndex (), src48, dst48, packet_copy, realProtocol))
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   111
        {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   112
          m_rxCallback (this, packet_copy, realProtocol, src);
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   113
          Forward (incomingPort, packet, protocol, src48, dst48);
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   114
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   115
          m_rxStats.broadcastData++;
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   116
          m_rxStats.broadcastDataBytes += packet->GetSize ();
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   117
        }
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   118
      return;
5083
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
   119
    }
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   120
  if (dst48 == m_address)
5083
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
   121
    {
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   122
      Ptr<Packet> packet_copy = packet->Copy ();
5163
f1119f03b7a9 Code review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5156
diff changeset
   123
      if (m_routingProtocol->RemoveRoutingStuff (incomingPort->GetIfIndex (), src48, dst48, packet_copy, realProtocol))
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   124
        {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   125
          m_rxCallback (this, packet_copy, realProtocol, src);
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   126
          m_rxStats.unicastData++;
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   127
          m_rxStats.unicastDataBytes += packet->GetSize ();
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   128
        }
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   129
      return;
5083
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
   130
    }
4947
c665ebbe99a7 Bugfixes
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   131
  else
c665ebbe99a7 Bugfixes
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   132
    Forward (incomingPort, packet->Copy (), protocol, src48, dst48);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   133
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   134
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   135
void
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   136
MeshPointDevice::Forward (Ptr<NetDevice> inport, Ptr<const Packet> packet, uint16_t protocol,
7178
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   137
                          const Mac48Address src, const Mac48Address dst)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   138
{
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   139
  // pass through routing protocol
5163
f1119f03b7a9 Code review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5156
diff changeset
   140
  m_routingProtocol->RequestRoute (inport->GetIfIndex (), src, dst, packet, protocol, MakeCallback (
7178
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   141
                                     &MeshPointDevice::DoSend, this));
4793
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
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   144
void
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   145
MeshPointDevice::SetIfIndex (const uint32_t index)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   146
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   147
  NS_LOG_FUNCTION (this);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   148
  m_ifIndex = index;
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
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   151
uint32_t
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   152
MeshPointDevice::GetIfIndex () const
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   153
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   154
  NS_LOG_FUNCTION (this);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   155
  return m_ifIndex;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   156
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   157
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   158
Ptr<Channel>
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   159
MeshPointDevice::GetChannel () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   160
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   161
  NS_LOG_FUNCTION (this);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   162
  return m_channel;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   163
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   164
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   165
Address
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   166
MeshPointDevice::GetAddress () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   167
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   168
  NS_LOG_FUNCTION (this);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   169
  return m_address;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   170
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   171
5101
41589d492ca3 MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents: 5098
diff changeset
   172
void
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   173
MeshPointDevice::SetAddress (Address a)
5101
41589d492ca3 MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents: 5098
diff changeset
   174
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   175
  NS_LOG_FUNCTION (this);
5101
41589d492ca3 MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents: 5098
diff changeset
   176
  NS_LOG_WARN ("Manual changing mesh point address can cause routing errors.");
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   177
  m_address = Mac48Address::ConvertFrom (a);
5101
41589d492ca3 MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents: 5098
diff changeset
   178
}
41589d492ca3 MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents: 5098
diff changeset
   179
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   180
bool
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   181
MeshPointDevice::SetMtu (const uint16_t mtu)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   182
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   183
  NS_LOG_FUNCTION (this);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   184
  m_mtu = mtu;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   185
  return true;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   186
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   187
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   188
uint16_t
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   189
MeshPointDevice::GetMtu () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   190
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   191
  NS_LOG_FUNCTION (this);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   192
  return m_mtu;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   193
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   194
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   195
bool
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   196
MeshPointDevice::IsLinkUp () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   197
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   198
  NS_LOG_FUNCTION (this);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   199
  return true;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   200
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   201
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   202
void
5180
689a0ed6de25 Build fix
Kirill Andreev <andreev@iitp.ru>
parents: 5163
diff changeset
   203
MeshPointDevice::AddLinkChangeCallback (Callback<void> callback)
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   204
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   205
  NS_LOG_FUNCTION (this);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   206
  // do nothing
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   207
  NS_LOG_WARN ("AddLinkChangeCallback does nothing");
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   208
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   209
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   210
bool
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   211
MeshPointDevice::IsBroadcast () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   212
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   213
  NS_LOG_FUNCTION (this);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   214
  return true;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   215
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   216
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   217
Address
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   218
MeshPointDevice::GetBroadcast () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   219
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   220
  NS_LOG_FUNCTION (this);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   221
  return Mac48Address ("ff:ff:ff:ff:ff:ff");
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   222
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   223
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   224
bool
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   225
MeshPointDevice::IsMulticast () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   226
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   227
  NS_LOG_FUNCTION (this);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   228
  return true;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   229
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   230
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   231
Address
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   232
MeshPointDevice::GetMulticast (Ipv4Address multicastGroup) const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   233
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   234
  NS_LOG_FUNCTION (this << multicastGroup);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   235
  Mac48Address multicast = Mac48Address::GetMulticast (multicastGroup);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   236
  return multicast;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   237
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   238
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   239
bool
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   240
MeshPointDevice::IsPointToPoint () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   241
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   242
  NS_LOG_FUNCTION (this);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   243
  return false;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   244
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   245
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   246
bool
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   247
MeshPointDevice::IsBridge () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   248
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   249
  NS_LOG_FUNCTION (this);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   250
  return false;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   251
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   252
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   253
bool
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   254
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
   255
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   256
  NS_LOG_FUNCTION (this);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   257
  const Mac48Address dst48 = Mac48Address::ConvertFrom (dest);
5163
f1119f03b7a9 Code review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5156
diff changeset
   258
  return m_routingProtocol->RequestRoute (m_ifIndex, m_address, dst48, packet, protocolNumber, MakeCallback (
7178
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   259
                                            &MeshPointDevice::DoSend, this));
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   260
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   261
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   262
bool
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   263
MeshPointDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address& dest,
7178
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   264
                           uint16_t protocolNumber)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   265
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   266
  NS_LOG_FUNCTION (this);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   267
  const Mac48Address src48 = Mac48Address::ConvertFrom (src);
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   268
  const Mac48Address dst48 = Mac48Address::ConvertFrom (dest);
5163
f1119f03b7a9 Code review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5156
diff changeset
   269
  return m_routingProtocol->RequestRoute (m_ifIndex, src48, dst48, packet, protocolNumber, MakeCallback (
7178
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   270
                                            &MeshPointDevice::DoSend, this));
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   271
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   272
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   273
Ptr<Node>
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   274
MeshPointDevice::GetNode () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   275
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   276
  NS_LOG_FUNCTION (this);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   277
  return m_node;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   278
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   279
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   280
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   281
MeshPointDevice::SetNode (Ptr<Node> node)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   282
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   283
  NS_LOG_FUNCTION (this);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   284
  m_node = node;
4793
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
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   287
bool
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   288
MeshPointDevice::NeedsArp () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   289
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   290
  NS_LOG_FUNCTION (this);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   291
  return true;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   292
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   293
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   294
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   295
MeshPointDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   296
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   297
  NS_LOG_FUNCTION (this);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   298
  m_rxCallback = cb;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   299
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   300
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   301
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   302
MeshPointDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   303
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   304
  NS_LOG_FUNCTION (this);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   305
  m_promiscRxCallback = cb;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   306
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   307
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   308
bool
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   309
MeshPointDevice::SupportsSendFrom () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   310
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   311
  NS_LOG_FUNCTION (this);
4986
73ca74882f12 don't allow bridge mesh points
Pavel Boyko <boyko@iitp.ru>
parents: 4985
diff changeset
   312
  return false; // don't allow to bridge mesh network with something else.
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   313
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   314
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   315
Address
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   316
MeshPointDevice::GetMulticast (Ipv6Address addr) const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   317
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   318
  NS_LOG_FUNCTION (this << addr);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   319
  return Mac48Address::GetMulticast (addr);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   320
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   321
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   322
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   323
// Interfaces
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   324
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   325
uint32_t
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   326
MeshPointDevice::GetNInterfaces () const
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   327
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   328
  NS_LOG_FUNCTION (this);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   329
  return m_ifaces.size ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   330
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   331
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   332
Ptr<NetDevice>
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   333
MeshPointDevice::GetInterface (uint32_t n) const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   334
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   335
  NS_LOG_FUNCTION (this << n);
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   336
  for (std::vector<Ptr<NetDevice> >::const_iterator i = m_ifaces.begin (); i != m_ifaces.end (); i++)
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5101
diff changeset
   337
    {
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   338
      if ((*i)->GetIfIndex () == n)
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   339
        {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   340
          return (*i);
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   341
        }
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5101
diff changeset
   342
    }
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5060
diff changeset
   343
  NS_FATAL_ERROR ("Mesh point interface is not found by index");
4932
Kirill Andreev <andreev@iitp.ru>
parents: 4928
diff changeset
   344
  return 0;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   345
}
4888
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   346
std::vector<Ptr<NetDevice> >
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   347
MeshPointDevice::GetInterfaces () const
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   348
{
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   349
  return m_ifaces;
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   350
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   351
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   352
MeshPointDevice::AddInterface (Ptr<NetDevice> iface)
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   353
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   354
  NS_LOG_FUNCTION (this << iface);
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   355
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   356
  NS_ASSERT (iface != this);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   357
  if (!Mac48Address::IsMatchingType (iface->GetAddress ()))
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   358
    {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   359
      NS_FATAL_ERROR ("Device does not support eui 48 addresses: cannot be used as a mesh point interface.");
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   360
    }
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   361
  if (!iface->SupportsSendFrom ())
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   362
    {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   363
      NS_FATAL_ERROR ("Device does not support SendFrom: cannot be used as a mesh point interface.");
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   364
    }
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   365
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
   366
  // Mesh point has MAC address of it's first interface
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5101
diff changeset
   367
  if (m_ifaces.empty ())
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   368
    {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   369
      m_address = Mac48Address::ConvertFrom (iface->GetAddress ());
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   370
    }
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   371
  Ptr<WifiNetDevice> wifiNetDev = iface->GetObject<WifiNetDevice> ();
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
   372
  if (wifiNetDev == 0)
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   373
    {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   374
      NS_FATAL_ERROR ("Device is not a WiFi NIC: cannot be used as a mesh point interface.");
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   375
    }
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   376
  Ptr<MeshWifiInterfaceMac> ifaceMac = wifiNetDev->GetMac ()->GetObject<MeshWifiInterfaceMac> ();
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
   377
  if (ifaceMac == 0)
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   378
    {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   379
      NS_FATAL_ERROR (
7178
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   380
        "WiFi device doesn't have correct MAC installed: cannot be used as a mesh point interface.");
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   381
    }
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
   382
  ifaceMac->SetMeshPointAddress (m_address);
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   383
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
   384
  // Receive frames from this interface
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   385
  m_node->RegisterProtocolHandler (MakeCallback (&MeshPointDevice::ReceiveFromDevice, this), 0, iface, /*promiscuous = */
7178
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   386
                                   true);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   387
  m_ifaces.push_back (iface);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   388
  m_channel->AddChannel (iface->GetChannel ());
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   389
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   390
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   391
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   392
// Protocols
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   393
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   394
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4815
diff changeset
   395
void
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   396
MeshPointDevice::SetRoutingProtocol (Ptr<MeshL2RoutingProtocol> protocol)
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   397
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   398
  NS_LOG_FUNCTION (this << protocol);
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   399
  NS_ASSERT_MSG (PeekPointer (protocol->GetMeshPoint ()) == this,
7178
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   400
                 "Routing protocol must be installed on mesh point to be useful.");
4928
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   401
  m_routingProtocol = protocol;
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   402
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   403
4928
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   404
Ptr<MeshL2RoutingProtocol>
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   405
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
   406
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   407
  NS_LOG_FUNCTION (this);
4928
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   408
  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
   409
}
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   410
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   411
void
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   412
MeshPointDevice::DoSend (bool success, Ptr<Packet> packet, Mac48Address src, Mac48Address dst,
7178
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   413
                         uint16_t protocol, uint32_t outIface)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   414
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   415
  NS_LOG_FUNCTION (this << success << packet << src << dst << protocol << outIface);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   416
  if (!success)
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   417
    {
4996
33f418524356 Fixed routing information with neighbours, fixed address3 in management
Kirill Andreev <andreev@iitp.ru>
parents: 4987
diff changeset
   418
      NS_LOG_DEBUG ("Resolve failed");
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   419
      return;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   420
    }
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   421
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   422
  // Count statistics
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   423
  Statistics * stats = ((src == m_address) ? &m_txStats : &m_fwdStats);
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   424
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   425
  if (dst.IsBroadcast ())
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   426
    {
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   427
      stats->broadcastData++;
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   428
      stats->broadcastDataBytes += packet->GetSize ();
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   429
    }
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   430
  else
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   431
    {
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   432
      stats->unicastData++;
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   433
      stats->unicastDataBytes += packet->GetSize ();
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   434
    }
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   435
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   436
  // Send
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   437
  if (outIface != 0xffffffff)
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   438
    {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   439
      GetInterface (outIface)->SendFrom (packet, src, dst, protocol);
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   440
    }
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   441
  else
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5101
diff changeset
   442
    {
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   443
      for (std::vector<Ptr<NetDevice> >::iterator i = m_ifaces.begin (); i != m_ifaces.end (); i++)
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   444
        {
7178
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   445
          (*i)->SendFrom (packet->Copy (), src, dst, protocol);
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   446
        }
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5101
diff changeset
   447
    }
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   448
}
5126
8e06088a785d Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents: 5125
diff changeset
   449
MeshPointDevice::Statistics::Statistics () :
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   450
  unicastData (0), unicastDataBytes (0), broadcastData (0), broadcastDataBytes (0)
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   451
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   452
  NS_LOG_FUNCTION (this);
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   453
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   454
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   455
void
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   456
MeshPointDevice::Report (std::ostream & os) const
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   457
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   458
  NS_LOG_FUNCTION (this);
5156
5b499f25655a Review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5132
diff changeset
   459
  os << "<Statistics" << std::endl <<
7178
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   460
  "txUnicastData=\"" << m_txStats.unicastData << "\"" << std::endl <<
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   461
  "txUnicastDataBytes=\"" << m_txStats.unicastDataBytes << "\"" << std::endl <<
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   462
  "txBroadcastData=\"" << m_txStats.broadcastData << "\"" << std::endl <<
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   463
  "txBroadcastDataBytes=\"" << m_txStats.broadcastDataBytes << "\"" << std::endl <<
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   464
  "rxUnicastData=\"" << m_rxStats.unicastData << "\"" << std::endl <<
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   465
  "rxUnicastDataBytes=\"" << m_rxStats.unicastDataBytes << "\"" << std::endl <<
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   466
  "rxBroadcastData=\"" << m_rxStats.broadcastData << "\"" << std::endl <<
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   467
  "rxBroadcastDataBytes=\"" << m_rxStats.broadcastDataBytes << "\"" << std::endl <<
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   468
  "fwdUnicastData=\"" << m_fwdStats.unicastData << "\"" << std::endl <<
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   469
  "fwdUnicastDataBytes=\"" << m_fwdStats.unicastDataBytes << "\"" << std::endl <<
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   470
  "fwdBroadcastData=\"" << m_fwdStats.broadcastData << "\"" << std::endl <<
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   471
  "fwdBroadcastDataBytes=\"" << m_fwdStats.broadcastDataBytes << "\"" << std::endl <<
1a07cbb68308 mesh coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6851
diff changeset
   472
  "/>" << std::endl;
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   473
}
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   474
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   475
void
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   476
MeshPointDevice::ResetStats ()
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   477
{
11014
afbd865a0935 improve some mesh module logging
Tom Henderson <tomh@tomh.org>
parents: 10968
diff changeset
   478
  NS_LOG_FUNCTION (this);
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   479
  m_rxStats = Statistics ();
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   480
  m_txStats = Statistics ();
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   481
  m_fwdStats = Statistics ();
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   482
}
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   483
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   484
} // namespace ns3