23 #include "ns3/core-module.h" 24 #include "ns3/network-module.h" 25 #include "ns3/point-to-point-module.h" 26 #include "ns3/applications-module.h" 28 #include "ns3/ipv6-static-routing-helper.h" 29 #include "ns3/ipv6-routing-table-entry.h" 30 #include "ns3/internet-module.h" 31 #include "ns3/tcp-header.h" 32 #include "ns3/traffic-control-module.h" 43 std::string
dir =
"MixTraffic/";
52 std::ofstream fPlotQueue (
dir + queue_disc_type +
"/queueTraces/queue.plotme", std::ios::out | std::ios::app);
66 for (uint8_t i = 0; i < 5; i++)
78 std::string queue_disc = std::string (
"ns3::") + queue_disc_type;
80 std::string bottleneckBandwidth =
"10Mbps";
81 std::string bottleneckDelay =
"50ms";
83 std::string accessBandwidth =
"10Mbps";
84 std::string accessDelay =
"5ms";
127 for (uint8_t i = 0; i < 5; i++)
134 devices_sink = accessLink.
Install (gateway.
Get (1),
sink.Get (0));
135 tchPfifo.
Install (devices_sink);
142 devices_gateway = bottleneckLink.
Install (gateway.
Get (0), gateway.
Get (1));
147 address.SetBase (
"10.0.0.0",
"255.255.255.0");
156 for (uint8_t i = 0; i < 5; i++)
162 for (uint8_t i = 0; i < 2; i++)
164 udpdevices [i] = accessLink.
Install (udpSender.
Get (i), gateway.
Get (0));
166 udpinterfaces [i] =
address.Assign (udpdevices [i]);
170 interfaces_gateway =
address.Assign (devices_gateway);
173 interfaces_sink =
address.Assign (devices_sink);
177 uint16_t
port = 50000;
178 uint16_t port1 = 50001;
232 std::string dirToSave =
"mkdir -p " +
dir + queue_disc_type;
233 if (system ((dirToSave +
"/cwndTraces/").c_str ()) == -1
234 || system ((dirToSave +
"/queueTraces/").c_str ()) == -1)
246 int main (
int argc,
char **argv)
248 std::cout <<
"Simulation with COBALT QueueDisc: Start\n" << std::flush;
250 std::cout <<
"Simulation with COBALT QueueDisc: End\n" << std::flush;
251 std::cout <<
"------------------------------------------------\n";
252 std::cout <<
"Simulation with CoDel QueueDisc: Start\n";
254 std::cout <<
"Simulation with CoDel QueueDisc: End\n";
void InstallAll(void) const
Aggregate IPv4, IPv6, UDP, and TCP stacks to all nodes in the simulation.
static TypeId GetTypeId(void)
Get the type ID.
holds a vector of ns3::Application pointers.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Manage ASCII trace files for device models.
static Ipv4Address GetAny(void)
AttributeValue implementation for Boolean.
QueueDiscContainer Install(NetDeviceContainer c)
Class for representing queue sizes.
A helper to make it easier to instantiate an ns3::BulkSendApplication on a set of nodes...
holds a vector of std::pair of Ptr<Ipv4> 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.
uint32_t GetValue() const
Get the underlying value.
NetDeviceContainer Install(NodeContainer c)
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
QueueSize GetCurrentSize(void)
Get the current size of the queue disc in bytes, if operating in bytes mode, or packets, otherwise.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
static void Run(void)
Run the simulation.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
aggregate IP/TCP/UDP functionality to existing Nodes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::BulkSendApplication on each node of the input container configured with all the attri...
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits. ...
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
static void TraceCwnd(std::string queue_disc_type)
a polymophic address class
Holds a vector of ns3::QueueDisc pointers.
void CheckQueueSize(Ptr< QueueDisc > queue, std::string queue_disc_type)
Class for representing data rates.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
AttributeValue implementation for Time.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Hold an unsigned integer type.
holds a vector of ns3::NetDevice pointers
AttributeValue implementation for TypeId.
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Build a set of QueueDisc objects.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
static TypeId GetTypeId(void)
Get the type ID.
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...
static Time Now(void)
Return the current simulation virtual time.
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...
void experiment(std::string queue_disc_type)
void AddInternalQueues(uint16_t handle, uint16_t count, 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 the given number of internal queues (of the given type and with the given...
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)
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
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.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes, not the socket attributes...
static void CwndTrace(Ptr< OutputStreamWrapper > stream, uint32_t oldCwnd, uint32_t newCwnd)
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.