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);
186 devices = pointToPoint.
Install (nodes);
190 devices.
Get (1)->SetAttribute (
"ReceiveErrorModel",
PointerValue (em));
196 address.
SetBase (
"10.1.1.0",
"255.255.255.252");
199 uint16_t sinkPort = 8080;
206 Ptr<Socket> ns3TcpSocket = Socket::CreateSocket (nodes.
Get (0), TcpSocketFactory::GetTypeId ());
210 app->
Setup (ns3TcpSocket, sinkAddress, 1040, 1000,
DataRate (
"1Mbps"));
217 Simulator::Stop (
Seconds (20));
219 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)
void SetStopTime(Time stop)
Specify application stop time.
keep track of time values and allow control of global simulation resolution
holds a vector of std::pair of Ptr<Ipv4> and interface index.
hold variables of type string
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
NetDeviceContainer Install(NodeContainer c)
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
bool IsRunning(void) const
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
a polymophic address class
Class for representing data rates.
static void RxDrop(Ptr< const Packet > p)
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
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
keep track of a set of node pointers.
hold objects of type Ptr<T>
uint64_t GetBitRate() const
void Install(std::string nodeName) const
#define NS_LOG_UNCOND(msg)
virtual void StopApplication(void)
Application specific shutdown code.
virtual void StartApplication(void)
Application specific startup code.
void SetChannelAttribute(std::string name, const AttributeValue &value)
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...
NS_LOG_COMPONENT_DEFINE("PacketLossCounter")
int main(int argc, char *argv[])
an identifier for simulation events.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
ApplicationContainer Install(NodeContainer c) const
static void CwndChange(uint32_t oldCwnd, uint32_t newCwnd)
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.
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 an floating point type.
void SetAttribute(std::string name, const AttributeValue &value)
void SetStartTime(Time start)
Specify application start time.
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