|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
21 #include "ns3/command-line.h"
22 #include "ns3/config.h"
23 #include "ns3/boolean.h"
24 #include "ns3/string.h"
25 #include "ns3/yans-wifi-helper.h"
27 #include "ns3/mobility-helper.h"
28 #include "ns3/on-off-helper.h"
29 #include "ns3/yans-wifi-channel.h"
30 #include "ns3/mobility-model.h"
31 #include "ns3/packet-socket-helper.h"
32 #include "ns3/packet-socket-address.h"
33 #include "ns3/athstats-helper.h"
44 std::cout <<
" TX p: " << *p << std::endl;
52 std::cout <<
" RX p: " << *p << std::endl;
60 std::cout <<
"PHYRXOK mode=" << mode <<
" snr=" << snr <<
" " << *packet << std::endl;
68 std::cout <<
"PHYRXERROR snr=" << snr <<
" " << *packet << std::endl;
76 std::cout <<
"PHYTX mode=" << mode <<
" " << *packet << std::endl;
84 std::cout <<
" state=" << state <<
" start=" <<
start <<
" duration=" << duration << std::endl;
116 int main (
int argc,
char *argv[])
119 cmd.AddValue (
"verbose",
"Print trace information if true",
g_verbose);
120 cmd.Parse (argc, argv);
143 wifi.SetRemoteStationManager (
"ns3::ArfWifiManager");
145 wifiMac.
SetType (
"ns3::StaWifiMac",
148 staDevs =
wifi.Install (wifiPhy, wifiMac, stas);
150 wifiMac.
SetType (
"ns3::ApWifiMac",
152 wifi.Install (wifiPhy, wifiMac, ap);
166 onoff.SetConstantRate (
DataRate (
"500kb/s"));
holds a vector of ns3::NetDevice pointers
static Vector GetPosition(Ptr< Node > node)
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.
Parse command-line arguments.
void EnableAthstats(std::string filename, uint32_t nodeid, uint32_t deviceid)
Enable athstats.
AttributeValue implementation for Boolean.
static void SetPosition(Ptr< Node > node, Vector position)
virtual Address GetAddress(void) const =0
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.
void PhyRxErrorTrace(std::string context, Ptr< const Packet > packet, double snr)
helps to create WifiNetDevice objects
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
static void EnablePrinting(void)
Enable printing packets metadata.
an address for a packet socket
void DevRxTrace(std::string context, Ptr< const Packet > p)
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
void SetChannel(Ptr< YansWifiChannel > channel)
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
AttributeValue implementation for Ssid.
The IEEE 802.11 SSID Information Element.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Class for representing data rates.
void PhyStateTrace(std::string context, Time start, Time duration, WifiPhyState state)
Ptr< YansWifiChannel > Create(void) const
represent a single transmission mode
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
a polymophic address class
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Simulation virtual time values and global simulation resolution.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Give ns3::PacketSocket powers to ns3::Node.
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.
WifiPhyState
The state of the PHY layer.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
void PhyTxTrace(std::string context, Ptr< const Packet > packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
void Connect(std::string path, const CallbackBase &cb)
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.
void DevTxTrace(std::string context, Ptr< const Packet > p)
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
holds a vector of ns3::Application pointers.
void SetPhysicalAddress(const Address address)
Set the destination address.
Keep track of the current position and velocity of an object.
keep track of a set of node pointers.
void SetType(std::string type, Args &&... args)
void SetProtocol(uint16_t protocol)
Set the protocol.
static void AdvancePosition(Ptr< Node > node)
manage and create wifi channel objects for the YANS model.
create MAC layers for a ns3::WifiNetDevice.
create AthstatsWifiTraceSink instances and connect them to wifi devices
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
virtual uint32_t GetIfIndex(void) const =0
void PhyRxOkTrace(std::string context, Ptr< const Packet > packet, double snr, WifiMode mode, WifiPreamble preamble)
Helper class used to assign positions and mobility models to nodes.