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