18#include "ns3/applications-module.h"
19#include "ns3/core-module.h"
20#include "ns3/internet-module.h"
21#include "ns3/network-module.h"
22#include "ns3/point-to-point-module.h"
23#include "ns3/stats-module.h"
98main(
int argc,
char* argv[])
103 cmd.AddValue(
"useIpv6",
"Use Ipv6", useV6);
104 cmd.Parse(argc, argv);
117 em->SetAttribute(
"ErrorRate",
DoubleValue(0.00001));
123 uint16_t sinkPort = 8080;
126 std::string probeType;
127 std::string tracePath;
131 address.SetBase(
"10.1.1.0",
"255.255.255.0");
135 probeType =
"ns3::Ipv4PacketProbe";
136 tracePath =
"/NodeList/*/$ns3::Ipv4L3Protocol/Tx";
145 probeType =
"ns3::Ipv6PacketProbe";
146 tracePath =
"/NodeList/*/$ns3::Ipv6L3Protocol/Tx";
157 app->Setup(ns3TcpSocket, sinkAddress, 1040, 1000,
DataRate(
"1Mbps"));
159 app->SetStartTime(
Seconds(1.));
160 app->SetStopTime(
Seconds(20.));
164 ns3TcpSocket->TraceConnectWithoutContext(
"CongestionWindow",
179 "Packet Byte Count vs. Time",
181 "Packet Byte Count");
200 fileHelper.
Set2dFormat(
"Time (Seconds) = %.3e\tPacket Byte Count = %.0f");
204 fileHelper.
WriteProbe(probeType, tracePath,
"OutputBytes");
a polymophic address class
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.
Manage ASCII trace files for device models.
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.
Parse command-line arguments.
Class for representing data rates.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Helper class used to put data values into a file.
void Set2dFormat(const std::string &format)
Sets the 2D format string for the C-style sprintf() function.
void WriteProbe(const std::string &typeId, const std::string &path, const std::string &probeTraceSource)
void ConfigureFile(const std::string &outputFileNameWithoutExtension, enum FileAggregator::FileType fileType=FileAggregator::SPACE_SEPARATED)
Helper class used to make gnuplot plots.
void ConfigurePlot(const std::string &outputFileNameWithoutExtension, const std::string &title, const std::string &xLegend, const std::string &yLegend, const std::string &terminalType="png")
void PlotProbe(const std::string &typeId, const std::string &path, const std::string &probeTraceSource, const std::string &title, enum GnuplotAggregator::KeyLocation keyLocation=GnuplotAggregator::KEY_INSIDE)
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
static Ipv4Address GetAny()
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Helper class to auto-assign global IPv6 unicast addresses.
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
Keep track of a set of IPv6 interfaces.
Describes an IPv6 prefix.
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.
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
Manage pcap files for device models.
Ptr< PcapFileWrapper > CreateFile(std::string filename, std::ios::openmode filemode, DataLinkType dataLinkType, uint32_t snapLen=std::numeric_limits< uint32_t >::max(), int32_t tzCorrection=0)
Create and initialize a pcap file.
Build a set of PointToPointNetDevice objects.
Hold objects of type Ptr<T>.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
Hold variables of type string.
static TypeId GetTypeId()
Get the type ID.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionally.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static void CwndChange(Ptr< OutputStreamWrapper > stream, uint32_t oldCwnd, uint32_t newCwnd)
Congestion window change callback.
static void RxDrop(Ptr< PcapFileWrapper > file, Ptr< const Packet > p)
Rx drop callback.