add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.

This commit is contained in:
Mathieu Lacage
2008-03-13 11:10:38 -07:00
parent aa3db11715
commit fb452286e6
43 changed files with 232 additions and 328 deletions

View File

@@ -149,12 +149,10 @@ main (int argc, char *argv[])
// 512 bytes (default) at a rate of 500 Kb/s (default) from n0
NS_LOG_INFO ("Create Applications.");
Ptr<OnOffApplication> ooff =
CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress ("255.255.255.255", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("255.255.255.255", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n0->AddApplication (ooff);
// Start the application
ooff->Start(Seconds(1.0));
@@ -162,20 +160,16 @@ main (int argc, char *argv[])
// Create an optional packet sink to receive these packets
Ptr<PacketSink> sink =
CreateObject<PacketSink> (
"Node", n1,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
n1->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.0));
sink->Stop (Seconds (10.0));
// Create an optional packet sink to receive these packets
sink = CreateObject<PacketSink> (
"Node", n2,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
sink = CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
n2->AddApplication (sink);
// Start the sink

View File

@@ -278,14 +278,12 @@ main (int argc, char *argv[])
// Configure a multicast packet generator that generates a packet
// every few seconds
Ptr<OnOffApplication> ooff =
CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress (multicastGroup, port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0),
"DataRate", DataRate ("255b/s"),
"PacketSize", Uinteger (128));
CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress (multicastGroup, port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0),
"DataRate", DataRate ("255b/s"),
"PacketSize", Uinteger (128));
n0->AddApplication (ooff);
//
// Tell the application when to start and stop.
@@ -297,10 +295,8 @@ main (int argc, char *argv[])
// If you enable logging on this (above) it will print a log statement
// for every packet received
Ptr<PacketSink> sink =
CreateObject<PacketSink> (
"Node", n4,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
n4->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.0));

View File

