From 4b72ece7ae94e4b555fa8d8686cbfbabbd6f93f3 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 4 Mar 2011 15:40:46 -0800 Subject: [PATCH] Remove device dependency from applications --- .../test/udp-client-server-test.cc | 36 ++++++++++++------- src/applications/wscript | 2 +- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/applications/test/udp-client-server-test.cc b/src/applications/test/udp-client-server-test.cc index 8bb6cde48..a04f4e9bb 100644 --- a/src/applications/test/udp-client-server-test.cc +++ b/src/applications/test/udp-client-server-test.cc @@ -26,11 +26,11 @@ #include "ns3/string.h" #include "ns3/uinteger.h" #include "ns3/inet-socket-address.h" -#include "ns3/point-to-point-helper.h" #include "ns3/internet-stack-helper.h" #include "ns3/ipv4-address-helper.h" #include "ns3/udp-client-server-helper.h" -#include "ns3/csma-helper.h" +#include "ns3/simple-net-device.h" +#include "ns3/simple-channel.h" #include "ns3/test.h" #include "ns3/simulator.h" @@ -69,11 +69,17 @@ void UdpClientServerTestCase::DoRun (void) InternetStackHelper internet; internet.Install (n); - CsmaHelper csma; - csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(5000000))); - csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); - csma.SetDeviceAttribute ("Mtu", UintegerValue (1400)); - NetDeviceContainer d = csma.Install (n); + // link the two nodes + Ptr txDev = CreateObject (); + Ptr rxDev = CreateObject (); + n.Get (0)->AddDevice (txDev); + n.Get (1)->AddDevice (rxDev); + Ptr channel1 = CreateObject (); + rxDev->SetChannel (channel1); + txDev->SetChannel (channel1); + NetDeviceContainer d; + d.Add (txDev); + d.Add (rxDev); Ipv4AddressHelper ipv4; @@ -137,11 +143,17 @@ void UdpTraceClientServerTestCase::DoRun (void) InternetStackHelper internet; internet.Install (n); - CsmaHelper csma; - csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(5000000))); - csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); - csma.SetDeviceAttribute ("Mtu", UintegerValue (1400)); - NetDeviceContainer d = csma.Install (n); + // link the two nodes + Ptr txDev = CreateObject (); + Ptr rxDev = CreateObject (); + n.Get (0)->AddDevice (txDev); + n.Get (1)->AddDevice (rxDev); + Ptr channel1 = CreateObject (); + rxDev->SetChannel (channel1); + txDev->SetChannel (channel1); + NetDeviceContainer d; + d.Add (txDev); + d.Add (rxDev); Ipv4AddressHelper ipv4; ipv4.SetBase ("10.1.1.0", "255.255.255.0"); diff --git a/src/applications/wscript b/src/applications/wscript index 30c7cbf87..2a71a160c 100644 --- a/src/applications/wscript +++ b/src/applications/wscript @@ -1,7 +1,7 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- def build(bld): - module = bld.create_ns3_module('applications', ['internet']) + module = bld.create_ns3_module('applications', ['internet', 'contrib']) module.source = [ 'model/bulk-send-application.cc', 'model/onoff-application.cc',