18 #include "ns3/boolean.h"
19 #include "ns3/config.h"
20 #include "ns3/csma-helper.h"
21 #include "ns3/flow-monitor.h"
22 #include "ns3/flow-monitor-helper.h"
23 #include "ns3/inet-socket-address.h"
24 #include "ns3/internet-stack-helper.h"
25 #include "ns3/ipv4-address-helper.h"
26 #include "ns3/ipv4-global-routing-helper.h"
27 #include "ns3/ipv4-static-routing-helper.h"
29 #include "ns3/node-container.h"
30 #include "ns3/on-off-helper.h"
31 #include "ns3/packet.h"
32 #include "ns3/packet-sink-helper.h"
33 #include "ns3/packet-sink.h"
34 #include "ns3/packet-socket-helper.h"
35 #include "ns3/packet-socket-address.h"
36 #include "ns3/csma-net-device.h"
37 #include "ns3/point-to-point-helper.h"
38 #include "ns3/pointer.h"
39 #include "ns3/simple-channel.h"
40 #include "ns3/simulator.h"
41 #include "ns3/string.h"
43 #include "ns3/uinteger.h"
44 #include "ns3/ipv4-packet-info-tag.h"
57 virtual void DoRun (
void);
65 :
TestCase (
"Dynamic global routing example"), m_count (0)
95 while ((packet = socket->
RecvFrom (from)))
178 ipv4.
SetBase (
"10.1.1.0",
"255.255.255.0");
181 ipv4.
SetBase (
"10.1.2.0",
"255.255.255.0");
184 ipv4.
SetBase (
"10.1.3.0",
"255.255.255.0");
187 ipv4.
SetBase (
"10.250.1.0",
"255.255.255.0");
190 ipv4.
SetBase (
"172.16.1.0",
"255.255.255.0");
195 Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
223 TypeId tid = TypeId::LookupByName (
"ns3::UdpSocketFactory");
236 uint32_t ipv4ifIndex1 = 2;
242 Simulator::Schedule (
Seconds (2),&Ipv4::SetDown,ipv41, ipv4ifIndex1);
243 Simulator::Schedule (
Seconds (4),&Ipv4::SetUp,ipv41, ipv4ifIndex1);
249 uint32_t ipv4ifIndex6 = 2;
250 Simulator::Schedule (
Seconds (6),&Ipv4::SetDown,ipv46, ipv4ifIndex6);
251 Simulator::Schedule (
Seconds (8),&Ipv4::SetUp,ipv46, ipv4ifIndex6);
253 Simulator::Schedule (
Seconds (12),&Ipv4::SetDown,ipv41, ipv4ifIndex1);
254 Simulator::Schedule (
Seconds (14),&Ipv4::SetUp,ipv41, ipv4ifIndex1);
277 Simulator::Destroy ();
287 virtual void DoRun (
void);
292 :
TestCase (
"Slash 32 global routing example")
329 deviceA->
SetAddress (Mac48Address::Allocate ());
333 deviceC->
SetAddress (Mac48Address::Allocate ());
334 nC->AddDevice (deviceC);
338 ipv4.
SetBase (
"10.1.1.0",
"255.255.255.252");
341 ipv4.
SetBase (
"10.1.1.4",
"255.255.255.252");
348 int32_t ifIndexC = ipv4C->AddInterface (deviceC);
353 ipv4A->
SetUp (ifIndexA);
356 ipv4C->AddAddress (ifIndexC, ifInAddrC);
357 ipv4C->SetMetric (ifIndexC, 1);
358 ipv4C->SetUp (ifIndexC);
362 Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
385 Simulator::Destroy ();