56 #include "ns3/core-module.h" 
   57 #include "ns3/network-module.h" 
   58 #include "ns3/internet-module.h" 
   59 #include "ns3/point-to-point-module.h" 
   60 #include "ns3/applications-module.h" 
   61 #include "ns3/internet-apps-module.h" 
   62 #include "ns3/traffic-control-module.h" 
   63 #include "ns3/flow-monitor-module.h" 
   86   uint32_t totalPackets = DynamicCast<PacketSink> (app.
Get (0))->GetTotalRx ();
 
   93   std::cout << context << 
"=" << rtt.
GetMilliSeconds () << 
" ms" << std::endl;
 
   96 int main (
int argc, 
char *argv[])
 
   98   std::string bandwidth = 
"10Mbps";
 
   99   std::string delay = 
"5ms";
 
  100   std::string queueDiscType = 
"PfifoFast";
 
  101   uint32_t queueDiscSize = 1000;
 
  102   uint32_t netdevicesQueueSize = 100;
 
  105   std::string flowsDatarate = 
"20Mbps";
 
  106   uint32_t flowsPacketsSize = 1000;
 
  109   float simDuration = 60;
 
  110   float samplingPeriod = 1;
 
  113   cmd.
AddValue (
"bandwidth", 
"Bottleneck bandwidth", bandwidth);
 
  114   cmd.
AddValue (
"delay", 
"Bottleneck delay", delay);
 
  115   cmd.
AddValue (
"queueDiscType", 
"Bottleneck queue disc type in {PfifoFast, ARED, CoDel, FqCoDel, PIE}", queueDiscType);
 
  116   cmd.
AddValue (
"queueDiscSize", 
"Bottleneck queue disc size in packets", queueDiscSize);
 
  117   cmd.
AddValue (
"netdevicesQueueSize", 
"Bottleneck netdevices queue size in packets", netdevicesQueueSize);
 
  118   cmd.
AddValue (
"bql", 
"Enable byte queue limits on bottleneck netdevices", bql);
 
  119   cmd.
AddValue (
"flowsDatarate", 
"Upload and download flows datarate", flowsDatarate);
 
  120   cmd.
AddValue (
"flowsPacketsSize", 
"Upload and download flows packets sizes", flowsPacketsSize);
 
  121   cmd.
AddValue (
"startTime", 
"Simulation start time", startTime);
 
  122   cmd.
AddValue (
"simDuration", 
"Simulation duration in seconds", simDuration);
 
  123   cmd.
AddValue (
"samplingPeriod", 
"Goodput sampling period in seconds", samplingPeriod);
 
  124   cmd.
Parse (argc, argv);
 
  126   float stopTime = startTime + simDuration;
 
  153   if (queueDiscType.compare (
"PfifoFast") == 0)
 
  158   else if (queueDiscType.compare (
"ARED") == 0)
 
  165   else if (queueDiscType.compare (
"CoDel") == 0)
 
  171   else if (queueDiscType.compare (
"FqCoDel") == 0)
 
  176       tchBottleneck.
AddPacketFilter (handle, 
"ns3::FqCoDelIpv4PacketFilter");
 
  177       tchBottleneck.
AddPacketFilter (handle, 
"ns3::FqCoDelIpv6PacketFilter");
 
  179   else if (queueDiscType.compare (
"PIE") == 0)
 
  198   tchPfifoFastAccess.
Install (devicesAccessLink);
 
  200   address.
SetBase (
"192.168.0.0", 
"255.255.255.0");
 
  208   qdiscs = tchBottleneck.
Install (devicesBottleneckLink);
 
  220       queueDiscType = queueDiscType + 
"-bql";
 
  224   Ptr<Queue<Packet> > queue = StaticCast<PointToPointNetDevice> (devicesBottleneckLink.
Get (0))->GetQueue ();
 
  229   n1Interface.
Add (interfacesAccess.
Get (0));
 
  232   n3Interface.
Add (interfacesBottleneck.
Get (1));
 
  246   uploadApp.
Add (sinkHelperUp.Install (n3));
 
  250   onOffHelperUp.SetAttribute (
"Remote", 
AddressValue (socketAddressUp));
 
  251   onOffHelperUp.SetAttribute (
"OnTime", 
StringValue (
"ns3::ConstantRandomVariable[Constant=1]"));
 
  252   onOffHelperUp.SetAttribute (
"OffTime", 
StringValue (
"ns3::ConstantRandomVariable[Constant=0]"));
 
  253   onOffHelperUp.SetAttribute (
"PacketSize", 
UintegerValue (flowsPacketsSize));
 
  254   onOffHelperUp.SetAttribute (
"DataRate", 
StringValue (flowsDatarate));
 
  255   sourceApps.
Add (onOffHelperUp.Install (n1));
 
  262   downloadApp.
