32 #include "ns3/core-module.h"
33 #include "ns3/propagation-module.h"
34 #include "ns3/network-module.h"
35 #include "ns3/applications-module.h"
36 #include "ns3/mobility-module.h"
37 #include "ns3/internet-module.h"
38 #include "ns3/flow-monitor-module.h"
39 #include "ns3/wifi-module.h"
55 for (
size_t i = 0; i < 3; ++i)
80 wifiMac.
SetType (
"ns3::AdhocWifiMac");
95 ipv4.
SetBase (
"10.0.0.0",
"255.0.0.0");
100 uint16_t cbrPort = 12345;
102 onOffHelper.
SetAttribute (
"PacketSize", UintegerValue (1400));
125 uint16_t echoPort = 9;
127 echoClientHelper.
SetAttribute (
"MaxPackets", UintegerValue (1));
129 echoClientHelper.
SetAttribute (
"PacketSize", UintegerValue (10));
152 std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->
GetFlowStats ();
153 for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin (); i != stats.end (); ++i)
165 std::cout <<
" Tx Packets: " << i->second.txPackets <<
"\n";
166 std::cout <<
" Tx Bytes: " << i->second.txBytes <<
"\n";
167 std::cout <<
" TxOffered: " << i->second.txBytes * 8.0 / 9.0 / 1000 / 1000 <<
" Mbps\n";
168 std::cout <<
" Rx Packets: " << i->second.rxPackets <<
"\n";
169 std::cout <<
" Rx Bytes: " << i->second.rxBytes <<
"\n";
170 std::cout <<
" Throughput: " << i->second.rxBytes * 8.0 / 9.0 / 1000 / 1000 <<
" Mbps\n";
178 int main (
int argc,
char **argv)
180 std::cout <<
"Hidden station experiment with RTS/CTS disabled:\n" << std::flush;
182 std::cout <<
"------------------------------------------------\n";
183 std::cout <<
"Hidden station experiment with RTS/CTS enabled:\n";
holds a vector of ns3::Application pointers.
void experiment(bool enableCtsRts)
Run single 10 seconds experiment with enabled or disabled RTS/CTS mechanism.
smart pointer class similar to boost::intrusive_ptr
void SetDefaultLoss(double)
Set default loss (in dB, positive) to be used, infinity if not set.
int main(int argc, char **argv)
void SetRemoteStationManager(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
hold variables of type string
Make it easy to create and manage PHY objects for the yans model.
void CheckForLostPackets()
Check right now for packets that appear to be lost.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
Ipv4Address destinationAddress
Destination address.
virtual void SetType(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
void SetPropagationLossModel(Ptr< PropagationLossModel > loss)
Create an application which sends a UDP packet and waits for an echo of this packet.
void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
static void Run(void)
Run the simulation until one of:
aggregate IP/TCP/UDP functionality to existing Nodes.
static YansWifiPhyHelper Default(void)
Create a phy helper in a default working state.
helps to create WifiNetDevice objects
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
std::map< FlowId, FlowStats > GetFlowStats() const
Retrieve all collected the flow statistics.
Keep track of the current position and velocity of an object.
void SetChannel(Ptr< YansWifiChannel > channel)
hold objects of type ns3::Time
FiveTuple FindFlow(FlowId flowId) const
Searches for the FiveTuple corresponding to the given flowId.
Hold an unsigned integer type.
holds a vector of ns3::NetDevice pointers
virtual void SetStandard(enum WifiPhyStandard standard)
static NqosWifiMacHelper Default(void)
Create a mac helper in a default working state.
Ptr< FlowMonitor > InstallAll()
Enable flow monitoring on all nodes.
void AggregateObject(Ptr< Object > other)
create non QoS-enabled MAC layers for a ns3::WifiNetDevice.
static void Destroy(void)
Every event scheduled by the Simulator::insertAtDestroy method is invoked.
Ptr< FlowClassifier > GetClassifier()
Retrieve the FlowClassifier object created by the Install* methods.
void SetDefault(std::string name, const AttributeValue &value)
keep track of a set of node pointers.
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18)
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Helper to enable IPv4 flow monitoring on a set of Nodes.
Structure to classify a packet.
Ipv4 addresses are stored in host order in this class.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
static void Stop(void)
If an event invokes this method, it will be the last event scheduled by the Simulator::run method bef...
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
void SetLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b, double loss, bool symmetric=true)
Set loss (in dB, positive) between pair of ns-3 objects (typically, nodes).
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.
void SetAttribute(std::string name, const AttributeValue &value)
Record an attribute to be set in each Application after it is is created.
Ptr< T > GetObject(void) const
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
Ipv4Address sourceAddress
Source address.
ApplicationContainer Install(Ptr< Node > node) const
Create a udp echo client application on the specified node.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.