|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
22 #include "ns3/simulator.h"
23 #include "ns3/socket-factory.h"
24 #include "ns3/udp-socket-factory.h"
25 #include "ns3/mobility-helper.h"
26 #include "ns3/double.h"
27 #include "ns3/uinteger.h"
28 #include "ns3/string.h"
29 #include "ns3/boolean.h"
30 #include "ns3/yans-wifi-helper.h"
31 #include "ns3/internet-stack-helper.h"
32 #include "ns3/ipv4-address-helper.h"
33 #include "ns3/abort.h"
34 #include "ns3/udp-echo-helper.h"
35 #include "ns3/mobility-model.h"
36 #include "ns3/pcap-file.h"
37 #include "ns3/aodv-helper.h"
38 #include "ns3/v4ping.h"
39 #include "ns3/config.h"
40 #include "ns3/constant-position-mobility-model.h"
41 #include "ns3/names.h"
83 :
TestCase (
"UDP Echo 127.0.0.1 test"),
109 socket->
SendTo (receivedPacket, 0, to);
116 socket->
SendTo (Create<Packet> (123), 0, realTo);
129 nodes.Get (0)->AggregateObject (m);
132 wifiMac.
SetType (
"ns3::AdhocWifiMac");
137 wifi.SetRemoteStationManager (
"ns3::ConstantRateWifiManager",
"DataMode",
StringValue (
"OfdmRate6Mbps"),
"RtsCtsThreshold",
StringValue (
"2200"));
146 address.SetBase (
"10.1.1.0",
"255.255.255.0");
holds a vector of ns3::NetDevice pointers
void SetDataDir(std::string directory)
Set the data directory where reference trace files can be found.
static YansWifiChannelHelper Default(void)
Create a channel helper in a default working state.
Make it easy to create and manage PHY objects for the YANS model.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
API to create UDP socket instances.
AODV Loopback test suite.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
static void ScheduleWithContext(uint32_t context, Time const &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
@ SYSTEM
This test suite implements a System Test.
Ptr< Socket > m_rxSocket
receive socket;
AODV loopback UDP echo test case.
uint32_t GetId(void) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Helper class that adds AODV routing to nodes.
helps to create WifiNetDevice objects
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void DoRun()
Implementation to actually run this TestCase.
virtual Ptr< Node > GetNode(void) const =0
Return the node this socket is associated with.
void SetPosition(const Vector &position)
Ipv4 addresses are stored in host order in this class.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
void SetChannel(Ptr< YansWifiChannel > channel)
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
uint32_t m_count
number of packet received;
void SetRecvCallback(Callback< void, Ptr< Socket > > receivedData)
Notify application when new data is available to be read.
Ptr< YansWifiChannel > Create(void) const
void ReceivePkt(Ptr< Socket > socket)
Receive packet function.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Ptr< Socket > m_echoSocket
echo socket;
a polymophic address class
Ptr< Socket > m_txSocket
transmit socket;
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)=0
Read a single packet from the socket and retrieve the sender address.
Ipv4Address GetIpv4(void) const
holds a vector of std::pair of Ptr<Ipv4> and interface index.
void SendData(Ptr< Socket > socket)
Send data function.
virtual int Close(void)=0
Close a socket.
ns3::aodv::AodvLoopbackTestSuite g_aodvLoopbackTestSuite
the test suite
static Ipv4Address GetLoopback(void)
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...
static void Run(void)
Run the simulation.
Hold variables of type string.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetRoutingHelper(const Ipv4RoutingHelper &routing)
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
keep track of a set of node pointers.
void RemoveAllPacketTags(void)
Remove all packet tags.
void SetType(std::string type, Args &&... args)
uint16_t m_echoReplyPort
echo reply port;
manage and create wifi channel objects for the YANS model.
create MAC layers for a ns3::WifiNetDevice.
void RemoveAllByteTags(void)
Remove all byte tags stored in this packet.
void EchoData(Ptr< Socket > socket)
Echo data function.
aggregate IP/TCP/UDP functionality to existing Nodes.
uint16_t m_echoSendPort
echo send port;
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.