|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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"
72 virtual void StartApplication (
void);
73 virtual void StopApplication (
void);
75 void ScheduleTx (
void);
176 main (
int argc,
char *argv[])
179 cmd.Parse (argc, argv);
199 address.SetBase (
"10.1.1.0",
"255.255.255.252");
202 uint16_t sinkPort = 8080;
209 Ptr<Socket> ns3TcpSocket = Socket::CreateSocket (
nodes.Get (0), TcpSocketFactory::GetTypeId ());
213 app->
Setup (ns3TcpSocket, sinkAddress, 1040, 1000,
DataRate (
"1Mbps"));
214 nodes.Get (0)->AddApplication (app);
220 Simulator::Stop (
Seconds (20));
222 Simulator::Destroy ();
static void CwndChange(uint32_t oldCwnd, uint32_t newCwnd)
holds a vector of ns3::NetDevice pointers
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Parse command-line arguments.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
An identifier for simulation events.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Hold objects of type Ptr<T>.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
virtual void StopApplication(void)
Application specific shutdown code.
void SetStopTime(Time stop)
Specify application stop time.
Class for representing data rates.
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
void SetStartTime(Time start)
Specify application start time.
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
a polymophic address class
holds a vector of std::pair of Ptr<Ipv4> and interface index.
void SendPacket(Ptr< NetDevice > sourceDevice, Address &destination)
This example (inspired from tv-trans-example) enables to generate the transmitted spectra of Wi-Fi st...
Simulation virtual time values and global simulation resolution.
virtual int Close(void)=0
Close a socket.
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionally.
uint64_t GetBitRate() const
Get the underlying bitrate.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Hold variables of type string.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
void Setup(Ptr< Socket > socket, Address address, uint32_t packetSize, uint32_t nPackets, DataRate dataRate)
static const uint32_t packetSize
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
Time Seconds(double value)
Construct a Time in the indicated unit.
holds a vector of ns3::Application pointers.
Build a set of PointToPointNetDevice objects.
keep track of a set of node pointers.
virtual void StartApplication(void)
Application specific startup code.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
static void RxDrop(Ptr< const Packet > p)
The base class for all ns3 applications.
aggregate IP/TCP/UDP functionality to existing Nodes.