From fb452286e64ab8be224994dbdf443d95ac9ba6d8 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 13 Mar 2008 11:10:38 -0700 Subject: [PATCH] add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes. --- examples/csma-broadcast.cc | 22 +++----- examples/csma-multicast.cc | 20 +++---- examples/csma-one-subnet.cc | 20 +++---- examples/csma-packet-socket.cc | 23 +++----- examples/mixed-global-routing.cc | 14 ++--- examples/simple-alternate-routing.cc | 16 ++---- examples/simple-error-model.cc | 24 +++----- examples/simple-global-routing.cc | 29 ++++------ examples/simple-point-to-point-olsr.cc | 32 ++++------- examples/simple-point-to-point.cc | 48 ++++++---------- examples/tcp-large-transfer-errors.cc | 6 +- examples/tcp-large-transfer.cc | 6 +- examples/tcp-small-transfer-oneloss.cc | 6 +- examples/tcp-small-transfer.cc | 6 +- examples/udp-echo.cc | 14 ++--- samples/main-adhoc-wifi.cc | 13 ++--- samples/main-ap-wifi.cc | 9 ++- src/devices/csma/csma-ipv4-topology.cc | 25 ++++----- src/devices/csma/csma-net-device.cc | 10 ++-- src/devices/csma/csma-net-device.h | 1 + src/devices/csma/csma-topology.cc | 5 +- .../point-to-point-net-device.cc | 10 ++-- .../point-to-point-net-device.h | 1 + .../point-to-point/point-to-point-topology.cc | 6 +- src/devices/wifi/wifi-net-device.cc | 5 ++ src/devices/wifi/wifi-net-device.h | 1 + src/internet-node/tcp-l4-protocol.cc | 5 -- src/internet-node/udp-l4-protocol.cc | 5 -- src/internet-node/udp-socket.cc | 6 +- src/node/application.cc | 10 ++-- src/node/application.h | 2 + src/node/net-device.h | 2 + src/node/node.cc | 2 + tutorial/point-to-point-ipv4-topology.cc | 3 +- tutorial/tutorial-bus-network.cc | 13 ++--- tutorial/tutorial-csma-echo-ascii-trace.cc | 14 ++--- tutorial/tutorial-csma-echo-pcap-trace.cc | 14 ++--- tutorial/tutorial-csma-echo.cc | 14 ++--- tutorial/tutorial-linear-dumbbell.cc | 56 ++++++++----------- tutorial/tutorial-point-to-point.cc | 14 ++--- tutorial/tutorial-star-routing.cc | 6 +- tutorial/tutorial-star.cc | 14 ++--- utils/print-introspected-doxygen.cc | 8 +-- 43 files changed, 232 insertions(+), 328 deletions(-) diff --git a/examples/csma-broadcast.cc b/examples/csma-broadcast.cc index 7475fe02f..575cbcdbe 100644 --- a/examples/csma-broadcast.cc +++ b/examples/csma-broadcast.cc @@ -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 ooff = - CreateObject ( - "Node", n0, - "Remote", Address (InetSocketAddress ("255.255.255.255", port)), - "Protocol", TypeId::LookupByName ("Udp"), - "OnTime", ConstantVariable(1), - "OffTime", ConstantVariable(0)); + CreateObject ("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 sink = - CreateObject ( - "Node", n1, - "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), - "Protocol", TypeId::LookupByName ("Udp")); + CreateObject ("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 ( - "Node", n2, - "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), - "Protocol", TypeId::LookupByName ("Udp")); + sink = CreateObject ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), + "Protocol", TypeId::LookupByName ("Udp")); n2->AddApplication (sink); // Start the sink diff --git a/examples/csma-multicast.cc b/examples/csma-multicast.cc index f6d3a18af..952d3a0b6 100644 --- a/examples/csma-multicast.cc +++ b/examples/csma-multicast.cc @@ -278,14 +278,12 @@ main (int argc, char *argv[]) // Configure a multicast packet generator that generates a packet // every few seconds Ptr ooff = - CreateObject ( - "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 ("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 sink = - CreateObject ( - "Node", n4, - "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), - "Protocol", TypeId::LookupByName ("Udp")); + CreateObject ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), + "Protocol", TypeId::LookupByName ("Udp")); n4->AddApplication (sink); // Start the sink sink->Start (Seconds (1.0)); diff --git a/examples/csma-one-subnet.cc b/examples/csma-one-subnet.cc index 076f1edd0..04cbe8eb7 100644 --- a/examples/csma-one-subnet.cc +++ b/examples/csma-one-subnet.cc @@ -160,12 +160,10 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = - CreateObject ( - "Node", n0, - "Remote", Address (InetSocketAddress ("10.1.1.2", port)), - "Protocol", TypeId::LookupByName ("Udp"), - "OnTime", ConstantVariable(1), - "OffTime", ConstantVariable(0)); + CreateObject ("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 ( - "Node", n3, - "Remote", Address (InetSocketAddress ("10.1.1.1", port)), - "Protocol", TypeId::LookupByName ("Udp"), - "OnTime", ConstantVariable(1), - "OffTime", ConstantVariable(0)); + ooff = CreateObject ("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)); diff --git a/examples/csma-packet-socket.cc b/examples/csma-packet-socket.cc index 82c2ddb68..534c8e007 100644 --- a/examples/csma-packet-socket.cc +++ b/examples/csma-packet-socket.cc @@ -62,8 +62,7 @@ NS_LOG_COMPONENT_DEFINE ("CsmaPacketSocketExample"); static Ptr CreateCsmaDevice (Ptr node, Ptr channel) { - Ptr device = CreateObject ("Node", node, - "Address", Mac48Address::Allocate (), + Ptr device = CreateObject ("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 ooff = - CreateObject ( - "Node", n0, - "Remote", Address (n0ToN1), - "Protocol", TypeId::LookupByName ("Packet"), - "OnTime", ConstantVariable(1), - "OffTime", ConstantVariable(0)); + CreateObject ("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 ( - "Node", n3, - "Remote", Address (n3ToN0), - "Protocol", TypeId::LookupByName ("Packet"), - "OnTime", ConstantVariable(1), - "OffTime", ConstantVariable(0)); + ooff = CreateObject ("Remote", Address (n3ToN0), + "Protocol", TypeId::LookupByName ("Packet"), + "OnTime", ConstantVariable(1), + "OffTime", ConstantVariable(0)); n3->AddApplication (ooff); // Start the application ooff->Start(Seconds(1.1)); diff --git a/examples/mixed-global-routing.cc b/examples/mixed-global-routing.cc index fa63f8ac5..fe8b2ae52 100644 --- a/examples/mixed-global-routing.cc +++ b/examples/mixed-global-routing.cc @@ -186,14 +186,12 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = - CreateObject ( - "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 ("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)); diff --git a/examples/simple-alternate-routing.cc b/examples/simple-alternate-routing.cc index f9a3a1bc3..4643fb282 100644 --- a/examples/simple-alternate-routing.cc +++ b/examples/simple-alternate-routing.cc @@ -183,12 +183,10 @@ main (int argc, char *argv[]) // Create a flow from n3 to n1, starting at time 1.1 seconds Ptr ooff = - CreateObject ( - "Node", n3, - "Remote", Address (InetSocketAddress ("10.1.1.1", port)), - "Protocol", TypeId::LookupByName ("Udp"), - "OnTime", ConstantVariable (1), - "OffTime", ConstantVariable (0)); + CreateObject ("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 sink = - CreateObject ( - "Node", n1, - "Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), - "Protocol", TypeId::LookupByName ("Udp")); + CreateObject ("Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), + "Protocol", TypeId::LookupByName ("Udp")); n1->AddApplication (sink); // Start the sink sink->Start (Seconds (1.1)); diff --git a/examples/simple-error-model.cc b/examples/simple-error-model.cc index b73b4c7a1..1c9b021dd 100644 --- a/examples/simple-error-model.cc +++ b/examples/simple-error-model.cc @@ -143,31 +143,25 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = - CreateObject ( - "Node", n0, - "Remote", Address (InetSocketAddress ("10.1.3.2", port)), - "Protocol", TypeId::LookupByName ("Udp"), - "OnTime", ConstantVariable(1), - "OffTime", ConstantVariable(0)); + CreateObject ("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 sink = CreateObject ( - "Node", n3, - "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), - "Protocol", TypeId::LookupByName ("Udp")); + Ptr sink = CreateObject ("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 ( - "Node", n3, - "Remote", Address (InetSocketAddress ("10.1.2.1", port)), + ooff = CreateObject ("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 ( - "Node", n1, - "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), + sink = CreateObject ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), "Protocol", TypeId::LookupByName ("Udp")); n1->AddApplication (sink); // Start the sink diff --git a/examples/simple-global-routing.cc b/examples/simple-global-routing.cc index 40693f41c..b2e2d4869 100644 --- a/examples/simple-global-routing.cc +++ b/examples/simple-global-routing.cc @@ -160,11 +160,10 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = - CreateObject ("Node", n0, - "Remote", Address (InetSocketAddress ("10.1.3.2", port)), - "Protocol", TypeId::LookupByName ("Udp"), - "OnTime", ConstantVariable (1), - "OffTime", ConstantVariable (0)); + CreateObject ("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 sink = - CreateObject ("Node", n3, - "Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), - "Protocol", TypeId::LookupByName ("Udp")); + CreateObject ("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 ( - "Node", n3, - "Remote", Address (InetSocketAddress ("10.1.2.1", port)), - "Protocol", TypeId::LookupByName ("Udp"), - "OnTime", ConstantVariable (1), - "OffTime", ConstantVariable (0)); + ooff = CreateObject ("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 ("Node", n1, - "Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), - "Protocol", TypeId::LookupByName ("Udp")); + sink = CreateObject ("Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), + "Protocol", TypeId::LookupByName ("Udp")); n1->AddApplication (sink); // Start the sink sink->Start (Seconds (1.1)); diff --git a/examples/simple-point-to-point-olsr.cc b/examples/simple-point-to-point-olsr.cc index 998ca406d..d2d2876c1 100644 --- a/examples/simple-point-to-point-olsr.cc +++ b/examples/simple-point-to-point-olsr.cc @@ -167,42 +167,34 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = - CreateObject ( - "Node", n0, - "Remote", Address (InetSocketAddress ("10.1.4.2", port)), - "Protocol", TypeId::LookupByName ("Udp"), - "OnTime", ConstantVariable(1), - "OffTime", ConstantVariable(0)); + CreateObject ("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 sink = - CreateObject ( - "Node", n4, - "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), - "Protocol", TypeId::LookupByName ("Udp")); + CreateObject ("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 ( - "Node", n4, - "Remote", Address (InetSocketAddress ("10.1.2.1", port)), - "Protocol", TypeId::LookupByName ("Udp"), - "OnTime", ConstantVariable(1), - "OffTime", ConstantVariable(0)); + ooff = CreateObject ("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 ( - "Node", n1, - "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), - "Protocol", TypeId::LookupByName ("Udp")); + sink = CreateObject ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), + "Protocol", TypeId::LookupByName ("Udp")); n1->AddApplication (sink); // Start the sink sink->Start (Seconds (1.1)); diff --git a/examples/simple-point-to-point.cc b/examples/simple-point-to-point.cc index 39f90ac0c..bb5d63b3a 100644 --- a/examples/simple-point-to-point.cc +++ b/examples/simple-point-to-point.cc @@ -136,42 +136,34 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Create Applications."); uint16_t port = 9; // Discard port (RFC 863) Ptr ooff = - CreateObject ( - "Node", n0, - "Remote", Address (InetSocketAddress ("10.1.3.2", port)), - "Protocol", TypeId::LookupByName ("Udp"), - "OnTime", ConstantVariable(1), - "OffTime", ConstantVariable(0)); + CreateObject ("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 sink = - CreateObject ( - "Node", n3, - "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), - "Protocol", TypeId::LookupByName ("Udp")); + CreateObject ("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 ( - "Node", n3, - "Remote", Address (InetSocketAddress ("10.1.2.1", port)), - "Protocol", TypeId::LookupByName ("Udp"), - "OnTime", ConstantVariable(1), - "OffTime", ConstantVariable(0)); + ooff = CreateObject ("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 ( - "Node", n1, - "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)), - "Protocol", TypeId::LookupByName ("Udp")); + sink = CreateObject ("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 ( - "Node", n0, - "Remote", Address (InetSocketAddress ("10.1.3.2", servPort)), - "Protocol", TypeId::LookupByName ("Tcp"), - "OnTime", ConstantVariable(1), - "OffTime", ConstantVariable(0)); + ooff = CreateObject ("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 ( - "Node", n3, - "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)), - "Protocol", TypeId::LookupByName ("Tcp")); + sink = CreateObject ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)), + "Protocol", TypeId::LookupByName ("Tcp")); n3->AddApplication (sink); sink->Start (Seconds (1.2)); diff --git a/examples/tcp-large-transfer-errors.cc b/examples/tcp-large-transfer-errors.cc index f13dd0a74..4da88b941 100644 --- a/examples/tcp-large-transfer-errors.cc +++ b/examples/tcp-large-transfer-errors.cc @@ -198,10 +198,8 @@ int main (int argc, char *argv[]) // Create a packet sink to receive these packets Ptr sink = - CreateObject ( - "Node", n2, - "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)), - "Protocol", TypeId::LookupByName ("Tcp")); + CreateObject ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)), + "Protocol", TypeId::LookupByName ("Tcp")); n2->AddApplication (sink); sink->Start (Seconds (0.0)); sink->Stop (Seconds (10000.0)); diff --git a/examples/tcp-large-transfer.cc b/examples/tcp-large-transfer.cc index 2c6f1a749..8946aa271 100644 --- a/examples/tcp-large-transfer.cc +++ b/examples/tcp-large-transfer.cc @@ -198,10 +198,8 @@ int main (int argc, char *argv[]) // Create a packet sink to receive these packets Ptr sink = - CreateObject ( - "Node", n2, - "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)), - "Protocol", TypeId::LookupByName ("Tcp")); + CreateObject ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)), + "Protocol", TypeId::LookupByName ("Tcp")); n2->AddApplication (sink); sink->Start (Seconds (0.0)); sink->Stop (Seconds (100.0)); diff --git a/examples/tcp-small-transfer-oneloss.cc b/examples/tcp-small-transfer-oneloss.cc index e21a66529..e6d3a3433 100644 --- a/examples/tcp-small-transfer-oneloss.cc +++ b/examples/tcp-small-transfer-oneloss.cc @@ -180,10 +180,8 @@ int main (int argc, char *argv[]) // Create a packet sink to receive these packets Ptr sink = - CreateObject ( - "Node", n2, - "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)), - "Protocol", TypeId::LookupByName ("Tcp")); + CreateObject ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)), + "Protocol", TypeId::LookupByName ("Tcp")); n2->AddApplication (sink); sink->Start (Seconds (0.0)); sink->Stop (Seconds (100.0)); diff --git a/examples/tcp-small-transfer.cc b/examples/tcp-small-transfer.cc index bde2a5ecf..ee10e2e1d 100644 --- a/examples/tcp-small-transfer.cc +++ b/examples/tcp-small-transfer.cc @@ -190,10 +190,8 @@ int main (int argc, char *argv[]) // Create a packet sink to receive these packets Ptr sink = - CreateObject ( - "Node", n2, - "Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)), - "Protocol", TypeId::LookupByName ("Tcp")); + CreateObject ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)), + "Protocol", TypeId::LookupByName ("Tcp")); n2->AddApplication (sink); sink->Start (Seconds (0.0)); sink->Stop (Seconds (100.0)); diff --git a/examples/udp-echo.cc b/examples/udp-echo.cc index 2700bf45b..6817928d3 100644 --- a/examples/udp-echo.cc +++ b/examples/udp-echo.cc @@ -161,8 +161,7 @@ main (int argc, char *argv[]) // uint16_t port = 9; // well-known echo port number - Ptr server = CreateObject ("Node", n1, - "Port", Uinteger (port)); + Ptr server = CreateObject ("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 client = - CreateObject ("Node", n0, - "RemoteIpv4", Ipv4Address ("10.1.1.2"), - "RemotePort", Uinteger (port), - "MaxPackets", Uinteger (maxPacketCount), - "Interval", interPacketInterval, - "PacketSize", Uinteger (packetSize)); + CreateObject ("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. diff --git a/samples/main-adhoc-wifi.cc b/samples/main-adhoc-wifi.cc index 32a23526c..d91a40b92 100644 --- a/samples/main-adhoc-wifi.cc +++ b/samples/main-adhoc-wifi.cc @@ -149,13 +149,12 @@ Experiment::Run (const WifiHelper &wifi) destination.SetSingleDevice (0); destination.SetPhysicalAddress (devices.Get (1)->GetAddress ()); Ptr app = - CreateObject ("Node", c.Get (0), - "Remote", Address (destination), - "Protocol", TypeId::LookupByName ("Packet"), - "OnTime", ConstantVariable (250), - "OffTime", ConstantVariable (0), - "DataRate", DataRate (60000000), - "PacketSize", Uinteger (2000)); + CreateObject ("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)); diff --git a/samples/main-ap-wifi.cc b/samples/main-ap-wifi.cc index 1b992389b..6cd32088f 100644 --- a/samples/main-ap-wifi.cc +++ b/samples/main-ap-wifi.cc @@ -144,11 +144,10 @@ int main (int argc, char *argv[]) destination.SetSingleDevice (0); destination.SetPhysicalAddress (staDevs.Get(1)->GetAddress ()); Ptr app = - CreateObject ("Node", stas.Get (0), - "Remote", Address (destination), - "Protocol", TypeId::LookupByName ("Packet"), - "OnTime", ConstantVariable (42), - "OffTime", ConstantVariable (0)); + CreateObject ("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)); diff --git a/src/devices/csma/csma-ipv4-topology.cc b/src/devices/csma/csma-ipv4-topology.cc index 4c0db9e9d..1138c5334 100644 --- a/src/devices/csma/csma-ipv4-topology.cc +++ b/src/devices/csma/csma-ipv4-topology.cc @@ -44,9 +44,8 @@ CsmaIpv4Topology::AddIpv4CsmaNetDevice( Ptr q = CreateObject (); // assume full-duplex - Ptr nd = CreateObject ("Node", node, - "Address", addr, - "EncapsulationMode", String ("IpArp")); + Ptr nd = CreateObject ("Address", addr, + "EncapsulationMode", String ("IpArp")); node->AddDevice (nd); nd->AddQueue(q); @@ -62,18 +61,16 @@ CsmaIpv4Topology::AddIpv4LlcCsmaNode(Ptr n1, { Ptr q = CreateObject (); - Ptr nd0 = CreateObject ("Node", n1, - "Address", addr, - "EncapsulationMode", String ("Llc")); + Ptr nd0 = CreateObject ("Address", addr, + "EncapsulationMode", String ("Llc")); n1->AddDevice (nd0); nd0->SetSendEnable (true); nd0->SetReceiveEnable (false); nd0->AddQueue(q); nd0->Attach (ch); - Ptr nd1 = CreateObject ("Node", n1, - "Address", addr, - "EncapsulationMode", String ("Llc")); + Ptr nd1 = CreateObject ("Address", addr, + "EncapsulationMode", String ("Llc")); n1->AddDevice (nd1); nd1->SetSendEnable (false); nd1->SetReceiveEnable (true); @@ -88,18 +85,16 @@ CsmaIpv4Topology::AddIpv4RawCsmaNode(Ptr n1, { Ptr q = CreateObject (); - Ptr nd0 = CreateObject ("Node", n1, - "Address", addr, - "EncapsulationMode", String ("Raw")); + Ptr nd0 = CreateObject ("Address", addr, + "EncapsulationMode", String ("Raw")); n1->AddDevice (nd0); nd0->SetSendEnable (true); nd0->SetReceiveEnable (false); nd0->AddQueue(q); nd0->Attach (ch); - Ptr nd1 = CreateObject ("Node", n1, - "Address", addr, - "EncapsulationMode", String ("Raw")); + Ptr nd1 = CreateObject ("Address", addr, + "EncapsulationMode", String ("Raw")); n1->AddDevice (nd1); nd1->SetSendEnable (false); nd1->SetReceiveEnable (true); diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index d6b9694e9..c613a90cd 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -45,11 +45,6 @@ CsmaNetDevice::GetTypeId (void) static TypeId tid = TypeId ("CsmaNetDevice") .SetParent () .AddConstructor () - .AddAttribute ("Node", "The node with which this device is associated", - TypeId::ATTR_GET | TypeId::ATTR_CONSTRUCT, - Ptr (0), - MakePtrAccessor (&CsmaNetDevice::m_node), - MakePtrChecker ()) .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) +{ + m_node = node; +} bool CsmaNetDevice::NeedsArp (void) const { diff --git a/src/devices/csma/csma-net-device.h b/src/devices/csma/csma-net-device.h index 9291fc558..b8b5f3163 100644 --- a/src/devices/csma/csma-net-device.h +++ b/src/devices/csma/csma-net-device.h @@ -222,6 +222,7 @@ enum CsmaEncapsulationMode { virtual bool IsPointToPoint (void) const; virtual bool Send(Ptr packet, const Address& dest, uint16_t protocolNumber); virtual Ptr GetNode (void) const; + virtual void SetNode (Ptr node); virtual bool NeedsArp (void) const; virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb); diff --git a/src/devices/csma/csma-topology.cc b/src/devices/csma/csma-topology.cc index 2d5547d24..c03ef68a9 100644 --- a/src/devices/csma/csma-topology.cc +++ b/src/devices/csma/csma-topology.cc @@ -48,9 +48,8 @@ CsmaTopology::AddCsmaEthernetNode( Ptr ch, Mac48Address addr) { - Ptr nd1 = CreateObject ("Node", Ptr (n1), - "Address", addr, - "EncapsulationMode", "EthernetV1"); + Ptr nd1 = CreateObject ("Address", addr, + "EncapsulationMode", "EthernetV1"); Ptr q = Queue::CreateDefault (); nd1->AddQueue(q); diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index ad9ea7c86..e8cde0956 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -42,11 +42,6 @@ PointToPointNetDevice::GetTypeId (void) static TypeId tid = TypeId ("PointToPointNetDevice") .SetParent () .AddConstructor () - .AddAttribute ("Node", "The node with which this device is associated", - TypeId::ATTR_GET | TypeId::ATTR_CONSTRUCT, - Ptr (0), - MakePtrAccessor (&PointToPointNetDevice::m_node), - MakePtrChecker ()) .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) +{ + m_node = node; +} bool PointToPointNetDevice::NeedsArp (void) const { diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index c281cd3c5..ba0160508 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -164,6 +164,7 @@ public: virtual bool IsPointToPoint (void) const; virtual bool Send(Ptr packet, const Address& dest, uint16_t protocolNumber); virtual Ptr GetNode (void) const; + virtual void SetNode (Ptr node); virtual bool NeedsArp (void) const; virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb); diff --git a/src/devices/point-to-point/point-to-point-topology.cc b/src/devices/point-to-point/point-to-point-topology.cc index 877d0789f..0b7ef622f 100644 --- a/src/devices/point-to-point/point-to-point-topology.cc +++ b/src/devices/point-to-point/point-to-point-topology.cc @@ -48,16 +48,14 @@ PointToPointTopology::AddPointToPointLink( { Ptr channel = CreateObject ("BitRate", bps, "Delay", delay); - Ptr net1 = CreateObject ("Node", n1, - "Address", Mac48Address::Allocate ()); + Ptr net1 = CreateObject ("Address", Mac48Address::Allocate ()); n1->AddDevice (net1); Ptr q = CreateObject (); net1->AddQueue(q); net1->Attach (channel); - Ptr net2 = CreateObject ("Node", n2, - "Address", Mac48Address::Allocate ()); + Ptr net2 = CreateObject ("Address", Mac48Address::Allocate ()); n2->AddDevice (net2); q = CreateObject (); diff --git a/src/devices/wifi/wifi-net-device.cc b/src/devices/wifi/wifi-net-device.cc index 7d4400fb8..a92bd5478 100644 --- a/src/devices/wifi/wifi-net-device.cc +++ b/src/devices/wifi/wifi-net-device.cc @@ -228,6 +228,11 @@ WifiNetDevice::GetNode (void) const { return m_node; } +void +WifiNetDevice::SetNode (Ptr node) +{ + m_node = node; +} bool WifiNetDevice::NeedsArp (void) const { diff --git a/src/devices/wifi/wifi-net-device.h b/src/devices/wifi/wifi-net-device.h index 850930282..f47d1a720 100644 --- a/src/devices/wifi/wifi-net-device.h +++ b/src/devices/wifi/wifi-net-device.h @@ -74,6 +74,7 @@ public: virtual bool IsPointToPoint (void) const; virtual bool Send(Ptr packet, const Address& dest, uint16_t protocolNumber); virtual Ptr GetNode (void) const; + virtual void SetNode (Ptr node); virtual bool NeedsArp (void) const; virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb); diff --git a/src/internet-node/tcp-l4-protocol.cc b/src/internet-node/tcp-l4-protocol.cc index 7c83e7eac..863281e9e 100644 --- a/src/internet-node/tcp-l4-protocol.cc +++ b/src/internet-node/tcp-l4-protocol.cc @@ -324,11 +324,6 @@ TcpL4Protocol::GetTypeId (void) { static TypeId tid = TypeId ("TcpL4Protocol") .SetParent () - .AddAttribute ("Node", "The node to which this protocol is associated", - TypeId::ATTR_GET | TypeId::ATTR_CONSTRUCT, - Ptr (0), - MakePtrAccessor (&TcpL4Protocol::m_node), - MakePtrChecker ()) .AddAttribute ("RttEstimatorFactory", "How RttEstimator objects are created.", GetDefaultRttEstimatorFactory (), diff --git a/src/internet-node/udp-l4-protocol.cc b/src/internet-node/udp-l4-protocol.cc index f3dea3517..3c0c82176 100644 --- a/src/internet-node/udp-l4-protocol.cc +++ b/src/internet-node/udp-l4-protocol.cc @@ -46,11 +46,6 @@ UdpL4Protocol::GetTypeId (void) static TypeId tid = TypeId ("UdpL4Protocol") .SetParent () .AddConstructor () - .AddAttribute ("Node", "The node which contains this protocol.", - TypeId::ATTR_GET | TypeId::ATTR_CONSTRUCT, - Ptr (0), - MakePtrAccessor (&UdpL4Protocol::m_node), - MakePtrChecker ()) ; return tid; } diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index 37cb87232..40a08b3df 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -412,7 +412,7 @@ UdpSocketTest::RunTests (void) Ptr rxNode = CreateObject (); Ptr rxDev1, rxDev2; { // first interface - rxDev1 = CreateObject ("Node", rxNode, "Address", Mac48Address::Allocate ()); + rxDev1 = CreateObject ("Address", Mac48Address::Allocate ()); rxNode->AddDevice (rxDev1); rxDev1->AddQueue(CreateObject ()); Ptr ipv4 = rxNode->GetObject (); @@ -423,7 +423,7 @@ UdpSocketTest::RunTests (void) } { // second interface - rxDev2 = CreateObject ("Node", rxNode, "Address", Mac48Address::Allocate ()); + rxDev2 = CreateObject ("Address", Mac48Address::Allocate ()); rxNode->AddDevice (rxDev2); rxDev2->AddQueue(CreateObject ()); Ptr ipv4 = rxNode->GetObject (); @@ -437,7 +437,7 @@ UdpSocketTest::RunTests (void) Ptr txNode = CreateObject (); Ptr txDev; { - txDev = CreateObject ("Node", txNode, "Address", Mac48Address::Allocate ()); + txDev = CreateObject ("Address", Mac48Address::Allocate ()); txNode->AddDevice (txDev); txDev->AddQueue(CreateObject ()); Ptr ipv4 = txNode->GetObject (); diff --git a/src/node/application.cc b/src/node/application.cc index 669e45bdb..75e4f6fd4 100644 --- a/src/node/application.cc +++ b/src/node/application.cc @@ -40,10 +40,6 @@ Application::GetTypeId (void) { static TypeId tid = TypeId ("Application") .SetParent () - .AddAttribute ("Node", "The on which this application resides", - Ptr (0), - MakePtrAccessor (&Application::m_node), - MakePtrChecker ()) ; return tid; } @@ -92,6 +88,12 @@ Ptr Application::GetNode() const return m_node; } +void +Application::SetNode (Ptr node) +{ + m_node = node; +} + // Protected methods // StartApp and StopApp will likely be overridden by application subclasses void Application::StartApplication() diff --git a/src/node/application.h b/src/node/application.h index 6ef9ee246..1f9047bb0 100644 --- a/src/node/application.h +++ b/src/node/application.h @@ -102,6 +102,8 @@ public: * \returns the Node to which this Application object is attached. */ Ptr GetNode() const; + + void SetNode (Ptr node); private: /** diff --git a/src/node/net-device.h b/src/node/net-device.h index 7df556654..e29c11750 100644 --- a/src/node/net-device.h +++ b/src/node/net-device.h @@ -221,6 +221,8 @@ public: */ virtual Ptr GetNode (void) const = 0; + virtual void SetNode (Ptr node) = 0; + /** * \returns true if ARP is needed, false otherwise. * diff --git a/src/node/node.cc b/src/node/node.cc index 4a2268883..ba5ca8d4a 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -96,6 +96,7 @@ Node::AddDevice (Ptr 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) { uint32_t index = m_applications.size (); m_applications.push_back (application); + application->SetNode (this); return index; } Ptr diff --git a/tutorial/point-to-point-ipv4-topology.cc b/tutorial/point-to-point-ipv4-topology.cc index b6a6e5c0a..8f4efd241 100644 --- a/tutorial/point-to-point-ipv4-topology.cc +++ b/tutorial/point-to-point-ipv4-topology.cc @@ -45,8 +45,7 @@ PointToPointIpv4Topology::AddNetDevice ( NS_ASSERT (channel->GetNDevices () <= 1); Ptr nd = - CreateObject ("Node", node, - "Address", Mac48Address::Allocate ()); + CreateObject ("Address", Mac48Address::Allocate ()); node->AddDevice (nd); Ptr q = CreateObject (); nd->AddQueue(q); diff --git a/tutorial/tutorial-bus-network.cc b/tutorial/tutorial-bus-network.cc index b0eae6aba..3f6859a62 100644 --- a/tutorial/tutorial-bus-network.cc +++ b/tutorial/tutorial-bus-network.cc @@ -44,17 +44,16 @@ main (int argc, char *argv[]) Ptr n0 = bus.GetNode (0); Ptr client = - CreateObject ("Node", n0, - "RemoteIpv4", Ipv4Address ("10.1.0.1"), - "RemotePort", Uinteger (port), - "MaxPackets", Uinteger (1), - "Interval", Seconds(1.), - "PacketSize", Uinteger (1024)); + CreateObject ("RemoteIpv4", Ipv4Address ("10.1.0.1"), + "RemotePort", Uinteger (port), + "MaxPackets", Uinteger (1), + "Interval", Seconds(1.), + "PacketSize", Uinteger (1024)); n0->AddApplication (client); Ptr n1 = bus.GetNode (1); Ptr server = - CreateObject ("Node", n1, "Port", Uinteger (port)); + CreateObject ("Port", Uinteger (port)); n1->AddApplication (server); server->Start(Seconds(1.)); diff --git a/tutorial/tutorial-csma-echo-ascii-trace.cc b/tutorial/tutorial-csma-echo-ascii-trace.cc index 1d60a9979..c34871dac 100644 --- a/tutorial/tutorial-csma-echo-ascii-trace.cc +++ b/tutorial/tutorial-csma-echo-ascii-trace.cc @@ -69,17 +69,15 @@ main (int argc, char *argv[]) uint16_t port = 7; Ptr client = - CreateObject ("Node", n0, - "RemoteIpv4", Ipv4Address ("10.1.1.2"), - "RemotePort", Uinteger (port), - "MaxPackets", Uinteger (1), - "Interval", Seconds(1.), - "PacketSize", Uinteger (1024)); + CreateObject ("RemoteIpv4", Ipv4Address ("10.1.1.2"), + "RemotePort", Uinteger (port), + "MaxPackets", Uinteger (1), + "Interval", Seconds(1.), + "PacketSize", Uinteger (1024)); n0->AddApplication (client); Ptr server = - CreateObject ("Node", n1, - "Port", Uinteger (port)); + CreateObject ("Port", Uinteger (port)); n1->AddApplication (server); server->Start(Seconds(1.)); diff --git a/tutorial/tutorial-csma-echo-pcap-trace.cc b/tutorial/tutorial-csma-echo-pcap-trace.cc index 09f4048e8..c54fe8de8 100644 --- a/tutorial/tutorial-csma-echo-pcap-trace.cc +++ b/tutorial/tutorial-csma-echo-pcap-trace.cc @@ -70,17 +70,15 @@ main (int argc, char *argv[]) uint16_t port = 7; Ptr client = - CreateObject ("Node", n0, - "RemoteIpv4", Ipv4Address ("10.1.1.2"), - "RemotePort", Uinteger (port), - "MaxPackets", Uinteger (1), - "Interval", Seconds(1.), - "PacketSize", Uinteger (1024)); + CreateObject ("RemoteIpv4", Ipv4Address ("10.1.1.2"), + "RemotePort", Uinteger (port), + "MaxPackets", Uinteger (1), + "Interval", Seconds(1.), + "PacketSize", Uinteger (1024)); n0->AddApplication (client); Ptr server = - CreateObject ("Node", n1, - "Port", Uinteger (port)); + CreateObject ("Port", Uinteger (port)); n1->AddApplication (server); server->Start(Seconds(1.)); diff --git a/tutorial/tutorial-csma-echo.cc b/tutorial/tutorial-csma-echo.cc index 7e0f5a1bd..d3299c6d7 100644 --- a/tutorial/tutorial-csma-echo.cc +++ b/tutorial/tutorial-csma-echo.cc @@ -68,17 +68,15 @@ main (int argc, char *argv[]) uint16_t port = 7; Ptr client = - CreateObject ("Node", n0, - "RemoteIpv4", Ipv4Address ("10.1.1.2"), - "RemotePort", Uinteger (port), - "MaxPackets", Uinteger (1), - "Interval", Seconds(1.), - "PacketSize", Uinteger (1024)); + CreateObject ("RemoteIpv4", Ipv4Address ("10.1.1.2"), + "RemotePort", Uinteger (port), + "MaxPackets", Uinteger (1), + "Interval", Seconds(1.), + "PacketSize", Uinteger (1024)); n0->AddApplication (client); Ptr server = - CreateObject ("Node", n1, - "Port", Uinteger (port)); + CreateObject ("Port", Uinteger (port)); n1->AddApplication (server); server->Start(Seconds(1.)); diff --git a/tutorial/tutorial-linear-dumbbell.cc b/tutorial/tutorial-linear-dumbbell.cc index 936592076..76b91da21 100644 --- a/tutorial/tutorial-linear-dumbbell.cc +++ b/tutorial/tutorial-linear-dumbbell.cc @@ -127,53 +127,45 @@ main (int argc, char *argv[]) uint16_t port = 7; Ptr client0 = - CreateObject ( - "Node", n0, - "RemoteIpv4", Ipv4Address ("10.1.2.1"), - "RemotePort", Uinteger (port), - "MaxPackets", Uinteger (100), - "Interval", Seconds (0.01), - "PacketSize", Uinteger (1024)); + CreateObject ("RemoteIpv4", Ipv4Address ("10.1.2.1"), + "RemotePort", Uinteger (port), + "MaxPackets", Uinteger (100), + "Interval", Seconds (0.01), + "PacketSize", Uinteger (1024)); n0->AddApplication (client0); Ptr client1 = - CreateObject ( - "Node", n1, - "RemoteIpv4", Ipv4Address ("10.1.2.2"), - "RemotePort", Uinteger (port), - "MaxPackets", Uinteger (100), - "Interval", Seconds (0.01), - "PacketSize", Uinteger (1024)); + CreateObject ("RemoteIpv4", Ipv4Address ("10.1.2.2"), + "RemotePort", Uinteger (port), + "MaxPackets", Uinteger (100), + "Interval", Seconds (0.01), + "PacketSize", Uinteger (1024)); n1->AddApplication (client1); Ptr client2 = - CreateObject ( - "Node", n2, - "RemoteIpv4", Ipv4Address ("10.1.2.3"), - "RemotePort", Uinteger (port), - "MaxPackets", Uinteger (100), - "Interval", Seconds (0.01), - "PacketSize", Uinteger (1024)); + CreateObject ("RemoteIpv4", Ipv4Address ("10.1.2.3"), + "RemotePort", Uinteger (port), + "MaxPackets", Uinteger (100), + "Interval", Seconds (0.01), + "PacketSize", Uinteger (1024)); n2->AddApplication (client2); Ptr client3 = - CreateObject ( - "Node", n3, - "RemoteIpv4", Ipv4Address ("10.1.2.4"), - "RemotePort", Uinteger (port), - "MaxPackets", Uinteger (100), - "Interval", Seconds (0.01), - "PacketSize", Uinteger (1024)); + CreateObject ("RemoteIpv4", Ipv4Address ("10.1.2.4"), + "RemotePort", Uinteger (port), + "MaxPackets", Uinteger (100), + "Interval", Seconds (0.01), + "PacketSize", Uinteger (1024)); n3->AddApplication (client3); Ptr server4 = - CreateObject ("Node", n4, "Port", Uinteger (port)); + CreateObject ("Port", Uinteger (port)); n4->AddApplication (server4); Ptr server5 = - CreateObject ("Node", n5, "Port", Uinteger (port)); + CreateObject ("Port", Uinteger (port)); n5->AddApplication (server5); Ptr server6 = - CreateObject ("Node", n6, "Port", Uinteger (port)); + CreateObject ("Port", Uinteger (port)); n6->AddApplication (server6); Ptr server7 = - CreateObject ("Node", n7, "Port", Uinteger (port)); + CreateObject ("Port", Uinteger (port)); n7->AddApplication (server7); server4->Start(Seconds(1.)); diff --git a/tutorial/tutorial-point-to-point.cc b/tutorial/tutorial-point-to-point.cc index 3d54f5968..bfe5b4c4a 100644 --- a/tutorial/tutorial-point-to-point.cc +++ b/tutorial/tutorial-point-to-point.cc @@ -61,17 +61,15 @@ main (int argc, char *argv[]) uint16_t port = 7; Ptr client = - CreateObject ("Node", n0, - "RemoteIpv4", Ipv4Address ("10.1.1.2"), - "RemotePort", Uinteger (port), - "MaxPackets", Uinteger (1), - "Interval", Seconds(1.), - "PacketSize", Uinteger (1024)); + CreateObject ("RemoteIpv4", Ipv4Address ("10.1.1.2"), + "RemotePort", Uinteger (port), + "MaxPackets", Uinteger (1), + "Interval", Seconds(1.), + "PacketSize", Uinteger (1024)); n0->AddApplication (client); Ptr server = - CreateObject ("Node", n1, - "Port", Uinteger (port)); + CreateObject ("Port", Uinteger (port)); n1->AddApplication (server); server->Start(Seconds(1.)); diff --git a/tutorial/tutorial-star-routing.cc b/tutorial/tutorial-star-routing.cc index 3bb469870..39d63a0c8 100644 --- a/tutorial/tutorial-star-routing.cc +++ b/tutorial/tutorial-star-routing.cc @@ -148,8 +148,7 @@ main (int argc, char *argv[]) uint16_t port = 7; Ptr client = - CreateObject ("Node", n4, - "RemoteIpv4", Ipv4Address ("10.1.1.2"), + CreateObject ("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 server = - CreateObject ("Node", n1, - "Port", Uinteger (port)); + CreateObject ("Port", Uinteger (port)); n1->AddApplication (server); server->Start(Seconds(1.)); diff --git a/tutorial/tutorial-star.cc b/tutorial/tutorial-star.cc index 576fdd9d2..3cc4437f0 100644 --- a/tutorial/tutorial-star.cc +++ b/tutorial/tutorial-star.cc @@ -148,17 +148,15 @@ main (int argc, char *argv[]) uint16_t port = 7; Ptr client = - CreateObject ("Node", n0, - "RemoteIpv4", Ipv4Address ("10.1.1.2"), - "RemotePort", Uinteger (port), - "MaxPackets", Uinteger (1), - "Interval", Seconds(1.), - "PacketSize", Uinteger (1024)); + CreateObject ("RemoteIpv4", Ipv4Address ("10.1.1.2"), + "RemotePort", Uinteger (port), + "MaxPackets", Uinteger (1), + "Interval", Seconds(1.), + "PacketSize", Uinteger (1024)); n0->AddApplication (client); Ptr server = - CreateObject ("Node", n1, - "Port", Uinteger (port)); + CreateObject ("Port", Uinteger (port)); n1->AddApplication (server); server->Start(Seconds(1.)); diff --git a/utils/print-introspected-doxygen.cc b/utils/print-introspected-doxygen.cc index 09f3b8d4d..9f8c267fa 100644 --- a/utils/print-introspected-doxygen.cc +++ b/utils/print-introspected-doxygen.cc @@ -17,13 +17,11 @@ int main (int argc, char *argv[]) Ptr node = CreateObject (); node->AggregateObject (CreateObject ()); - Ptr p2p = CreateObject ("Node", node, - "Address", Mac48Address::Allocate ()); + Ptr p2p = CreateObject ("Address", Mac48Address::Allocate ()); node->AddDevice (p2p); p2p->AddQueue (CreateObject ()); - Ptr csma = CreateObject ("Node", node, - "Address", Mac48Address::Allocate (), - "EncapsulationMode", String ("Llc")); + Ptr csma = CreateObject ("Address", Mac48Address::Allocate (), + "EncapsulationMode", String ("Llc")); node->AddDevice (csma); csma->AddQueue (CreateObject ());