View | Details | Raw Unified | Return to bug 276
Collapse All | Expand All

(-)a/examples/csma-bridge.cc (-8 / +2 lines)
 Lines 94-107   main (int argc, char *argv[]) Link Here 
94
94
95
  // Create the bridge netdevice, which will do the packet switching
95
  // Create the bridge netdevice, which will do the packet switching
96
  Ptr<Node> switchNode = csmaSwitch.Get (0);
96
  Ptr<Node> switchNode = csmaSwitch.Get (0);
97
  Ptr<BridgeNetDevice> bridgeDevice = CreateObject<BridgeNetDevice> ();
97
  BridgeHelper bridge;
98
  switchNode->AddDevice (bridgeDevice);
98
  bridge.Install (switchNode, switchDevices);
99
100
  for (NetDeviceContainer::Iterator portIter = switchDevices.Begin ();
101
       portIter != switchDevices.End (); portIter++)
102
    {
103
      bridgeDevice->AddBridgePort (*portIter);
104
    }
105
99
106
  // Add internet stack to the terminals
100
  // Add internet stack to the terminals
107
  InternetStackHelper internet;
101
  InternetStackHelper internet;
(-)354c57707e70 (+23 lines)
Added Link Here 
1
#include "bridge-helper.h"
2
3
#include "ns3/bridge-net-device.h"
4
#include "ns3/node.h"
5
6
namespace ns3 {
7
8
NetDeviceContainer
9
BridgeHelper::Install (Ptr<Node> node, NetDeviceContainer c)
10
{
11
  NetDeviceContainer devs;
12
  Ptr<BridgeNetDevice> dev = CreateObject<BridgeNetDevice> ();
13
  devs.Add (dev);
14
  node->AddDevice (dev);
15
16
  for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
17
    {
18
      dev->AddBridgePort (*i);
19
    }
20
  return devs;
21
}
22
23
} // namespace ns3
(-)354c57707e70 (+19 lines)
Added Link Here 
1
#ifndef BRIDGE_HELPER_H
2
#define BRIDGE_HELPER_H
3
4
#include "net-device-container.h"
5
6
namespace ns3 {
7
8
class Node;
9
10
class BridgeHelper
11
{
12
public:
13
  NetDeviceContainer Install (Ptr<Node> node, NetDeviceContainer c);
14
};
15
16
} // namespace ns3
17
18
19
#endif /* BRIDGE_HELPER_H */
(-)a/src/helper/wscript (+2 lines)
 Lines 20-25   def build(bld): Link Here 
20
        'packet-socket-helper.cc',
20
        'packet-socket-helper.cc',
21
        'ipv4-interface-container.cc',
21
        'ipv4-interface-container.cc',
22
        'udp-echo-helper.cc',
22
        'udp-echo-helper.cc',
23
        'bridge-helper.cc',
23
        ]
24
        ]
24
25
25
    headers = bld.create_obj('ns3header')
26
    headers = bld.create_obj('ns3header')
 Lines 42-45   def build(bld): Link Here 
42
        'packet-socket-helper.h',
43
        'packet-socket-helper.h',
43
        'ipv4-interface-container.h',
44
        'ipv4-interface-container.h',
44
        'udp-echo-helper.h',
45
        'udp-echo-helper.h',
46
        'bridge-helper.h',
45
        ]
47
        ]

Return to bug 276