13#include "ns3/boolean.h"
14#include "ns3/config.h"
15#include "ns3/data-rate.h"
16#include "ns3/double.h"
17#include "ns3/inet-socket-address.h"
18#include "ns3/internet-stack-helper.h"
19#include "ns3/ipv4-address-helper.h"
20#include "ns3/ipv4-l3-protocol.h"
21#include "ns3/ipv4-list-routing-helper.h"
22#include "ns3/ipv4-static-routing-helper.h"
23#include "ns3/ipv4-static-routing.h"
27#include "ns3/on-off-helper.h"
28#include "ns3/packet-sink-helper.h"
29#include "ns3/packet-sink.h"
30#include "ns3/random-variable-stream.h"
31#include "ns3/simple-channel.h"
32#include "ns3/simple-net-device-helper.h"
33#include "ns3/simple-net-device.h"
34#include "ns3/simulator.h"
35#include "ns3/socket.h"
36#include "ns3/string.h"
38#include "ns3/trace-helper.h"
39#include "ns3/traffic-control-layer.h"
40#include "ns3/udp-socket-factory.h"
41#include "ns3/udp-socket.h"
42#include "ns3/uinteger.h"
66 const std::string
targetAddr =
"239.192.100.1";
122 auto ipv4 = node->GetObject<
Ipv4>();
143 Names::Find<SimpleNetDevice>(
"D/dev"));
144 simplechannel->BlackList(Names::Find<SimpleNetDevice>(
"D/dev"),
145 Names::Find<SimpleNetDevice>(
"A/dev"));
147 simplechannel->BlackList(Names::Find<SimpleNetDevice>(
"A/dev"),
148 Names::Find<SimpleNetDevice>(
"E/dev"));
149 simplechannel->BlackList(Names::Find<SimpleNetDevice>(
"E/dev"),
150 Names::Find<SimpleNetDevice>(
"A/dev"));
152 simplechannel->BlackList(Names::Find<SimpleNetDevice>(
"B/dev"),
153 Names::Find<SimpleNetDevice>(
"E/dev"));
154 simplechannel->BlackList(Names::Find<SimpleNetDevice>(
"E/dev"),
155 Names::Find<SimpleNetDevice>(
"B/dev"));
157 simplechannel->BlackList(Names::Find<SimpleNetDevice>(
"C/dev"),
158 Names::Find<SimpleNetDevice>(
"E/dev"));
159 simplechannel->BlackList(Names::Find<SimpleNetDevice>(
"E/dev"),
160 Names::Find<SimpleNetDevice>(
"C/dev"));
183 internet.EnablePcapIpv4(
"smf-trace", (*iter)->GetId(), 1,
false);
189 std::cout <<
"Node A sent " << 10 * 1024 <<
" bytes" << std::endl;
192 auto node = (*iter)->GetNode();
195 <<
" bytes" << std::endl;
AttributeValue implementation for Boolean.
Class for representing data rates.
AttributeValue implementation for DataRate.
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
static Ipv4Address GetAny()
Access to the IPv4 forwarding table, interfaces, and configuration.
Helper class that adds ns3::Ipv4ListRouting objects.
Helper class that adds ns3::Ipv4StaticRouting objects.
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr<Object> obj.
static void Clear()
Clear the list of objects associated with names.
static std::string FindName(Ptr< Object > object)
Given a pointer to an object, look to see if that object has a name associated with it and,...
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
Receive and consume traffic generated to an IP address and port.
uint64_t GetTotalRx() const
Smart pointer class similar to boost::intrusive_ptr.
A simple channel, for simple things and testing.
virtual void BlackList(Ptr< SimpleNetDevice > from, Ptr< SimpleNetDevice > to)
Blocks the communications from a NetDevice to another NetDevice.
build a set of SimpleNetDevice objects
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
AttributeValue implementation for Time.
Hold an unsigned integer type.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
void SetDefault(std::string name, const AttributeValue &value)
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< PacketSink > sink
Pointer to the packet sink application.