--- a/examples/simple-p2p.cc Mon May 14 12:32:59 2007 +0200
+++ b/examples/simple-p2p.cc Mon May 14 12:33:17 2007 +0200
@@ -92,7 +92,8 @@
// instantiate, when the queue factory is invoked in the topology code
Bind ("Queue", "DropTailQueue");
- Bind ("on-off-app-packet-size", "210");
+ Bind ("OnOffApplicationPacketSize", "210");
+ Bind ("OnOffApplicationDataRate", "448kb/s");
//Bind ("DropTailQueue::m_maxPackets", 30);
--- a/src/applications/onoff-application.cc Mon May 14 12:32:59 2007 +0200
+++ b/src/applications/onoff-application.cc Mon May 14 12:33:17 2007 +0200
@@ -38,11 +38,12 @@
namespace ns3 {
// Defaults for rate/size
-DataRate OnOffApplication::g_defaultRate = DataRate(500000);
-static IntegerDefaultValue<uint32_t> g_defaultSize ("on-off-app-packet-size",
- "The size of packets send by OnOffApplication instances",
+static DataRateDefaultValue g_defaultRate ("OnOffApplicationDataRate",
+ "The data rate in on state for OnOffApplication",
+ DataRate ("500kb/s"));
+static IntegerDefaultValue<uint32_t> g_defaultSize ("OnOffApplicationPacketSize",
+ "The size of packets sent in on state for OnOffApplication",
512, 1);
-
// Constructors
OnOffApplication::OnOffApplication(Ptr<INode> n,
@@ -51,7 +52,7 @@
const RandomVariable& ontime,
const RandomVariable& offtime)
: Application(n),
- m_cbrRate (g_defaultRate)
+ m_cbrRate (g_defaultRate.GetValue ())
{
Construct (n, rip, rport, ontime, offtime,
g_defaultSize.GetValue ());
@@ -101,6 +102,11 @@
m_maxBytes = maxBytes;
}
+void
+OnOffApplication::SetDefaultRate (const DataRate &rate)
+{
+ g_defaultRate.SetValue (rate);
+}
void
OnOffApplication::SetDefaultSize (uint32_t size)
{
--- a/src/applications/onoff-application.h Mon May 14 12:32:59 2007 +0200
+++ b/src/applications/onoff-application.h Mon May 14 12:33:17 2007 +0200
@@ -81,7 +81,7 @@
void SetMaxBytes(uint32_t maxBytes);
- static void DefaultRate(uint64_t r) { g_defaultRate = r;}
+ static void SetDefaultRate(const DataRate & r);
static void SetDefaultSize (uint32_t size);
@@ -121,9 +121,6 @@
EventId m_sendEvent; // Eventid of pending "send packet" event
bool m_sending; // True if currently in sending state
-public:
- static DataRate g_defaultRate; // Default sending rate when on
-
private:
void ScheduleNextTx();
void ScheduleStartEvent();