Add (sinkHelperDown.Install (n1));
 
  266   onOffHelperDown.SetAttribute (
"Remote", 
AddressValue (socketAddressDown));
 
  267   onOffHelperDown.SetAttribute (
"OnTime", 
StringValue (
"ns3::ConstantRandomVariable[Constant=1]"));
 
  268   onOffHelperDown.SetAttribute (
"OffTime", 
StringValue (
"ns3::ConstantRandomVariable[Constant=0]"));
 
  269   onOffHelperDown.SetAttribute (
"PacketSize", 
UintegerValue (flowsPacketsSize));
 
  270   onOffHelperDown.SetAttribute (
"DataRate", 
StringValue (flowsDatarate));
 
  271   sourceApps.
Add (onOffHelperDown.Install (n3));
 
  289                        uploadGoodputStream, samplingPeriod);
 
  292                        downloadGoodputStream, samplingPeriod);
 
holds a vector of ns3::Application pointers. 
 
Simulation virtual time values and global simulation resolution. 
 
Manage ASCII trace files for device models. 
 
static Ipv4Address GetAny(void)
 
std::pair< Ptr< Ipv4 >, uint32_t > Get(uint32_t i) const 
Get the std::pair of an Ptr and interface stored at the location specified by the index...
 
AttributeValue implementation for Boolean. 
 
QueueDiscContainer Install(NetDeviceContainer c)
 
void BytesInQueueTrace(Ptr< OutputStreamWrapper > stream, uint32_t oldVal, uint32_t newVal)
 
Class for representing queue sizes. 
 
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message. 
 
holds a vector of std::pair of Ptr and interface index. 
 
static void PopulateRoutingTables(void)
Build a routing database and initialize the routing tables of the nodes in the simulation. 
 
Hold variables of type string. 
 
Ptr< NetDevice > Get(uint32_t i) const 
Get the Ptr stored in this container at a given index. 
 
NetDeviceContainer Install(NodeContainer c)
 
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
 
void Add(const Ipv4InterfaceContainer &other)
Concatenate the entries in the other container with ours. 
 
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument. 
 
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. 
 
ApplicationContainer Install(NodeContainer nodes) const 
Install a Ping application on each Node in the provided NodeContainer. 
 
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper. 
 
void AddPacketFilter(uint16_t handle, 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())
Helper function used to add a packet filter (of the given type and with the given attributes) to the ...
 
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. 
 
double GetSeconds(void) const 
Get an approximation of the time stored in this instance in the indicated unit. 
 
static void GoodputSampling(std::string fileName, ApplicationContainer app, Ptr< OutputStreamWrapper > stream, float period)
 
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay. 
 
static void PingRtt(std::string context, Time rtt)
 
void InstallAll(void) const 
Aggregate IPv4, IPv6, UDP, and TCP stacks to all nodes in the simulation. 
 
Hold an unsigned integer type. 
 
Use number of packets for queue size. 
 
holds a vector of ns3::NetDevice pointers 
 
AttributeValue implementation for TypeId. 
 
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
 
Build a set of QueueDisc objects. 
 
void SetQueueLimits(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())
Helper function used to add a queue limits object to the transmission queues of the devices...
 
Network device transmission queue interface. 
 
Ptr< FlowMonitor > InstallAll()
Enable flow monitoring on all nodes. 
 
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. 
 
void Connect(std::string path, const CallbackBase &cb)
 
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy(). 
 
static TypeId GetTypeId(void)
Get the type ID. 
 
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< Application > Get(uint32_t i) const 
Get the Ptr
 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...
 
Helper to enable IP flow monitoring on a set of Nodes. 
 
static Time Now(void)
Return the current simulation virtual time. 
 
void LimitsTrace(Ptr< OutputStreamWrapper > stream, uint32_t oldVal, uint32_t newVal)
 
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper. 
 
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...
 
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
 
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD. 
 
static void Stop(void)
Tell the Simulator the calling event should be the last one executed. 
 
void SerializeToXmlFile(std::string fileName, bool enableHistograms, bool enableProbes)
Same as SerializeToXmlStream, but writes to a file instead. 
 
Ptr< Node > Get(uint32_t i) const 
Get the Ptr stored in this container at a given index. 
 
Time Seconds(double value)
Construct a Time in the indicated unit. 
 
void SetDefault(std::string name, const AttributeValue &value)
 
Ipv4Address NewNetwork(void)
Increment the network number and reset the IP address counter to the base value provided in the SetBa...
 
void Parse(int argc, char *argv[])
Parse the program arguments. 
 
A helper class to make life easier while doing simple IPv4 address assignment in scripts. 
 
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer. 
 
int64_t GetMilliSeconds(void) const 
Get an approximation of the time stored in this instance in the indicated unit. 
 
Create a IPv4 ping application and associate it to a node. 
 
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper. 
 
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address. 
 
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const