25 #include "ns3/core-module.h" 26 #include "ns3/network-module.h" 27 #include "ns3/internet-module.h" 28 #include "ns3/point-to-point-module.h" 29 #include "ns3/applications-module.h" 30 #include "ns3/traffic-control-module.h" 57 std::cout <<
"FirstBucketTokens " << oldValue <<
" to " << newValue << std::endl;
63 std::cout <<
"SecondBucketTokens " << oldValue <<
" to " << newValue << std::endl;
67 main (
int argc,
char *argv[])
70 double simulationTime = 10;
71 uint32_t burst = 10000;
77 cmd.AddValue (
"burst",
"Size of first bucket in bytes", burst);
78 cmd.AddValue (
"mtu",
"Size of second bucket in bytes", mtu);
79 cmd.AddValue (
"rate",
"Rate of tokens arriving in first bucket", rate);
80 cmd.AddValue (
"peakRate",
"Rate of tokens arriving in second bucket", peakRate);
82 cmd.Parse (argc, argv);
110 address.SetBase (
"10.1.1.0",
"255.255.255.0");
123 uint32_t payloadSize = 1448;
127 onoff.SetAttribute (
"OnTime",
StringValue (
"ns3::ConstantRandomVariable[Constant=1]"));
128 onoff.SetAttribute (
"OffTime",
StringValue (
"ns3::ConstantRandomVariable[Constant=0.2]"));
129 onoff.SetAttribute (
"PacketSize",
UintegerValue (payloadSize));
130 onoff.SetAttribute (
"DataRate",
StringValue (
"1.1Mb/s"));
136 onoff.SetAttribute (
"Remote", remoteAddress);
137 apps.
Add (onoff.Install (
nodes.Get (1)));
146 std::cout << std::endl <<
"*** TC Layer statistics ***" << std::endl;
147 std::cout << q->
GetStats () << std::endl;
holds a vector of ns3::Application pointers.
static Ipv4Address GetAny(void)
void SecondBucketTokensTrace(uint32_t oldValue, uint32_t newValue)
QueueDiscContainer Install(NetDeviceContainer c)
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Hold variables of type string.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
static void Run(void)
Run the simulation.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
Build a set of PointToPointNetDevice objects.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
a polymophic address class
Holds a vector of ns3::QueueDisc pointers.
Class for representing data rates.
Hold an unsigned integer type.
holds a vector of ns3::NetDevice pointers
void FirstBucketTokensTrace(uint32_t oldValue, uint32_t newValue)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Build a set of QueueDisc objects.
const Stats & GetStats(void)
Retrieve all the collected statistics.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
Parse command-line arguments.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
Ptr< QueueDisc > Get(std::size_t i) const
Get the Ptr<QueueDisc> stored in this container at a given index.
uint16_t SetRootQueueDisc(std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue(), std::string n09="", const AttributeValue &v09=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue(), std::string n11="", const AttributeValue &v11=EmptyAttributeValue(), std::string n12="", const AttributeValue &v12=EmptyAttributeValue(), std::string n13="", const AttributeValue &v13=EmptyAttributeValue(), std::string n14="", const AttributeValue &v14=EmptyAttributeValue(), std::string n15="", const AttributeValue &v15=EmptyAttributeValue())
Helper function used to set a root queue disc of the given type and with the given attributes...
AttributeValue implementation for Address.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
AttributeValue implementation for DataRate.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetDefault(std::string name, const AttributeValue &value)
A helper class to make life easier while doing simple IPv4 address assignment in scripts.