24#include "ns3/applications-module.h"
25#include "ns3/core-module.h"
26#include "ns3/internet-module.h"
27#include "ns3/network-module.h"
28#include "ns3/point-to-point-module.h"
29#include "ns3/traffic-control-module.h"
56 std::cout <<
"FirstBucketTokens " << oldValue <<
" to " << newValue << std::endl;
62 std::cout <<
"SecondBucketTokens " << oldValue <<
" to " << newValue << std::endl;
66main(
int argc,
char* argv[])
68 double simulationTime = 10;
75 cmd.AddValue(
"burst",
"Size of first bucket in bytes", burst);
76 cmd.AddValue(
"mtu",
"Size of second bucket in bytes", mtu);
77 cmd.AddValue(
"rate",
"Rate of tokens arriving in first bucket", rate);
78 cmd.AddValue(
"peakRate",
"Rate of tokens arriving in second bucket", peakRate);
80 cmd.Parse(argc, argv);
112 address.SetBase(
"10.1.1.0",
"255.255.255.0");
128 OnOffHelper onoff(
"ns3::TcpSocketFactory", Ipv4Address::GetAny());
129 onoff.SetAttribute(
"OnTime",
StringValue(
"ns3::ConstantRandomVariable[Constant=1]"));
130 onoff.SetAttribute(
"OffTime",
StringValue(
"ns3::ConstantRandomVariable[Constant=0.2]"));
131 onoff.SetAttribute(
"PacketSize",
UintegerValue(payloadSize));
132 onoff.SetAttribute(
"DataRate",
StringValue(
"1.1Mb/s"));
138 onoff.SetAttribute(
"Remote", remoteAddress);
143 Simulator::Stop(
Seconds(simulationTime + 5));
146 Simulator::Destroy();
148 std::cout << std::endl <<
"*** TC Layer statistics ***" << std::endl;
149 std::cout << q->
GetStats() << std::endl;
a polymophic address class
AttributeValue implementation for Address.
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
Parse command-line arguments.
Class for representing data rates.
AttributeValue implementation for DataRate.
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
Build a set of PointToPointNetDevice objects.
Holds a vector of ns3::QueueDisc pointers.
Ptr< QueueDisc > Get(std::size_t i) const
Get the Ptr<QueueDisc> stored in this container at a given index.
const Stats & GetStats()
Retrieve all the collected statistics.
Hold variables of type string.
Build a set of QueueDisc objects.
QueueDiscContainer Install(NetDeviceContainer c)
uint16_t SetRootQueueDisc(const std::string &type, Args &&... args)
Helper function used to set a root queue disc of the given type and with the given attributes.
Hold an unsigned integer type.
void SetDefault(std::string name, const AttributeValue &value)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
void SecondBucketTokensTrace(uint32_t oldValue, uint32_t newValue)
void FirstBucketTokensTrace(uint32_t oldValue, uint32_t newValue)