18 #include "ns3/core-module.h"
19 #include "ns3/network-module.h"
20 #include "ns3/internet-module.h"
21 #include "ns3/point-to-point-module.h"
22 #include "ns3/applications-module.h"
23 #include "ns3/stats-module.h"
72 virtual void StartApplication (
void);
73 virtual void StopApplication (
void);
75 void ScheduleTx (
void);
80 uint32_t m_packetSize;
85 uint32_t m_packetsSent;
120 if (InetSocketAddress::IsMatchingType (
m_peer))
190 cmd.
AddValue (
"useIpv6",
"Use Ipv6", useV6);
191 cmd.
Parse (argc, argv);
201 devices = pointToPoint.
Install (nodes);
205 devices.
Get (1)->SetAttribute (
"ReceiveErrorModel",
PointerValue (em));
210 uint16_t sinkPort = 8080;
213 std::string probeName;
214 std::string probeTrace;
218 address.
SetBase (
"10.1.1.0",
"255.255.255.0");
222 probeName =
"ns3::Ipv4PacketProbe";
223 probeTrace =
"/NodeList/*/$ns3::Ipv4L3Protocol/Tx";
232 probeName =
"ns3::Ipv6PacketProbe";
233 probeTrace =
"/NodeList/*/$ns3::Ipv6L3Protocol/Tx";
241 Ptr<Socket> ns3TcpSocket = Socket::CreateSocket (nodes.
Get (0), TcpSocketFactory::GetTypeId ());
244 app->Setup (ns3TcpSocket, sinkAddress, 1040, 1000,
DataRate (
"1Mbps"));
246 app->SetStartTime (
Seconds (1.));
247 app->SetStopTime (
Seconds (20.));
264 "Packet Byte Count vs. Time",
266 "Packet Byte Count");
276 GnuplotAggregator::KEY_BELOW);
283 FileAggregator::FORMATTED);
286 fileHelper.
Set2dFormat (
"Time (Seconds) = %.3e\tPacket Byte Count = %.0f");
294 Simulator::Stop (
Seconds (20));
296 Simulator::Destroy ();
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
holds a vector of ns3::Application pointers.
uint32_t AddApplication(Ptr< Application > application)
static void SendPacket(Ptr< Socket > socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval)
keep track of time values and allow control of global simulation resolution
Manage ASCII trace files for device models.
Ptr< PcapFileWrapper > CreateFile(std::string filename, std::ios::openmode filemode, uint32_t dataLinkType, uint32_t snapLen=65535, int32_t tzCorrection=0)
Create and initialize a pcap file.
Keep track of a set of IPv6 interfaces.
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
holds a vector of std::pair of Ptr and interface index.
virtual int Bind6()=0
Allocate a local IPv6 endpoint for this socket.
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 PlotProbe(const std::string &typeId, const std::string &path, const std::string &probeTraceSource, const std::string &title, enum GnuplotAggregator::KeyLocation keyLocation=GnuplotAggregator::KEY_INSIDE)
Manage pcap files for device models.
void Write(Time t, Ptr< const Packet > p)
Write the next packet to file.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Build bound Callbacks which take varying numbers of arguments, and potentially returning a value...
aggregate IP/TCP/UDP functionality to existing Nodes.
void SetBase(Ipv6Address network, Ipv6Prefix prefix, Ipv6Address base=Ipv6Address("::1"))
Set the base network number, network prefix, and base interface ID.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
bool IsRunning(void) const
This method is syntactic sugar for the ns3::Simulator::isExpired method.
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 polymophic address class
Ipv6InterfaceContainer Assign(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer with auto-assigned addresses.
static void CwndChange(Ptr< OutputStreamWrapper > stream, uint32_t oldCwnd, uint32_t newCwnd)
Class for representing data rates.
void ConfigurePlot(const std::string &outputFileNameWithoutExtension, const std::string &title, const std::string &xLegend, const std::string &yLegend, const std::string &terminalType="png")
double GetSeconds(void) const
void Setup(Ptr< Socket > socket, Address address, uint32_t packetSize, uint32_t nPackets, DataRate dataRate)
The base class for all ns3 applications.
holds a vector of ns3::NetDevice pointers
Helper class used to put data values into a file.
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.
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Helper class used to make gnuplot plots.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
keep track of a set of node pointers.
uint64_t GetBitRate() const
Get the underlying bitrate.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
#define NS_LOG_UNCOND(msg)
void ConfigureFile(const std::string &outputFileNameWithoutExtension, enum FileAggregator::FileType fileType=FileAggregator::SPACE_SEPARATED)
virtual void StopApplication(void)
Application specific shutdown code.
virtual void StartApplication(void)
Application specific startup code.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
Helper class to auto-assign global IPv6 unicast addresses.
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...
an identifier for simulation events.
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
Describes an IPv6 prefix.
void WriteProbe(const std::string &typeId, const std::string &path, const std::string &probeTraceSource)
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
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.
int main(int argc, char *argv[])
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
virtual int Close(void)=0
Close a socket.
Hold a floating point type.
void SetAttribute(std::string name, const AttributeValue &value)
static void RxDrop(Ptr< PcapFileWrapper > file, Ptr< const Packet > p)
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
Ipv6Address GetAddress(uint32_t i, uint32_t j) const
Get the address for the specified index.
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
void Set2dFormat(const std::string &format)
Sets the 2D format string for the C-style sprintf() function.