src/devices/bridge/bridge-net-device.cc
author Craig Dowell <craigdo@ee.washington.edu>
Wed, 05 Nov 2008 14:33:20 -0800
changeset 3841 1e7abf5fca79
parent 3585 0404af4cacf0
child 3852 9cf7ad0cac85
permissions -rw-r--r--
Apply Patch to address bug 294 -- due to vincent
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     2
/*
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     3
 * This program is free software; you can redistribute it and/or modify
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     4
 * it under the terms of the GNU General Public License version 2 as
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     5
 * published by the Free Software Foundation;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     6
 *
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     7
 * This program is distributed in the hope that it will be useful,
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    10
 * GNU General Public License for more details.
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    11
 *
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    12
 * You should have received a copy of the GNU General Public License
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    13
 * along with this program; if not, write to the Free Software
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    14
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    15
 *
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    16
 * Author: Gustavo Carneiro  <gjc@inescporto.pt>
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    17
 */
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    18
#include "bridge-net-device.h"
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    19
#include "ns3/node.h"
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    20
#include "ns3/channel.h"
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    21
#include "ns3/packet.h"
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    22
#include "ns3/log.h"
3444
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
    23
#include "ns3/boolean.h"
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
    24
#include "ns3/simulator.h"
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    25
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    26
NS_LOG_COMPONENT_DEFINE ("BridgeNetDevice");
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    27
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    28
namespace ns3 {
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    29
3519
a6113320f46a ensure type is registered
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3460
diff changeset
    30
NS_OBJECT_ENSURE_REGISTERED (BridgeNetDevice);
a6113320f46a ensure type is registered
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3460
diff changeset
    31
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    32
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    33
TypeId
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    34
BridgeNetDevice::GetTypeId (void)
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    35
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    36
  static TypeId tid = TypeId ("ns3::BridgeNetDevice")
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    37
    .SetParent<NetDevice> ()
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    38
    .AddConstructor<BridgeNetDevice> ()
3444
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
    39
    .AddAttribute ("EnableLearning",
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
    40
                   "Enable the learning mode of the Learning Bridge",
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
    41
                   BooleanValue (true),
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
    42
                   MakeBooleanAccessor (&BridgeNetDevice::m_enableLearning),
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
    43
                   MakeBooleanChecker ())
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
    44
    .AddAttribute ("ExpirationTime",
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
    45
                   "Time it takes for learned MAC state entry to expire.",
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
    46
                   TimeValue (Seconds (30)),
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
    47
                   MakeTimeAccessor (&BridgeNetDevice::m_expirationTime),
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
    48
                   MakeTimeChecker ())
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    49
    ;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    50
  return tid;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    51
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    52
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    53
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    54
BridgeNetDevice::BridgeNetDevice ()
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    55
  : m_node (0),
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    56
    m_name (""),
3444
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
    57
    m_ifIndex (0),
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
    58
    m_mtu (0xffff)
3449
c3dcecc4825a Add BridgeChannel
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
    59
{
c3dcecc4825a Add BridgeChannel
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
    60
  m_channel = CreateObject<BridgeChannel> ();
c3dcecc4825a Add BridgeChannel
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
    61
}
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    62
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    63
void
3548
e5ab96db540e bug 273: constify packet pointers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3519
diff changeset
    64
BridgeNetDevice::ReceiveFromDevice (Ptr<NetDevice> incomingPort, Ptr<const Packet> packet, uint16_t protocol,
3448
0bd851bb1225 Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3444
diff changeset
    65
                                    Address const &src, Address const &dst, PacketType packetType)
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    66
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    67
  NS_LOG_FUNCTION_NOARGS ();
3443
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
    68
  NS_LOG_DEBUG ("UID is " << packet->GetUid ());
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    69
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    70
  Mac48Address src48 = Mac48Address::ConvertFrom (src);
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    71
  Mac48Address dst48 = Mac48Address::ConvertFrom (dst);
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    72
3460
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
    73
  if (!m_promiscRxCallback.IsNull ())
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
    74
    {
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
    75
      m_promiscRxCallback (this, packet, protocol, src, dst, packetType);
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
    76
    }
3448
0bd851bb1225 Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3444
diff changeset
    77
0bd851bb1225 Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3444
diff changeset
    78
  switch (packetType)
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    79
    {
3448
0bd851bb1225 Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3444
diff changeset
    80
    case PACKET_HOST:
0bd851bb1225 Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3444
diff changeset
    81
      if (dst48 == m_address)
0bd851bb1225 Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3444
diff changeset
    82
        {
3460
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
    83
          m_rxCallback (this, packet, protocol, src);
3448
0bd851bb1225 Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3444
diff changeset
    84
        }
0bd851bb1225 Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3444
diff changeset
    85
      break;
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    86
3448
0bd851bb1225 Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3444
diff changeset
    87
    case PACKET_BROADCAST:
0bd851bb1225 Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3444
diff changeset
    88
    case PACKET_MULTICAST:
3460
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
    89
      m_rxCallback (this, packet, protocol, src);
3448
0bd851bb1225 Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3444
diff changeset
    90
      ForwardBroadcast (incomingPort, packet, protocol, src48, dst48);
0bd851bb1225 Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3444
diff changeset
    91
      break;
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    92
3448
0bd851bb1225 Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3444
diff changeset
    93
    case PACKET_OTHERHOST:
3444
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
    94
      ForwardUnicast (incomingPort, packet, protocol, src48, dst48);
3448
0bd851bb1225 Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3444
diff changeset
    95
      break;
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    96
    }
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    97
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    98
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    99
void
3548
e5ab96db540e bug 273: constify packet pointers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3519
diff changeset
   100
BridgeNetDevice::ForwardUnicast (Ptr<NetDevice> incomingPort, Ptr<const Packet> packet,
3444
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   101
                                 uint16_t protocol, Mac48Address src, Mac48Address dst)
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   102
{
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   103
  NS_LOG_DEBUG ("LearningBridgeForward (incomingPort=" << incomingPort->GetName ()
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   104
                << ", packet=" << packet << ", protocol="<<protocol
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   105
                << ", src=" << src << ", dst=" << dst << ")");
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   106
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   107
  Learn (src, incomingPort);
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   108
  Ptr<NetDevice> outPort = GetLearnedState (dst);
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   109
  if (outPort != NULL && outPort != incomingPort)
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   110
    {
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   111
      NS_LOG_LOGIC ("Learning bridge state says to use port `" << outPort->GetName () << "'");
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   112
      outPort->SendFrom (packet->Copy (), src, dst, protocol);
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   113
    }
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   114
  else
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   115
    {
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   116
      NS_LOG_LOGIC ("No learned state: send through all ports");
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   117
      for (std::vector< Ptr<NetDevice> >::iterator iter = m_ports.begin ();
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   118
           iter != m_ports.end (); iter++)
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   119
        {
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   120
          Ptr<NetDevice> port = *iter;
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   121
          if (port != incomingPort)
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   122
            {
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   123
              NS_LOG_LOGIC ("LearningBridgeForward (" << src << " => " << dst << "): " << incomingPort->GetName ()
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   124
                            << " --> " << port->GetName ()
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   125
                            << " (UID " << packet->GetUid () << ").");
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   126
              port->SendFrom (packet->Copy (), src, dst, protocol);
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   127
            }
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   128
        }
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   129
    }
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   130
}
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   131
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   132
void
3548
e5ab96db540e bug 273: constify packet pointers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3519
diff changeset
   133
BridgeNetDevice::ForwardBroadcast (Ptr<NetDevice> incomingPort, Ptr<const Packet> packet,
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   134
                                        uint16_t protocol, Mac48Address src, Mac48Address dst)
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   135
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   136
  NS_LOG_DEBUG ("LearningBridgeForward (incomingPort=" << incomingPort->GetName ()
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   137
                << ", packet=" << packet << ", protocol="<<protocol
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   138
                << ", src=" << src << ", dst=" << dst << ")");
3444
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   139
  Learn (src, incomingPort);
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   140
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   141
  for (std::vector< Ptr<NetDevice> >::iterator iter = m_ports.begin ();
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   142
         iter != m_ports.end (); iter++)
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   143
    {
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   144
      Ptr<NetDevice> port = *iter;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   145
      if (port != incomingPort)
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   146
        {
3443
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   147
          NS_LOG_LOGIC ("LearningBridgeForward (" << src << " => " << dst << "): " << incomingPort->GetName ()
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   148
                        << " --> " << port->GetName ()
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   149
                        << " (UID " << packet->GetUid () << ").");
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   150
          port->SendFrom (packet->Copy (), src, dst, protocol);
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   151
        }
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   152
    }
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   153
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   154
3444
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   155
void BridgeNetDevice::Learn (Mac48Address source, Ptr<NetDevice> port)
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   156
{
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   157
  if (m_enableLearning)
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   158
    {
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   159
      LearnedState &state = m_learnState[source];
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   160
      state.associatedPort = port;
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   161
      state.expirationTime = Simulator::Now () + m_expirationTime;
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   162
    }
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   163
}
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   164
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   165
Ptr<NetDevice> BridgeNetDevice::GetLearnedState (Mac48Address source)
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   166
{
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   167
  if (m_enableLearning)
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   168
    {
3460
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
   169
      Time now = Simulator::Now ();
3444
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   170
      std::map<Mac48Address, LearnedState>::iterator iter =
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   171
        m_learnState.find (source);
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   172
      if (iter != m_learnState.end ())
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   173
        {
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   174
          LearnedState &state = iter->second;
3460
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
   175
          if (state.expirationTime > now)
3444
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   176
            {
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   177
              return state.associatedPort;
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   178
            }
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   179
          else
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   180
            {
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   181
              m_learnState.erase (iter);
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   182
            }
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   183
        }
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   184
    }
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   185
  return NULL;
a6d76b454df4 Add the 'learning' part of the Learning Bridge, with option to disable it and revert to dummy mode (hub-like).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3443
diff changeset
   186
}
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   187
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   188
void 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   189
BridgeNetDevice::AddBridgePort (Ptr<NetDevice> bridgePort)
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   190
{
3443
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   191
  NS_ASSERT (bridgePort != this);
3584
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3548
diff changeset
   192
  if (!Mac48Address::IsMatchingType (bridgePort->GetAddress ()))
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3548
diff changeset
   193
    {
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3548
diff changeset
   194
      NS_FATAL_ERROR ("Device does not support eui 48 addresses: cannot be added to bridge.");
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3548
diff changeset
   195
    }
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3548
diff changeset
   196
  if (!bridgePort->SupportsSendFrom ())
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3548
diff changeset
   197
    {
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3548
diff changeset
   198
      NS_FATAL_ERROR ("Device does not support SendFrom: cannot be added to bridge.");
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3548
diff changeset
   199
    }
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   200
  if (m_address == Mac48Address ())
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   201
    {
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   202
      m_address = Mac48Address::ConvertFrom (bridgePort->GetAddress ());
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   203
    }
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   204
3460
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
   205
  NS_LOG_DEBUG ("RegisterProtocolHandler for " << bridgePort->GetName ());
3448
0bd851bb1225 Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3444
diff changeset
   206
  m_node->RegisterProtocolHandler (MakeCallback (&BridgeNetDevice::ReceiveFromDevice, this),
3460
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
   207
                                   0, bridgePort, true);
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   208
  m_ports.push_back (bridgePort);
3449
c3dcecc4825a Add BridgeChannel
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
   209
  m_channel->AddChannel (bridgePort->GetChannel ());
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   210
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   211
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   212
void 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   213
BridgeNetDevice::SetName(const std::string name)
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   214
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   215
  m_name = name;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   216
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   217
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   218
std::string 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   219
BridgeNetDevice::GetName(void) const
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   220
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   221
  return m_name;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   222
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   223
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   224
void 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   225
BridgeNetDevice::SetIfIndex(const uint32_t index)
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   226
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   227
  m_ifIndex = index;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   228
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   229
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   230
uint32_t 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   231
BridgeNetDevice::GetIfIndex(void) const
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   232
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   233
  return m_ifIndex;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   234
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   235
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   236
Ptr<Channel> 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   237
BridgeNetDevice::GetChannel (void) const
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   238
{
3449
c3dcecc4825a Add BridgeChannel
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
   239
  return m_channel;
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   240
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   241
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   242
Address 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   243
BridgeNetDevice::GetAddress (void) const
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   244
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   245
  return m_address;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   246
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   247
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   248
bool 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   249
BridgeNetDevice::SetMtu (const uint16_t mtu)
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   250
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   251
  m_mtu = mtu;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   252
  return true;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   253
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   254
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   255
uint16_t 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   256
BridgeNetDevice::GetMtu (void) const
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   257
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   258
  return m_mtu;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   259
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   260
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   261
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   262
bool 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   263
BridgeNetDevice::IsLinkUp (void) const
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   264
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   265
  return true;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   266
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   267
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   268
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   269
void 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   270
BridgeNetDevice::SetLinkChangeCallback (Callback<void> callback)
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   271
{}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   272
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   273
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   274
bool 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   275
BridgeNetDevice::IsBroadcast (void) const
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   276
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   277
  return true;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   278
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   279
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   280
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   281
Address
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   282
BridgeNetDevice::GetBroadcast (void) const
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   283
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   284
  return Mac48Address ("ff:ff:ff:ff:ff:ff");
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   285
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   286
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   287
bool
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   288
BridgeNetDevice::IsMulticast (void) const
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   289
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   290
  return true;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   291
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   292
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   293
Address
3841
1e7abf5fca79 Apply Patch to address bug 294 -- due to vincent
Craig Dowell <craigdo@ee.washington.edu>
parents: 3585
diff changeset
   294
BridgeNetDevice::GetMulticast (Ipv4Address multicastGroup) const
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   295
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   296
 NS_LOG_FUNCTION (this << multicastGroup);
3585
0404af4cacf0 use Mac48Address::GetMulticast to avoid code duplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3584
diff changeset
   297
 Mac48Address multicast = Mac48Address::GetMulticast (multicastGroup);
0404af4cacf0 use Mac48Address::GetMulticast to avoid code duplication
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3584
diff changeset
   298
 return multicast;
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   299
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   300
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   301
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   302
bool 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   303
BridgeNetDevice::IsPointToPoint (void) const
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   304
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   305
  return false;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   306
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   307
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   308
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   309
bool 
3443
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   310
BridgeNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   311
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   312
  for (std::vector< Ptr<NetDevice> >::iterator iter = m_ports.begin ();
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   313
         iter != m_ports.end (); iter++)
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   314
    {
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   315
      Ptr<NetDevice> port = *iter;
3443
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   316
      port->SendFrom (packet, m_address, dest, protocolNumber);
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   317
    }
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   318
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   319
  return true;
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   320
}
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   321
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   322
bool 
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   323
BridgeNetDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address& dest, uint16_t protocolNumber)
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   324
{
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   325
  for (std::vector< Ptr<NetDevice> >::iterator iter = m_ports.begin ();
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   326
         iter != m_ports.end (); iter++)
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   327
    {
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   328
      Ptr<NetDevice> port = *iter;
9bb81eb18fed Use NetDevice::SendFrom where appropriate, in order to preserve source address of bridged mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3439
diff changeset
   329
      port->SendFrom (packet, src, dest, protocolNumber);
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   330
    }
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   331
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   332
  return true;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   333
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   334
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   335
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   336
Ptr<Node> 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   337
BridgeNetDevice::GetNode (void) const
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   338
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   339
  return m_node;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   340
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   341
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   342
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   343
void 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   344
BridgeNetDevice::SetNode (Ptr<Node> node)
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   345
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   346
  m_node = node;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   347
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   348
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   349
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   350
bool 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   351
BridgeNetDevice::NeedsArp (void) const
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   352
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   353
  return true;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   354
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   355
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   356
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   357
void 
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   358
BridgeNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb)
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   359
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   360
  m_rxCallback = cb;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   361
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   362
3460
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
   363
void 
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
   364
BridgeNetDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb)
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
   365
{
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
   366
  m_promiscRxCallback = cb;
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
   367
}
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
   368
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
   369
bool
3584
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3548
diff changeset
   370
BridgeNetDevice::SupportsSendFrom () const
3460
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
   371
{
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
   372
  return true;
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
   373
}
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3449
diff changeset
   374
3439
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   375
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   376
void
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   377
BridgeNetDevice::DoDispose (void)
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   378
{
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   379
  m_node = 0;
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   380
  NetDevice::DoDispose ();
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   381
}
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   382
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   383
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   384
a64d1da0d6bf Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   385
} // namespace ns3