src/devices/mesh/mesh-point-device.cc
author Kirill Andreev <andreev@iitp.ru>
Tue, 25 Aug 2009 17:21:34 +0400
changeset 5163 f1119f03b7a9
parent 5156 5b499f25655a
child 5180 689a0ed6de25
permissions -rw-r--r--
Code review fixes
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
#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
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    30
NS_LOG_COMPONENT_DEFINE ("MeshPointDevice");
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    31
5132
aee541a30256 Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents: 5129
diff changeset
    32
namespace ns3 {
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    33
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5128
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")
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    40
  .SetParent<NetDevice> ()
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    41
  .AddConstructor<MeshPointDevice> ()
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    42
  .AddAttribute ( "RoutingProtocol",
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    43
                  "The mesh routing protocol used by this mesh point.",
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    44
                  PointerValue (),
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    45
                  MakePointerAccessor (
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    46
                      &MeshPointDevice::GetRoutingProtocol, &MeshPointDevice::SetRoutingProtocol),
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    47
                  MakePointerChecker<
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    48
                  MeshL2RoutingProtocol> ());
4812
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
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    52
MeshPointDevice::MeshPointDevice () :
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    53
  m_ifIndex (0), m_mtu (1500)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    54
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    55
  NS_LOG_FUNCTION_NOARGS ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    56
  m_channel = CreateObject<BridgeChannel> ();
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    57
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    58
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    59
MeshPointDevice::~MeshPointDevice ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    60
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    61
  NS_LOG_FUNCTION_NOARGS ();
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    62
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    63
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    64
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    65
MeshPointDevice::DoDispose ()
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    66
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    67
  NS_LOG_FUNCTION_NOARGS ();
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    68
  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
    69
    {
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5101
diff changeset
    70
      *iter = 0;
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5101
diff changeset
    71
    }
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    72
  m_ifaces.clear ();
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    73
  m_node = 0;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    74
  NetDevice::DoDispose ();
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    75
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    76
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    77
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    78
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    79
// NetDevice interface implementation
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    80
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    81
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    82
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    83
MeshPointDevice::ReceiveFromDevice (Ptr<NetDevice> incomingPort, Ptr<const Packet> packet, uint16_t protocol,
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    84
    Address const &src, Address const &dst, PacketType packetType)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    85
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    86
  NS_LOG_FUNCTION_NOARGS ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    87
  NS_LOG_DEBUG ("UID is " << packet->GetUid ());
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    88
  const Mac48Address src48 = Mac48Address::ConvertFrom (src);
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
    89
  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
    90
  uint16_t& realProtocol = protocol;
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    91
  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
    92
  if (!m_promiscRxCallback.IsNull ())
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    93
    {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    94
      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
    95
    }
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    96
  if (dst48.IsGroup ())
5083
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
    97
    {
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
    98
      Ptr<Packet> packet_copy = packet->Copy ();
5163
f1119f03b7a9 Code review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5156
diff changeset
    99
      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
   100
        {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   101
          m_rxCallback (this, packet_copy, realProtocol, src);
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   102
          Forward (incomingPort, packet, protocol, src48, dst48);
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   103
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   104
          m_rxStats.broadcastData++;
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   105
          m_rxStats.broadcastDataBytes += packet->GetSize ();
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
      return;
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
  if (dst48 == m_address)
5083
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
   110
    {
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   111
      Ptr<Packet> packet_copy = packet->Copy ();
5163
f1119f03b7a9 Code review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5156
diff changeset
   112
      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
   113
        {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   114
          m_rxCallback (this, packet_copy, realProtocol, src);
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   115
          m_rxStats.unicastData++;
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   116
          m_rxStats.unicastDataBytes += 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
    }
4947
c665ebbe99a7 Bugfixes
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   120
  else
c665ebbe99a7 Bugfixes
Kirill Andreev <andreev@iitp.ru>
parents: 4944
diff changeset
   121
    Forward (incomingPort, packet->Copy (), protocol, src48, dst48);
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   122
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   123
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   124
void
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   125
MeshPointDevice::Forward (Ptr<NetDevice> inport, Ptr<const Packet> packet, uint16_t protocol,
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   126
    const Mac48Address src, const Mac48Address dst)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   127
{
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   128
  // pass through routing protocol
5163
f1119f03b7a9 Code review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5156
diff changeset
   129
  m_routingProtocol->RequestRoute (inport->GetIfIndex (), src, dst, packet, protocol, MakeCallback (
f1119f03b7a9 Code review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5156
diff changeset
   130
      &MeshPointDevice::DoSend, this));
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   131
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   132
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   133
void
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   134
MeshPointDevice::SetIfIndex (const uint32_t index)
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
  NS_LOG_FUNCTION_NOARGS ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   137
  m_ifIndex = index;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   138
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   139
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   140
uint32_t
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   141
MeshPointDevice::GetIfIndex () const
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   142
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   143
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   144
  return m_ifIndex;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   145
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   146
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   147
Ptr<Channel>
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   148
MeshPointDevice::GetChannel () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   149
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   150
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   151
  return m_channel;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   152
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   153
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   154
Address
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   155
MeshPointDevice::GetAddress () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   156
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   157
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   158
  return m_address;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   159
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   160
5101
41589d492ca3 MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents: 5098
diff changeset
   161
void
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   162
MeshPointDevice::SetAddress (Address a)
5101
41589d492ca3 MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents: 5098
diff changeset
   163
{
41589d492ca3 MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents: 5098
diff changeset
   164
  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
   165
  m_address = Mac48Address::ConvertFrom (a);
5101
41589d492ca3 MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents: 5098
diff changeset
   166
}
41589d492ca3 MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents: 5098
diff changeset
   167
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   168
bool
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   169
MeshPointDevice::SetMtu (const uint16_t mtu)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   170
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   171
  NS_LOG_FUNCTION_NOARGS ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   172
  m_mtu = mtu;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   173
  return true;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   174
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   175
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   176
uint16_t
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   177
MeshPointDevice::GetMtu () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   178
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   179
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   180
  return m_mtu;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   181
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   182
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   183
bool
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   184
MeshPointDevice::IsLinkUp () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   185
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   186
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   187
  return true;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   188
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   189
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   190
void
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   191
MeshPointDevice::SetLinkChangeCallback (Callback<void> callback)
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   192
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   193
  // do nothing
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   194
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   195
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   196
bool
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   197
MeshPointDevice::IsBroadcast () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   198
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   199
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   200
  return true;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   201
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   202
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   203
Address
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   204
MeshPointDevice::GetBroadcast () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   205
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   206
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   207
  return Mac48Address ("ff:ff:ff:ff:ff:ff");
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::IsMulticast () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   212
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   213
  NS_LOG_FUNCTION_NOARGS ();
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::GetMulticast (Ipv4Address multicastGroup) const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   219
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   220
  NS_LOG_FUNCTION (this << multicastGroup);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   221
  Mac48Address multicast = Mac48Address::GetMulticast (multicastGroup);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   222
  return multicast;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   223
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   224
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   225
bool
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   226
MeshPointDevice::IsPointToPoint () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   227
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   228
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   229
  return false;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   230
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   231
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   232
bool
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   233
MeshPointDevice::IsBridge () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   234
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   235
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   236
  return false;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   237
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   238
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   239
bool
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   240
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
   241
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   242
  const Mac48Address dst48 = Mac48Address::ConvertFrom (dest);
5163
f1119f03b7a9 Code review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5156
diff changeset
   243
  return m_routingProtocol->RequestRoute (m_ifIndex, m_address, dst48, packet, protocolNumber, MakeCallback (
f1119f03b7a9 Code review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5156
diff changeset
   244
      &MeshPointDevice::DoSend, this));
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   245
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   246
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   247
bool
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   248
MeshPointDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address& dest,
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   249
    uint16_t protocolNumber)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   250
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   251
  const Mac48Address src48 = Mac48Address::ConvertFrom (src);
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   252
  const Mac48Address dst48 = Mac48Address::ConvertFrom (dest);
5163
f1119f03b7a9 Code review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5156
diff changeset
   253
  return m_routingProtocol->RequestRoute (m_ifIndex, src48, dst48, packet, protocolNumber, MakeCallback (
f1119f03b7a9 Code review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5156
diff changeset
   254
      &MeshPointDevice::DoSend, this));
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   255
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   256
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   257
Ptr<Node>
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   258
MeshPointDevice::GetNode () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   259
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   260
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   261
  return m_node;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   262
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   263
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   264
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   265
MeshPointDevice::SetNode (Ptr<Node> node)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   266
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   267
  NS_LOG_FUNCTION_NOARGS ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   268
  m_node = node;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   269
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   270
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   271
bool
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   272
MeshPointDevice::NeedsArp () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   273
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   274
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   275
  return true;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   276
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   277
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   278
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   279
MeshPointDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   280
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   281
  NS_LOG_FUNCTION_NOARGS ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   282
  m_rxCallback = cb;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   283
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   284
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   285
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   286
MeshPointDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   287
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   288
  NS_LOG_FUNCTION_NOARGS ();
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   289
  m_promiscRxCallback = cb;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   290
}
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   291
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   292
bool
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   293
MeshPointDevice::SupportsSendFrom () const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   294
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   295
  NS_LOG_FUNCTION_NOARGS ();
4986
73ca74882f12 don't allow bridge mesh points
Pavel Boyko <boyko@iitp.ru>
parents: 4985
diff changeset
   296
  return false; // don't allow to bridge mesh network with something else.
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   297
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   298
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   299
Address
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   300
MeshPointDevice::GetMulticast (Ipv6Address addr) const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   301
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   302
  NS_LOG_FUNCTION (this << addr);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   303
  return Mac48Address::GetMulticast (addr);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   304
}
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
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   307
// Interfaces
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   308
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   309
uint32_t
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   310
MeshPointDevice::GetNInterfaces () const
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   311
{
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   312
  NS_LOG_FUNCTION_NOARGS ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   313
  return m_ifaces.size ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   314
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   315
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   316
Ptr<NetDevice>
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   317
MeshPointDevice::GetInterface (uint32_t n) const
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   318
{
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   319
  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
   320
    {
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   321
      if ((*i)->GetIfIndex () == n)
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   322
        {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   323
          return (*i);
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   324
        }
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5101
diff changeset
   325
    }
5063
97b947e83640 Faker's code review response
Pavel Boyko <boyko@iitp.ru>
parents: 5060
diff changeset
   326
  NS_FATAL_ERROR ("Mesh point interface is not found by index");
4932
Kirill Andreev <andreev@iitp.ru>
parents: 4928
diff changeset
   327
  return 0;
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   328
}
4888
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   329
std::vector<Ptr<NetDevice> >
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   330
MeshPointDevice::GetInterfaces () const
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   331
{
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   332
  return m_ifaces;
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
   333
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   334
void
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   335
MeshPointDevice::AddInterface (Ptr<NetDevice> iface)
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   336
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   337
  NS_LOG_FUNCTION_NOARGS ();
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   338
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   339
  NS_ASSERT (iface != this);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   340
  if (!Mac48Address::IsMatchingType (iface->GetAddress ()))
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   341
    {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   342
      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
   343
    }
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   344
  if (!iface->SupportsSendFrom ())
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   345
    {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   346
      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
   347
    }
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   348
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
   349
  // 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
   350
  if (m_ifaces.empty ())
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   351
    {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   352
      m_address = Mac48Address::ConvertFrom (iface->GetAddress ());
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   353
    }
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   354
  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
   355
  if (wifiNetDev == 0)
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   356
    {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   357
      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
   358
    }
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   359
  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
   360
  if (ifaceMac == 0)
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   361
    {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   362
      NS_FATAL_ERROR (
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   363
          "WiFi device doesn't have correct MAC installed: 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
    }
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
   365
  ifaceMac->SetMeshPointAddress (m_address);
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   366
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
   367
  // Receive frames from this interface
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   368
  m_node->RegisterProtocolHandler (MakeCallback (&MeshPointDevice::ReceiveFromDevice, this), 0, iface, /*promiscuous = */
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   369
      true);
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   370
  m_ifaces.push_back (iface);
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   371
  m_channel->AddChannel (iface->GetChannel ());
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   372
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   373
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   374
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   375
// Protocols
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   376
//-----------------------------------------------------------------------------
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   377
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4815
diff changeset
   378
void
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
   379
MeshPointDevice::SetRoutingProtocol (Ptr<MeshL2RoutingProtocol> protocol)
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   380
{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   381
  NS_LOG_FUNCTION_NOARGS ();
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   382
  NS_ASSERT_MSG (PeekPointer (protocol->GetMeshPoint ()) == this,
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   383
      "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
   384
  m_routingProtocol = protocol;
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   385
}
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   386
4928
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   387
Ptr<MeshL2RoutingProtocol>
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   388
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
   389
{
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   390
  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
   391
}
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4906
diff changeset
   392
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   393
void
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   394
MeshPointDevice::DoSend (bool success, Ptr<Packet> packet, Mac48Address src, Mac48Address dst,
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   395
    uint16_t protocol, uint32_t outIface)
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   396
{
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   397
  if (!success)
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   398
    {
4996
33f418524356 Fixed routing information with neighbours, fixed address3 in management
Kirill Andreev <andreev@iitp.ru>
parents: 4987
diff changeset
   399
      NS_LOG_DEBUG ("Resolve failed");
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   400
      return;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   401
    }
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   402
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   403
  // Count statistics
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   404
  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
   405
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   406
  if (dst.IsBroadcast ())
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   407
    {
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   408
      stats->broadcastData++;
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   409
      stats->broadcastDataBytes += packet->GetSize ();
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   410
    }
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   411
  else
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   412
    {
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   413
      stats->unicastData++;
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   414
      stats->unicastDataBytes += packet->GetSize ();
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   415
    }
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   416
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   417
  // Send
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   418
  if (outIface != 0xffffffff)
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   419
    {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   420
      GetInterface (outIface)->SendFrom (packet, src, dst, protocol);
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   421
    }
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4809
diff changeset
   422
  else
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5101
diff changeset
   423
    {
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   424
      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
   425
        {
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   426
          (*i) -> SendFrom (packet->Copy (), src, dst, protocol);
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   427
        }
5125
b90c6c0af6a3 Added max beacon loss to PeerManagementProtocol (for beacon timing), cosmetic
Kirill Andreev <andreev@iitp.ru>
parents: 5101
diff changeset
   428
    }
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   429
}
5126
8e06088a785d Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents: 5125
diff changeset
   430
MeshPointDevice::Statistics::Statistics () :
5128
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   431
  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
   432
{
d6e168eba404 Fixed coding style in helpers and mesh
Kirill Andreev <andreev@iitp.ru>
parents: 5127
diff changeset
   433
}
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   434
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   435
void
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   436
MeshPointDevice::Report (std::ostream & os) const
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   437
{
5156
5b499f25655a Review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5132
diff changeset
   438
  os << "<Statistics" << std::endl <<
5b499f25655a Review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5132
diff changeset
   439
    "txUnicastData=\"" << m_txStats.unicastData << "\"" << std::endl <<
5b499f25655a Review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5132
diff changeset
   440
    "txUnicastDataBytes=\"" << m_txStats.unicastDataBytes << "\"" << std::endl <<
5b499f25655a Review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5132
diff changeset
   441
    "txBroadcastData=\"" << m_txStats.broadcastData << "\"" << std::endl <<
5b499f25655a Review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5132
diff changeset
   442
    "txBroadcastDataBytes=\"" << m_txStats.broadcastDataBytes << "\"" << std::endl <<
5b499f25655a Review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5132
diff changeset
   443
    "rxUnicastData=\"" << m_rxStats.unicastData << "\"" << std::endl <<
5b499f25655a Review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5132
diff changeset
   444
    "rxUnicastDataBytes=\"" << m_rxStats.unicastDataBytes << "\"" << std::endl <<
5b499f25655a Review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5132
diff changeset
   445
    "rxBroadcastData=\"" << m_rxStats.broadcastData << "\"" << std::endl <<
5b499f25655a Review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5132
diff changeset
   446
    "rxBroadcastDataBytes=\"" << m_rxStats.broadcastDataBytes << "\"" << std::endl <<
5b499f25655a Review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5132
diff changeset
   447
    "fwdUnicastData=\"" << m_fwdStats.unicastData << "\"" << std::endl <<
5b499f25655a Review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5132
diff changeset
   448
    "fwdUnicastDataBytes=\"" << m_fwdStats.unicastDataBytes << "\"" << std::endl <<
5b499f25655a Review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5132
diff changeset
   449
    "fwdBroadcastData=\"" << m_fwdStats.broadcastData << "\"" << std::endl <<
5b499f25655a Review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5132
diff changeset
   450
    "fwdBroadcastDataBytes=\"" << m_fwdStats.broadcastDataBytes << "\"" << std::endl <<
5b499f25655a Review fixes
Kirill Andreev <andreev@iitp.ru>
parents: 5132
diff changeset
   451
    "/>" << std::endl;
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   452
}
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   453
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   454
void
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   455
MeshPointDevice::ResetStats ()
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   456
{
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   457
  m_rxStats = Statistics ();
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   458
  m_txStats = Statistics ();
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   459
  m_fwdStats = Statistics ();
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   460
}
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5091
diff changeset
   461
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   462
} // namespace ns3