|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
35 #include "ns3/core-module.h"
36 #include "ns3/network-module.h"
37 #include "ns3/csma-module.h"
38 #include "ns3/applications-module.h"
53 main (
int argc,
char *argv[])
60 cmd.Parse (argc, argv);
62 g_os.open (
"csma-packet-socket-sink.tr",std::ios_base::binary | std::ios_base::out);
91 onoff.SetConstantRate (
DataRate (
"500kb/s"));
100 apps = onoff.Install (
nodes.Get (3));
holds a vector of ns3::NetDevice pointers
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
AttributeValue implementation for DataRate.
Parse command-line arguments.
@ LOG_LEVEL_INFO
LOG_INFO and above.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
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.
AttributeValue implementation for Address.
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
an address for a packet socket
build a set of CsmaNetDevice objects
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Class for representing data rates.
a polymophic address class
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
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.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
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.
Hold variables of type string.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
Manage ASCII trace files for device models.
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.
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.
AttributeValue implementation for Time.
keep track of a set of node pointers.
void SetProtocol(uint16_t protocol)
Set the protocol.
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
static void SinkRx(std::string path, Ptr< const Packet > p, const Address &address)