src/devices/bridge/bridge-net-device.h
author Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
Wed, 16 Jul 2008 16:06:50 +0100
changeset 3460 99698bc858e8
parent 3449 c3dcecc4825a
child 3548 e5ab96db540e
child 3554 6d041a5be1db
permissions -rw-r--r--
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
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
#ifndef 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
#define 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
    20
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/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
    22
#include "ns3/mac48-address.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/nstime.h"
3449
c3dcecc4825a Add BridgeChannel
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
    24
#include "ns3/bridge-channel.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
#include <stdint.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
    26
#include <string>
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
    27
#include <map>
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
    28
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
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
    30
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
    31
class 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
    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
/**
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
 * \ingroup 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
    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
 * \brief bridge net device for bridge things and testing
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
 */
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
class BridgeNetDevice : public 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
    39
{
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
    40
public:
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
    41
  static TypeId 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
    42
  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
    43
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
    44
  void 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
    45
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
    46
  // inherited from NetDevice base class.
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
    47
  virtual void 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
    48
  virtual std::string 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
    49
  virtual void 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
    50
  virtual uint32_t 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
    51
  virtual Ptr<Channel> 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
    52
  virtual Address 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
    53
  virtual bool 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
    54
  virtual uint16_t 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
    55
  virtual bool 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
    56
  virtual void 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
    57
  virtual bool 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
    58
  virtual Address 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
    59
  virtual bool 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
    60
  virtual Address GetMulticast (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
    61
  virtual Address MakeMulticastAddress (Ipv4Address multicastGroup) 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
    62
  virtual bool IsPointToPoint (void) const;
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
    63
  virtual bool Send (Ptr<Packet> packet, 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
    64
  virtual bool SendFrom (Ptr<Packet> packet, const Address& source, 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
    65
  virtual Ptr<Node> 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
    66
  virtual void 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
    67
  virtual bool 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
    68
  virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);
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
    69
  virtual void 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
    70
  virtual bool SupportsPromiscuous () 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
    71
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
protected:
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
    73
  virtual void 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
    74
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
    75
  void ReceiveFromDevice (Ptr<NetDevice> device, Ptr<Packet> packet, uint16_t protocol,
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
    76
                          Address const &source, Address const &destination, PacketType packetType);
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
    77
  void ForwardUnicast (Ptr<NetDevice> incomingPort, Ptr<Packet> packet,
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
    78
                       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
    79
  void ForwardBroadcast (Ptr<NetDevice> incomingPort, Ptr<Packet> packet,
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
    80
                         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
    81
  void 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
    82
  Ptr<NetDevice> GetLearnedState (Mac48Address source);
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
    83
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
    84
private:
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
    85
  NetDevice::ReceiveCallback m_rxCallback;
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
    86
  NetDevice::PromiscReceiveCallback m_promiscRxCallback;
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
    87
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
    88
  Mac48Address m_address;
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
    89
  Time m_expirationTime; // time it takes for learned MAC state 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
    90
  struct LearnedState
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
    91
  {
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
    92
    Ptr<NetDevice> 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
    93
    Time 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
    94
  };
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
    95
  std::map<Mac48Address, LearnedState> m_learnState;
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
  Ptr<Node> m_node;
3449
c3dcecc4825a Add BridgeChannel
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
    97
  Ptr<BridgeChannel> 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
    98
  std::string 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
    99
  std::vector< Ptr<NetDevice> > m_ports;
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
   100
  uint32_t m_ifIndex;
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 m_mtu;
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
  bool m_enableLearning;
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
   103
};
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
   104
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
   105
} // 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
   106
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
   107
#endif /* BRIDGE_NET_DEVICE_H */