add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.
This commit is contained in:
@@ -45,8 +45,7 @@ PointToPointIpv4Topology::AddNetDevice (
|
||||
NS_ASSERT (channel->GetNDevices () <= 1);
|
||||
|
||||
Ptr<PointToPointNetDevice> nd =
|
||||
CreateObject<PointToPointNetDevice> ("Node", node,
|
||||
"Address", Mac48Address::Allocate ());
|
||||
CreateObject<PointToPointNetDevice> ("Address", Mac48Address::Allocate ());
|
||||
node->AddDevice (nd);
|
||||
Ptr<Queue> q = CreateObject<DropTailQueue> ();
|
||||
nd->AddQueue(q);
|
||||
|
||||
@@ -44,17 +44,16 @@ main (int argc, char *argv[])
|
||||
|
||||
Ptr<Node> n0 = bus.GetNode (0);
|
||||
Ptr<UdpEchoClient> client =
|
||||
CreateObject<UdpEchoClient> ("Node", n0,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.0.1"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (1),
|
||||
"Interval", Seconds(1.),
|
||||
"PacketSize", Uinteger (1024));
|
||||
CreateObject<UdpEchoClient> ("RemoteIpv4", Ipv4Address ("10.1.0.1"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (1),
|
||||
"Interval", Seconds(1.),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n0->AddApplication (client);
|
||||
|
||||
Ptr<Node> n1 = bus.GetNode (1);
|
||||
Ptr<UdpEchoServer> server =
|
||||
CreateObject<UdpEchoServer> ("Node", n1, "Port", Uinteger (port));
|
||||
CreateObject<UdpEchoServer> ("Port", Uinteger (port));
|
||||
n1->AddApplication (server);
|
||||
|
||||
server->Start(Seconds(1.));
|
||||
|
||||
@@ -69,17 +69,15 @@ main (int argc, char *argv[])
|
||||
uint16_t port = 7;
|
||||
|
||||
Ptr<UdpEchoClient> client =
|
||||
CreateObject<UdpEchoClient> ("Node", n0,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.1.2"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (1),
|
||||
"Interval", Seconds(1.),
|
||||
"PacketSize", Uinteger (1024));
|
||||
CreateObject<UdpEchoClient> ("RemoteIpv4", Ipv4Address ("10.1.1.2"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (1),
|
||||
"Interval", Seconds(1.),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n0->AddApplication (client);
|
||||
|
||||
Ptr<UdpEchoServer> server =
|
||||
CreateObject<UdpEchoServer> ("Node", n1,
|
||||
"Port", Uinteger (port));
|
||||
CreateObject<UdpEchoServer> ("Port", Uinteger (port));
|
||||
n1->AddApplication (server);
|
||||
|
||||
server->Start(Seconds(1.));
|
||||
|
||||
@@ -70,17 +70,15 @@ main (int argc, char *argv[])
|
||||
uint16_t port = 7;
|
||||
|
||||
Ptr<UdpEchoClient> client =
|
||||
CreateObject<UdpEchoClient> ("Node", n0,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.1.2"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (1),
|
||||
"Interval", Seconds(1.),
|
||||
"PacketSize", Uinteger (1024));
|
||||
CreateObject<UdpEchoClient> ("RemoteIpv4", Ipv4Address ("10.1.1.2"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (1),
|
||||
"Interval", Seconds(1.),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n0->AddApplication (client);
|
||||
|
||||
Ptr<UdpEchoServer> server =
|
||||
CreateObject<UdpEchoServer> ("Node", n1,
|
||||
"Port", Uinteger (port));
|
||||
CreateObject<UdpEchoServer> ("Port", Uinteger (port));
|
||||
n1->AddApplication (server);
|
||||
|
||||
server->Start(Seconds(1.));
|
||||
|
||||
@@ -68,17 +68,15 @@ main (int argc, char *argv[])
|
||||
uint16_t port = 7;
|
||||
|
||||
Ptr<UdpEchoClient> client =
|
||||
CreateObject<UdpEchoClient> ("Node", n0,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.1.2"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (1),
|
||||
"Interval", Seconds(1.),
|
||||
"PacketSize", Uinteger (1024));
|
||||
CreateObject<UdpEchoClient> ("RemoteIpv4", Ipv4Address ("10.1.1.2"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (1),
|
||||
"Interval", Seconds(1.),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n0->AddApplication (client);
|
||||
|
||||
Ptr<UdpEchoServer> server =
|
||||
CreateObject<UdpEchoServer> ("Node", n1,
|
||||
"Port", Uinteger (port));
|
||||
CreateObject<UdpEchoServer> ("Port", Uinteger (port));
|
||||
n1->AddApplication (server);
|
||||
|
||||
server->Start(Seconds(1.));
|
||||
|
||||
@@ -127,53 +127,45 @@ main (int argc, char *argv[])
|
||||
uint16_t port = 7;
|
||||
|
||||
Ptr<UdpEchoClient> client0 =
|
||||
CreateObject<UdpEchoClient> (
|
||||
"Node", n0,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.2.1"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (100),
|
||||
"Interval", Seconds (0.01),
|
||||
"PacketSize", Uinteger (1024));
|
||||
CreateObject<UdpEchoClient> ("RemoteIpv4", Ipv4Address ("10.1.2.1"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (100),
|
||||
"Interval", Seconds (0.01),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n0->AddApplication (client0);
|
||||
Ptr<UdpEchoClient> client1 =
|
||||
CreateObject<UdpEchoClient> (
|
||||
"Node", n1,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.2.2"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (100),
|
||||
"Interval", Seconds (0.01),
|
||||
"PacketSize", Uinteger (1024));
|
||||
CreateObject<UdpEchoClient> ("RemoteIpv4", Ipv4Address ("10.1.2.2"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (100),
|
||||
"Interval", Seconds (0.01),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n1->AddApplication (client1);
|
||||
Ptr<UdpEchoClient> client2 =
|
||||
CreateObject<UdpEchoClient> (
|
||||
"Node", n2,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.2.3"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (100),
|
||||
"Interval", Seconds (0.01),
|
||||
"PacketSize", Uinteger (1024));
|
||||
CreateObject<UdpEchoClient> ("RemoteIpv4", Ipv4Address ("10.1.2.3"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (100),
|
||||
"Interval", Seconds (0.01),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n2->AddApplication (client2);
|
||||
Ptr<UdpEchoClient> client3 =
|
||||
CreateObject<UdpEchoClient> (
|
||||
"Node", n3,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.2.4"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (100),
|
||||
"Interval", Seconds (0.01),
|
||||
"PacketSize", Uinteger (1024));
|
||||
CreateObject<UdpEchoClient> ("RemoteIpv4", Ipv4Address ("10.1.2.4"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (100),
|
||||
"Interval", Seconds (0.01),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n3->AddApplication (client3);
|
||||
|
||||
Ptr<UdpEchoServer> server4 =
|
||||
CreateObject<UdpEchoServer> ("Node", n4, "Port", Uinteger (port));
|
||||
CreateObject<UdpEchoServer> ("Port", Uinteger (port));
|
||||
n4->AddApplication (server4);
|
||||
Ptr<UdpEchoServer> server5 =
|
||||
CreateObject<UdpEchoServer> ("Node", n5, "Port", Uinteger (port));
|
||||
CreateObject<UdpEchoServer> ("Port", Uinteger (port));
|
||||
n5->AddApplication (server5);
|
||||
Ptr<UdpEchoServer> server6 =
|
||||
CreateObject<UdpEchoServer> ("Node", n6, "Port", Uinteger (port));
|
||||
CreateObject<UdpEchoServer> ("Port", Uinteger (port));
|
||||
n6->AddApplication (server6);
|
||||
Ptr<UdpEchoServer> server7 =
|
||||
CreateObject<UdpEchoServer> ("Node", n7, "Port", Uinteger (port));
|
||||
CreateObject<UdpEchoServer> ("Port", Uinteger (port));
|
||||
n7->AddApplication (server7);
|
||||
|
||||
server4->Start(Seconds(1.));
|
||||
|
||||
@@ -61,17 +61,15 @@ main (int argc, char *argv[])
|
||||
uint16_t port = 7;
|
||||
|
||||
Ptr<UdpEchoClient> client =
|
||||
CreateObject<UdpEchoClient> ("Node", n0,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.1.2"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (1),
|
||||
"Interval", Seconds(1.),
|
||||
"PacketSize", Uinteger (1024));
|
||||
CreateObject<UdpEchoClient> ("RemoteIpv4", Ipv4Address ("10.1.1.2"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (1),
|
||||
"Interval", Seconds(1.),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n0->AddApplication (client);
|
||||
|
||||
Ptr<UdpEchoServer> server =
|
||||
CreateObject<UdpEchoServer> ("Node", n1,
|
||||
"Port", Uinteger (port));
|
||||
CreateObject<UdpEchoServer> ("Port", Uinteger (port));
|
||||
n1->AddApplication (server);
|
||||
|
||||
server->Start(Seconds(1.));
|
||||
|
||||
@@ -148,8 +148,7 @@ main (int argc, char *argv[])
|
||||
uint16_t port = 7;
|
||||
|
||||
Ptr<UdpEchoClient> client =
|
||||
CreateObject<UdpEchoClient> ("Node", n4,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.1.2"),
|
||||
CreateObject<UdpEchoClient> ("RemoteIpv4", Ipv4Address ("10.1.1.2"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (1),
|
||||
"Interval", Seconds(1.),
|
||||
@@ -157,8 +156,7 @@ main (int argc, char *argv[])
|
||||
n0->AddApplication (client);
|
||||
|
||||
Ptr<UdpEchoServer> server =
|
||||
CreateObject<UdpEchoServer> ("Node", n1,
|
||||
"Port", Uinteger (port));
|
||||
CreateObject<UdpEchoServer> ("Port", Uinteger (port));
|
||||
n1->AddApplication (server);
|
||||
|
||||
server->Start(Seconds(1.));
|
||||
|
||||
@@ -148,17 +148,15 @@ main (int argc, char *argv[])
|
||||
uint16_t port = 7;
|
||||
|
||||
Ptr<UdpEchoClient> client =
|
||||
CreateObject<UdpEchoClient> ("Node", n0,
|
||||
"RemoteIpv4", Ipv4Address ("10.1.1.2"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (1),
|
||||
"Interval", Seconds(1.),
|
||||
"PacketSize", Uinteger (1024));
|
||||
CreateObject<UdpEchoClient> ("RemoteIpv4", Ipv4Address ("10.1.1.2"),
|
||||
"RemotePort", Uinteger (port),
|
||||
"MaxPackets", Uinteger (1),
|
||||
"Interval", Seconds(1.),
|
||||
"PacketSize", Uinteger (1024));
|
||||
n0->AddApplication (client);
|
||||
|
||||
Ptr<UdpEchoServer> server =
|
||||
CreateObject<UdpEchoServer> ("Node", n1,
|
||||
"Port", Uinteger (port));
|
||||
CreateObject<UdpEchoServer> ("Port", Uinteger (port));
|
||||
n1->AddApplication (server);
|
||||
|
||||
server->Start(Seconds(1.));
|
||||
|
||||
Reference in New Issue
Block a user