author | Gustavo J. A. M. Carneiro <gjc@inescporto.pt> |
Wed, 16 Jul 2008 16:06:50 +0100 | |
changeset 3460 | 99698bc858e8 |
parent 3449 | c3dcecc4825a |
child 3519 | a6113320f46a |
permissions | -rw-r--r-- |
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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
32 |
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
|
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 |
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
|
35 |
.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
|
36 |
.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
|
37 |
.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
|
38 |
"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
|
39 |
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
|
40 |
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
|
41 |
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
|
42 |
.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
|
43 |
"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
|
44 |
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
|
45 |
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
|
46 |
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
|
47 |
; |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
53 |
: 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
|
54 |
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
|
55 |
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
|
56 |
m_mtu (0xffff) |
3449
c3dcecc4825a
Add BridgeChannel
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
57 |
{ |
c3dcecc4825a
Add BridgeChannel
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
58 |
m_channel = CreateObject<BridgeChannel> (); |
c3dcecc4825a
Add BridgeChannel
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
59 |
} |
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
|
60 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
void |
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
|
62 |
BridgeNetDevice::ReceiveFromDevice (Ptr<NetDevice> incomingPort, 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
|
63 |
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
|
64 |
{ |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
66 |
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
|
67 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
69 |
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
|
70 |
|
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
|
71 |
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
|
72 |
{ |
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 |
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
|
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 |
|
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 |
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
|
77 |
{ |
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
|
78 |
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
|
79 |
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
|
80 |
{ |
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
|
81 |
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
|
82 |
} |
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
|
83 |
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
|
84 |
|
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
|
85 |
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
|
86 |
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
|
87 |
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
|
88 |
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
|
89 |
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
|
90 |
|
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
|
91 |
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
|
92 |
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
|
93 |
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
|
94 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
95 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
void |
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
|
98 |
BridgeNetDevice::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
|
99 |
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
|
100 |
{ |
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 |
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
|
102 |
<< ", 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
|
103 |
<< ", 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
|
104 |
|
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 |
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
|
106 |
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
|
107 |
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
|
108 |
{ |
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 |
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
|
110 |
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
|
111 |
} |
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 |
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
|
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 |
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
|
115 |
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
|
116 |
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
|
117 |
{ |
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 |
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
|
119 |
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
|
120 |
{ |
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 |
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
|
122 |
<< " --> " << 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
|
123 |
<< " (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
|
124 |
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
|
125 |
} |
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 |
} |
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 |
void |
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 |
BridgeNetDevice::ForwardBroadcast (Ptr<NetDevice> incomingPort, Ptr<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
|
132 |
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
|
133 |
{ |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
135 |
<< ", 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
|
136 |
<< ", 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
|
137 |
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
|
138 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
139 |
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
|
140 |
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
|
141 |
{ |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
143 |
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
|
144 |
{ |
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
|
145 |
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
|
146 |
<< " --> " << 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
|
147 |
<< " (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
|
148 |
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
|
149 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
150 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
|
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
|
153 |
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
|
154 |
{ |
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 |
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
|
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 |
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
|
158 |
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
|
159 |
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
|
160 |
} |
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 |
} |
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 |
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
|
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 |
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
|
166 |
{ |
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
|
167 |
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
|
168 |
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
|
169 |
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
|
170 |
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
|
171 |
{ |
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 |
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
|
173 |
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
|
174 |
{ |
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
|
175 |
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
|
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 |
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
|
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 |
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
|
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 |
} |
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 |
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
|
184 |
} |
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
|
185 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
186 |
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
|
187 |
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
|
188 |
{ |
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
|
189 |
NS_ASSERT (bridgePort != this); |
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
|
190 |
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
|
191 |
{ |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
192 |
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
|
193 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
194 |
|
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
|
195 |
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
|
196 |
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
|
197 |
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
|
198 |
m_ports.push_back (bridgePort); |
3449
c3dcecc4825a
Add BridgeChannel
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
199 |
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
|
200 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
203 |
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
|
204 |
{ |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
205 |
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
|
206 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
207 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
209 |
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
|
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 |
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
|
212 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
215 |
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
|
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 |
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
|
218 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
221 |
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
|
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 |
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
|
224 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
227 |
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
|
228 |
{ |
3449
c3dcecc4825a
Add BridgeChannel
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
229 |
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
|
230 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
233 |
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
|
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 |
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
|
236 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
239 |
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
|
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 |
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
|
242 |
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
|
243 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
246 |
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
|
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 |
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
|
249 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
253 |
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
|
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 |
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
|
256 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
260 |
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
|
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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
265 |
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
|
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 |
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
|
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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
272 |
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
|
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 |
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
|
275 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
278 |
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
|
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 |
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
|
281 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
285 |
BridgeNetDevice::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
|
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 |
return Mac48Address ("01:00:5e:00:00:00"); |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
292 |
BridgeNetDevice::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
|
293 |
{ |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
294 |
NS_LOG_FUNCTION (this << multicastGroup); |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
// First, get the generic multicast 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
|
297 |
// |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
298 |
Address hardwareDestination = GetMulticast (); |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
NS_LOG_LOGIC ("Device multicast address: " << hardwareDestination); |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
// It's our address, and we know we're playing with an EUI-48 address here |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
// primarily since we know that by construction, but also since the parameter |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
// is an Ipv4Address. |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
// |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
Mac48Address etherAddr = Mac48Address::ConvertFrom (hardwareDestination); |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
// We now have the multicast address in an abstract 48-bit container. We |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
// need to pull it out so we can play with it. When we're done, we have 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
|
310 |
// high order bits in etherBuffer[0], etc. |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
uint8_t etherBuffer[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
|
313 |
etherAddr.CopyTo (etherBuffer); |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
// Now we need to pull the raw bits out of the Ipv4 destination 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
|
316 |
// |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
317 |
uint8_t ipBuffer[4]; |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
318 |
multicastGroup.Serialize (ipBuffer); |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
319 |
// |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
320 |
// RFC 1112 says that an Ipv4 host group address is mapped to an EUI-48 |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
321 |
// multicast address by placing the low-order 23-bits of the IP address into |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
322 |
// the low-order 23 bits of the Ethernet multicast 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
|
323 |
// 01-00-5E-00-00-00 (hex). |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
324 |
// |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
325 |
etherBuffer[3] |= ipBuffer[1] & 0x7f; |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
326 |
etherBuffer[4] = ipBuffer[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
|
327 |
etherBuffer[5] = ipBuffer[3]; |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
328 |
// |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
329 |
// Now, etherBuffer has the desired ethernet multicast address. We have to |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
// suck these bits back into the 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
|
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 |
etherAddr.CopyFrom (etherBuffer); |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
// Implicit conversion (operator Address ()) is defined for Mac48Address, so |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
// use it by just returning the EUI-48 address which is automagically converted |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
// to an 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
|
337 |
// |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
NS_LOG_LOGIC ("multicast address is " << etherAddr); |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
return etherAddr; |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
345 |
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
|
346 |
{ |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
352 |
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
|
353 |
{ |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
355 |
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
|
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 |
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
|
358 |
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
|
359 |
} |
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
|
360 |
|
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
|
361 |
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
|
362 |
} |
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
|
363 |
|
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
|
364 |
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
|
365 |
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
|
366 |
{ |
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
|
367 |
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
|
368 |
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
|
369 |
{ |
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
|
370 |
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
|
371 |
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
|
372 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
373 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
374 |
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
|
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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
379 |
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
|
380 |
{ |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do 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 |
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
|
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 |
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
|
386 |
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
|
387 |
{ |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
388 |
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
|
389 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
390 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
391 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
392 |
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
|
393 |
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
|
394 |
{ |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
395 |
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
|
396 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
397 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
398 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
399 |
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
|
400 |
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
|
401 |
{ |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
402 |
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
|
403 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
404 |
|
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
|
405 |
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
|
406 |
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
|
407 |
{ |
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
|
408 |
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
|
409 |
} |
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
|
410 |
|
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
|
411 |
bool |
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
|
412 |
BridgeNetDevice::SupportsPromiscuous () const |
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
|
413 |
{ |
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
|
414 |
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
|
415 |
} |
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
|
416 |
|
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
|
417 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
418 |
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
|
419 |
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
|
420 |
{ |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
421 |
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
|
422 |
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
|
423 |
} |
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
424 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
425 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
426 |
|
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
427 |
} // namespace ns3 |