@@ -160,12 +160,10 @@ main (int argc, char *argv[])
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
Ptr<OnOffApplication> ooff =
CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress ("10.1.1.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.1.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n0->AddApplication (ooff);
//
@@ -176,12 +174,10 @@ main (int argc, char *argv[])
//
// Create a similar flow from n3 to n0, starting at time 1.1 seconds
//
ooff = CreateObject<OnOffApplication> (
"Node", n3,
"Remote", Address (InetSocketAddress ("10.1.1.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
ooff = CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.1.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n3->AddApplication (ooff);
ooff->Start(Seconds(1.1));

View File

@@ -62,8 +62,7 @@ NS_LOG_COMPONENT_DEFINE ("CsmaPacketSocketExample");
static Ptr<CsmaNetDevice>
CreateCsmaDevice (Ptr<Node> node, Ptr<CsmaChannel> channel)
{
Ptr<CsmaNetDevice> device = CreateObject<CsmaNetDevice> ("Node", node,
"Address", Mac48Address::Allocate (),
Ptr<CsmaNetDevice> device = CreateObject<CsmaNetDevice> ("Address", Mac48Address::Allocate (),
"EncapsulationMode", String ("Llc"));
node->AddDevice (device);
device->Attach (channel);
@@ -141,24 +140,20 @@ main (int argc, char *argv[])
// from n0 to n1
NS_LOG_INFO ("Create Applications.");
Ptr<OnOffApplication> ooff =
CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (n0ToN1),
"Protocol", TypeId::LookupByName ("Packet"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
CreateObject<OnOffApplication> ("Remote", Address (n0ToN1),
"Protocol", TypeId::LookupByName ("Packet"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n0->AddApplication (ooff);
// Start the application
ooff->Start(Seconds(1.0));
ooff->Stop (Seconds(10.0));
// Create a similar flow from n3 to n0, starting at time 1.1 seconds
ooff = CreateObject<OnOffApplication> (
"Node", n3,
"Remote", Address (n3ToN0),
"Protocol", TypeId::LookupByName ("Packet"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
ooff = CreateObject<OnOffApplication> ("Remote", Address (n3ToN0),
"Protocol", TypeId::LookupByName ("Packet"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n3->AddApplication (ooff);
// Start the application
ooff->Start(Seconds(1.1));

View File

@@ -186,14 +186,12 @@ main (int argc, char *argv[])
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
Ptr<OnOffApplication> ooff =
CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress ("10.1.3.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable (1),
"OffTime", ConstantVariable (0),
"DataRate", DataRate("300bps"),
"PacketSize", Uinteger (50));
CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.3.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable (1),
"OffTime", ConstantVariable (0),
"DataRate", DataRate("300bps"),
"PacketSize", Uinteger (50));
n0->AddApplication (ooff);
// Start the application
ooff->Start (Seconds (1.0));

View File

@@ -183,12 +183,10 @@ main (int argc, char *argv[])
// Create a flow from n3 to n1, starting at time 1.1 seconds
Ptr<OnOffApplication> ooff =
CreateObject<OnOffApplication> (
"Node", n3,
"Remote", Address (InetSocketAddress ("10.1.1.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable (1),
"OffTime", ConstantVariable (0));
CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.1.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable (1),
"OffTime", ConstantVariable (0));
n3->AddApplication (ooff);
// Start the application
ooff->Start (Seconds (1.1));
@@ -196,10 +194,8 @@ main (int argc, char *argv[])
// Create a packet sink to receive these packets
Ptr<PacketSink> sink =
CreateObject<PacketSink> (
"Node", n1,
"Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
CreateObject<PacketSink> ("Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
n1->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.1));

View File

@@ -143,31 +143,25 @@ main (int argc, char *argv[])
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
Ptr<OnOffApplication> ooff =
CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress ("10.1.3.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.3.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n0->AddApplication (ooff);
// Start the application
ooff->Start(Seconds(1.0));
ooff->Stop (Seconds(10.0));
// Create an optional packet sink to receive these packets
Ptr<PacketSink> sink = CreateObject<PacketSink> (
"Node", n3,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
Ptr<PacketSink> sink = CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
n3->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.0));
sink->Stop (Seconds (10.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
ooff = CreateObject<OnOffApplication> (
"Node", n3,
"Remote", Address (InetSocketAddress ("10.1.2.1", port)),
ooff = CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.2.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
@@ -177,9 +171,7 @@ main (int argc, char *argv[])
ooff->Stop (Seconds(10.0));
// Create a packet sink to receive these packets
sink = CreateObject<PacketSink> (
"Node", n1,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
sink = CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
n1->AddApplication (sink);
// Start the sink

View File

@@ -160,11 +160,10 @@ main (int argc, char *argv[])
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
Ptr<OnOffApplication> ooff =
CreateObject<OnOffApplication> ("Node", n0,
"Remote", Address (InetSocketAddress ("10.1.3.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable (1),
"OffTime", ConstantVariable (0));
CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.3.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable (1),
"OffTime", ConstantVariable (0));
n0->AddApplication (ooff);
// Start the application
ooff->Start (Seconds (1.0));
@@ -173,30 +172,26 @@ main (int argc, char *argv[])
// Create a packet sink to receive these packets
// The last argument "true" disables output from the Receive callback
Ptr<PacketSink> sink =
CreateObject<PacketSink> ("Node", n3,
"Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
CreateObject<PacketSink> ("Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
n3->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.0));
sink->Stop (Seconds (10.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
ooff = CreateObject<OnOffApplication> (
"Node", n3,
"Remote", Address (InetSocketAddress ("10.1.2.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable (1),
"OffTime", ConstantVariable (0));
ooff = CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.2.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable (1),
"OffTime", ConstantVariable (0));
n3->AddApplication (ooff);
// Start the application
ooff->Start (Seconds (1.1));
ooff->Stop (Seconds (10.0));
// Create a packet sink to receive these packets
sink = CreateObject<PacketSink> ("Node", n1,
"Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
sink = CreateObject<PacketSink> ("Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
n1->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.1));

View File

@@ -167,42 +167,34 @@ main (int argc, char *argv[])
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
Ptr<OnOffApplication> ooff =
CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress ("10.1.4.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.4.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n0->AddApplication (ooff);
// Start the application
ooff->Start(Seconds(1.0));
// Create an optional packet sink to receive these packets
Ptr<PacketSink> sink =
CreateObject<PacketSink> (
"Node", n4,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
n3->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
ooff = CreateObject<OnOffApplication> (
"Node", n4,
"Remote", Address (InetSocketAddress ("10.1.2.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
ooff = CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.2.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n3->AddApplication (ooff);
// Start the application
ooff->Start (Seconds(1.1));
// Create a packet sink to receive these packets
sink = CreateObject<PacketSink> (
"Node", n1,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
sink = CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
n1->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.1));

View File

@@ -136,42 +136,34 @@ main (int argc, char *argv[])
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
Ptr<OnOffApplication> ooff =
CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress ("10.1.3.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.3.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n0->AddApplication (ooff);
// Start the application
ooff->Start (Seconds(1.0));
// Create an optional packet sink to receive these packets
Ptr<PacketSink> sink =
CreateObject<PacketSink> (
"Node", n3,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
n3->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
ooff = CreateObject<OnOffApplication> (
"Node", n3,
"Remote", Address (InetSocketAddress ("10.1.2.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
ooff = CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.2.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n3->AddApplication (ooff);
// Start the application
ooff->Start(Seconds(1.1));
// Create a packet sink to receive these packets
sink = CreateObject<PacketSink> (
"Node", n1,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
sink = CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
n1->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.1));
@@ -180,22 +172,18 @@ main (int argc, char *argv[])
// Create a file transfer from n0 to n3, starting at time 1.2
uint16_t servPort = 500;
ooff = CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress ("10.1.3.2", servPort)),
"Protocol", TypeId::LookupByName ("Tcp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
ooff = CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.3.2", servPort)),
"Protocol", TypeId::LookupByName ("Tcp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n0->AddApplication (ooff);
// Start the application
ooff->Start (Seconds(1.2));
ooff->Stop (Seconds(1.35));
// Create a packet sink to receive these TCP packets
sink = CreateObject<PacketSink> (
"Node", n3,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("Tcp"));
sink = CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("Tcp"));
n3->AddApplication (sink);
sink->Start (Seconds (1.2));

View File

@@ -198,10 +198,8 @@ int main (int argc, char *argv[])
// Create a packet sink to receive these packets
Ptr<PacketSink> sink =
CreateObject<PacketSink> (
"Node", n2,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("Tcp"));
CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("Tcp"));
n2->AddApplication (sink);
sink->Start (Seconds (0.0));
sink->Stop (Seconds (10000.0));

View File

@@ -198,10 +198,8 @@ int main (int argc, char *argv[])
// Create a packet sink to receive these packets
Ptr<PacketSink> sink =
CreateObject<PacketSink> (
"Node", n2,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("Tcp"));
CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("Tcp"));
n2->AddApplication (sink);
sink->Start (Seconds (0.0));
sink->Stop (Seconds (100.0));

View File

@@ -180,10 +180,8 @@ int main (int argc, char *argv[])
// Create a packet sink to receive these packets
Ptr<PacketSink> sink =
CreateObject<PacketSink> (
"Node", n2,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("Tcp"));
CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("Tcp"));
n2->AddApplication (sink);
sink->Start (Seconds (0.0));
sink->Stop (Seconds (100.0));

View File

@@ -190,10 +190,8 @@ int main (int argc, char *argv[])
// Create a packet sink to receive these packets
Ptr<PacketSink> sink =
CreateObject<PacketSink> (
"Node", n2,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("Tcp"));
CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("Tcp"));
n2->AddApplication (sink);
sink->Start (Seconds (0.0));
sink->Stop (Seconds (100.0));

View File

@@ -161,8 +161,7 @@ main (int argc, char *argv[])
//
uint16_t port = 9; // well-known echo port number
Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> ("Node", n1,
"Port", Uinteger (port));
Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> ("Port", Uinteger (port));
n1->AddApplication (server);
//
// Create a UdpEchoClient application to send UDP datagrams from node zero to
@@ -173,12 +172,11 @@ main (int argc, char *argv[])
Time interPacketInterval = Seconds (1.);
Ptr<UdpEchoClient> client =
CreateObject<UdpEchoClient> ("Node", n0,
"RemoteIpv4", Ipv4Address ("10.1.1.2"),
"RemotePort", Uinteger (port),
"MaxPackets", Uinteger (maxPacketCount),
"Interval", interPacketInterval,
"PacketSize", Uinteger (packetSize));
CreateObject<UdpEchoClient> ("RemoteIpv4", Ipv4Address ("10.1.1.2"),
"RemotePort", Uinteger (port),
"MaxPackets", Uinteger (maxPacketCount),
"Interval", interPacketInterval,
"PacketSize", Uinteger (packetSize));
n0->AddApplication (client);
//
// Tell the applications when to start and stop.

View File

@@ -149,13 +149,12 @@ Experiment::Run (const WifiHelper &wifi)
destination.SetSingleDevice (0);
destination.SetPhysicalAddress (devices.Get (1)->GetAddress ());
Ptr<Application> app =
CreateObject<OnOffApplication> ("Node", c.Get (0),
"Remote", Address (destination),
"Protocol", TypeId::LookupByName ("Packet"),
"OnTime", ConstantVariable (250),
"OffTime", ConstantVariable (0),
"DataRate", DataRate (60000000),
"PacketSize", Uinteger (2000));
CreateObject<OnOffApplication> ("Remote", Address (destination),
"Protocol", TypeId::LookupByName ("Packet"),
"OnTime", ConstantVariable (250),
"OffTime", ConstantVariable (0),
"DataRate", DataRate (60000000),
"PacketSize", Uinteger (2000));
c.Get (0)->AddApplication (app);
app->Start (Seconds (0.5));

View File

@@ -144,11 +144,10 @@ int main (int argc, char *argv[])
destination.SetSingleDevice (0);
destination.SetPhysicalAddress (staDevs.Get(1)->GetAddress ());
Ptr<Application> app =
CreateObject<OnOffApplication> ("Node", stas.Get (0),
"Remote", Address (destination),
"Protocol", TypeId::LookupByName ("Packet"),
"OnTime", ConstantVariable (42),
"OffTime", ConstantVariable (0));
CreateObject<OnOffApplication> ("Remote", Address (destination),
"Protocol", TypeId::LookupByName ("Packet"),
"OnTime", ConstantVariable (42),
"OffTime", ConstantVariable (0));
stas.Get (0)->AddApplication (app);
app->Start (Seconds (0.5));
app->Stop (Seconds (43.0));

View File

@@ -44,9 +44,8 @@ CsmaIpv4Topology::AddIpv4CsmaNetDevice(
Ptr<Queue> q = CreateObject<DropTailQueue> ();
// assume full-duplex
Ptr<CsmaNetDevice> nd = CreateObject<CsmaNetDevice> ("Node", node,
"Address", addr,
"EncapsulationMode", String ("IpArp"));
Ptr<CsmaNetDevice> nd = CreateObject<CsmaNetDevice> ("Address", addr,
"EncapsulationMode", String ("IpArp"));
node->AddDevice (nd);
nd->AddQueue(q);
@@ -62,18 +61,16 @@ CsmaIpv4Topology::AddIpv4LlcCsmaNode(Ptr<Node> n1,
{
Ptr<Queue> q = CreateObject<DropTailQueue> ();
Ptr<CsmaNetDevice> nd0 = CreateObject<CsmaNetDevice> ("Node", n1,
"Address", addr,
"EncapsulationMode", String ("Llc"));
Ptr<CsmaNetDevice> nd0 = CreateObject<CsmaNetDevice> ("Address", addr,
"EncapsulationMode", String ("Llc"));
n1->AddDevice (nd0);
nd0->SetSendEnable (true);
nd0->SetReceiveEnable (false);
nd0->AddQueue(q);
nd0->Attach (ch);
Ptr<CsmaNetDevice> nd1 = CreateObject<CsmaNetDevice> ("Node", n1,
"Address", addr,
"EncapsulationMode", String ("Llc"));
Ptr<CsmaNetDevice> nd1 = CreateObject<CsmaNetDevice> ("Address", addr,
"EncapsulationMode", String ("Llc"));
n1->AddDevice (nd1);
nd1->SetSendEnable (false);
nd1->SetReceiveEnable (true);
@@ -88,18 +85,16 @@ CsmaIpv4Topology::AddIpv4RawCsmaNode(Ptr<Node> n1,
{
Ptr<Queue> q = CreateObject<DropTailQueue> ();
Ptr<CsmaNetDevice> nd0 = CreateObject<CsmaNetDevice> ("Node", n1,
"Address", addr,
"EncapsulationMode", String ("Raw"));
Ptr<CsmaNetDevice> nd0 = CreateObject<CsmaNetDevice> ("Address", addr,
"EncapsulationMode", String ("Raw"));
n1->AddDevice (nd0);
nd0->SetSendEnable (true);
nd0->SetReceiveEnable (false);
nd0->AddQueue(q);
nd0->Attach (ch);
Ptr<CsmaNetDevice> nd1 = CreateObject<CsmaNetDevice> ("Node", n1,
"Address", addr,
"EncapsulationMode", String ("Raw"));
Ptr<CsmaNetDevice> nd1 = CreateObject<CsmaNetDevice> ("Address", addr,
"EncapsulationMode", String ("Raw"));
n1->AddDevice (nd1);
nd1->SetSendEnable (false);
nd1->SetReceiveEnable (true);

View File

@@ -45,11 +45,6 @@ CsmaNetDevice::GetTypeId (void)
static TypeId tid = TypeId ("CsmaNetDevice")
.SetParent<NetDevice> ()
.AddConstructor<CsmaNetDevice> ()
.AddAttribute ("Node", "The node with which this device is associated",
TypeId::ATTR_GET | TypeId::ATTR_CONSTRUCT,
Ptr<Node> (0),
MakePtrAccessor (&CsmaNetDevice::m_node),
MakePtrChecker<Node> ())
.AddAttribute ("Address", "The address of this device.",
Mac48Address ("ff:ff:ff:ff:ff:ff"),
MakeMac48AddressAccessor (&CsmaNetDevice::m_address),
@@ -702,6 +697,11 @@ CsmaNetDevice::GetNode (void) const
{
return m_node;
}
void
CsmaNetDevice::SetNode (Ptr<Node> node)
{
m_node = node;
}
bool
CsmaNetDevice::NeedsArp (void) const
{

View File

@@ -222,6 +222,7 @@ enum CsmaEncapsulationMode {
virtual bool IsPointToPoint (void) const;
virtual bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
virtual Ptr<Node> GetNode (void) const;
virtual void SetNode (Ptr<Node> node);
virtual bool NeedsArp (void) const;
virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);

View File

@@ -48,9 +48,8 @@ CsmaTopology::AddCsmaEthernetNode(
Ptr<CsmaChannel> ch,
Mac48Address addr)
{
Ptr<CsmaNetDevice> nd1 = CreateObject<CsmaNetDevice> ("Node", Ptr<Node> (n1),
"Address", addr,
"EncapsulationMode", "EthernetV1");
Ptr<CsmaNetDevice> nd1 = CreateObject<CsmaNetDevice> ("Address", addr,
"EncapsulationMode", "EthernetV1");
Ptr<Queue> q = Queue::CreateDefault ();
nd1->AddQueue(q);

View File

@@ -42,11 +42,6 @@ PointToPointNetDevice::GetTypeId (void)
static TypeId tid = TypeId ("PointToPointNetDevice")
.SetParent<NetDevice> ()
.AddConstructor<PointToPointNetDevice> ()
.AddAttribute ("Node", "The node with which this device is associated",
TypeId::ATTR_GET | TypeId::ATTR_CONSTRUCT,
Ptr<Node> (0),
MakePtrAccessor (&PointToPointNetDevice::m_node),
MakePtrChecker<Node> ())
.AddAttribute ("Address", "The address of this device.",
Mac48Address ("ff:ff:ff:ff:ff:ff"),
MakeMac48AddressAccessor (&PointToPointNetDevice::m_address),
@@ -379,6 +374,11 @@ PointToPointNetDevice::GetNode (void) const
{
return m_node;
}
void
PointToPointNetDevice::SetNode (Ptr<Node> node)
{
m_node = node;
}
bool
PointToPointNetDevice::NeedsArp (void) const
{

View File

@@ -164,6 +164,7 @@ public:
virtual bool IsPointToPoint (void) const;
virtual bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
virtual Ptr<Node> GetNode (void) const;
virtual void SetNode (Ptr<Node> node);
virtual bool NeedsArp (void) const;
virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);

View File

@@ -48,16 +48,14 @@ PointToPointTopology::AddPointToPointLink(
{
Ptr<PointToPointChannel> channel = CreateObject<PointToPointChannel> ("BitRate", bps, "Delay", delay);
Ptr<PointToPointNetDevice> net1 = CreateObject<PointToPointNetDevice> ("Node", n1,
"Address", Mac48Address::Allocate ());
Ptr<PointToPointNetDevice> net1 = CreateObject<PointToPointNetDevice> ("Address", Mac48Address::Allocate ());
n1->AddDevice (net1);
Ptr<Queue> q = CreateObject<DropTailQueue> ();
net1->AddQueue(q);
net1->Attach (channel);
Ptr<PointToPointNetDevice> net2 = CreateObject<PointToPointNetDevice> ("Node", n2,
"Address", Mac48Address::Allocate ());
Ptr<PointToPointNetDevice> net2 = CreateObject<PointToPointNetDevice> ("Address", Mac48Address::Allocate ());
n2->AddDevice (net2);
q = CreateObject<DropTailQueue> ();

View File

@@ -228,6 +228,11 @@ WifiNetDevice::GetNode (void) const
{
return m_node;
}
void
WifiNetDevice::SetNode (Ptr<Node> node)
{
m_node = node;
}
bool
WifiNetDevice::NeedsArp (void) const
{

View File

@@ -74,6 +74,7 @@ public:
virtual bool IsPointToPoint (void) const;
virtual bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
virtual Ptr<Node> GetNode (void) const;
virtual void SetNode (Ptr<Node> node);
virtual bool NeedsArp (void) const;
virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);

View File

@@ -324,11 +324,6 @@ TcpL4Protocol::GetTypeId (void)
{
static TypeId tid = TypeId ("TcpL4Protocol")
.SetParent<Ipv4L4Protocol> ()
.AddAttribute ("Node", "The node to which this protocol is associated",
TypeId::ATTR_GET | TypeId::ATTR_CONSTRUCT,
Ptr<Node> (0),
MakePtrAccessor (&TcpL4Protocol::m_node),
MakePtrChecker<Node> ())
.AddAttribute ("RttEstimatorFactory",
"How RttEstimator objects are created.",
GetDefaultRttEstimatorFactory (),

View File

@@ -46,11 +46,6 @@ UdpL4Protocol::GetTypeId (void)
static TypeId tid = TypeId ("UdpL4Protocol")
.SetParent<Ipv4L4Protocol> ()
.AddConstructor<UdpL4Protocol> ()
.AddAttribute ("Node", "The node which contains this protocol.",
TypeId::ATTR_GET | TypeId::ATTR_CONSTRUCT,
Ptr<Node> (0),
MakePtrAccessor (&UdpL4Protocol::m_node),
MakePtrChecker<Node> ())
;
return tid;
}

View File

@@ -412,7 +412,7 @@ UdpSocketTest::RunTests (void)
Ptr<Node> rxNode = CreateObject<InternetNode> ();
Ptr<PointToPointNetDevice> rxDev1, rxDev2;
{ // first interface
rxDev1 = CreateObject<PointToPointNetDevice> ("Node", rxNode, "Address", Mac48Address::Allocate ());
rxDev1 = CreateObject<PointToPointNetDevice> ("Address", Mac48Address::Allocate ());
rxNode->AddDevice (rxDev1);
rxDev1->AddQueue(CreateObject<DropTailQueue> ());
Ptr<Ipv4> ipv4 = rxNode->GetObject<Ipv4> ();
@@ -423,7 +423,7 @@ UdpSocketTest::RunTests (void)
}
{ // second interface
rxDev2 = CreateObject<PointToPointNetDevice> ("Node", rxNode, "Address", Mac48Address::Allocate ());
rxDev2 = CreateObject<PointToPointNetDevice> ("Address", Mac48Address::Allocate ());
rxNode->AddDevice (rxDev2);
rxDev2->AddQueue(CreateObject<DropTailQueue> ());
Ptr<Ipv4> ipv4 = rxNode->GetObject<Ipv4> ();
@@ -437,7 +437,7 @@ UdpSocketTest::RunTests (void)
Ptr<Node> txNode = CreateObject<InternetNode> ();
Ptr<PointToPointNetDevice> txDev;
{
txDev = CreateObject<PointToPointNetDevice> ("Node", txNode, "Address", Mac48Address::Allocate ());
txDev = CreateObject<PointToPointNetDevice> ("Address", Mac48Address::Allocate ());
txNode->AddDevice (txDev);
txDev->AddQueue(CreateObject<DropTailQueue> ());
Ptr<Ipv4> ipv4 = txNode->GetObject<Ipv4> ();

View File

@@ -40,10 +40,6 @@ Application::GetTypeId (void)
{
static TypeId tid = TypeId ("Application")
.SetParent<Object> ()
.AddAttribute ("Node", "The on which this application resides",
Ptr<Node> (0),
MakePtrAccessor (&Application::m_node),
MakePtrChecker<Node> ())
;
return tid;
}
@@ -92,6 +88,12 @@ Ptr<Node> Application::GetNode() const
return m_node;
}
void
Application::SetNode (Ptr<Node> node)
{
m_node = node;
}
// Protected methods
// StartApp and StopApp will likely be overridden by application subclasses
void Application::StartApplication()

View File

@@ -102,6 +102,8 @@ public:
* \returns the Node to which this Application object is attached.
*/
Ptr<Node> GetNode() const;
void SetNode (Ptr<Node> node);
private:
/**

View File

@@ -221,6 +221,8 @@ public:
*/
virtual Ptr<Node> GetNode (void) const = 0;
virtual void SetNode (Ptr<Node> node) = 0;
/**
* \returns true if ARP is needed, false otherwise.
*

View File

@@ -96,6 +96,7 @@ Node::AddDevice (Ptr<NetDevice> device)
{
uint32_t index = m_devices.size ();
m_devices.push_back (device);
device->SetNode (this);
device->SetIfIndex(index);
device->SetReceiveCallback (MakeCallback (&Node::ReceiveFromDevice, this));
NotifyDeviceAdded (device);
@@ -117,6 +118,7 @@ Node::AddApplication (Ptr<Application> application)
{
uint32_t index = m_applications.size ();
m_applications.push_back (application);
application->SetNode (this);
return index;
}
Ptr<Application>

View File

@@ -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);

View File

@@ -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.));

View File

@@ -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.));

View File

@@ -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.));

View File

@@ -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.));

View File

@@ -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.));

View File

@@ -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.));

View File

@@ -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.));

View File

@@ -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.));

View File

@@ -17,13 +17,11 @@ int main (int argc, char *argv[])
Ptr<Node> node = CreateObject<InternetNode> ();
node->AggregateObject (CreateObject<MobilityModelNotifier> ());
Ptr<PointToPointNetDevice> p2p = CreateObject<PointToPointNetDevice> ("Node", node,
"Address", Mac48Address::Allocate ());
Ptr<PointToPointNetDevice> p2p = CreateObject<PointToPointNetDevice> ("Address", Mac48Address::Allocate ());
node->AddDevice (p2p);
p2p->AddQueue (CreateObject<DropTailQueue> ());
Ptr<CsmaNetDevice> csma = CreateObject<CsmaNetDevice> ("Node", node,
"Address", Mac48Address::Allocate (),
"EncapsulationMode", String ("Llc"));
Ptr<CsmaNetDevice> csma = CreateObject<CsmaNetDevice> ("Address", Mac48Address::Allocate (),
"EncapsulationMode", String ("Llc"));
node->AddDevice (csma);
csma->AddQueue (CreateObject<DropTailQueue> ());