33 #include "ns3/core-module.h"
34 #include "ns3/network-module.h"
35 #include "ns3/internet-module.h"
36 #include "ns3/applications-module.h"
37 #include "ns3/csma-module.h"
38 #include "ns3/ipv4-click-routing.h"
39 #include "ns3/ipv4-l3-click-protocol.h"
40 #include "ns3/click-internet-stack-helper.h"
47 main (
int argc,
char *argv[])
61 ClickInternetStackHelper clickinternet;
62 clickinternet.SetClickFile (n.
Get (0),
"src/click/examples/nsclick-routing-node0.click");
63 clickinternet.SetClickFile (n.
Get (1),
"src/click/examples/nsclick-ip-router.click");
64 clickinternet.SetClickFile (n.
Get (2),
"src/click/examples/nsclick-routing-node2.click");
65 clickinternet.SetRoutingTableElement (n.
Get (0),
"kernel/rt");
66 clickinternet.SetRoutingTableElement (n.
Get (1),
"u/rt");
67 clickinternet.SetRoutingTableElement (n.
Get (2),
"kernel/rt");
68 clickinternet.Install (n);
86 ipv4.
SetBase (
"172.16.1.0",
"255.255.255.0");
89 ipv4.
SetBase (
"172.16.2.0",
"255.255.255.0");
106 uint32_t MaxPacketSize = 1024;
108 uint32_t maxPacketCount = 320;
111 client.SetAttribute (
"Interval",
TimeValue (interPacketInterval));
112 client.SetAttribute (
"PacketSize",
UintegerValue (MaxPacketSize));
117 csma.
EnablePcap (
"nsclick-routing", d01,
false);
118 csma.
EnablePcap (
"nsclick-routing", d12,
false);
129 NS_FATAL_ERROR (
"Can't use ns-3-click without NSCLICK compiled in");
holds a vector of ns3::Application pointers.
Simulation virtual time values and global simulation resolution.
void SetChannelAttribute(std::string n1, const AttributeValue &v1)
holds a vector of std::pair of Ptr and interface index.
static void Run(void)
Run the simulation.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttri...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Class for representing data rates.
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
AttributeValue implementation for Time.
Hold an unsigned integer type.
holds a vector of ns3::NetDevice pointers
Create a server application which waits for input UDP packets and uses the information carried into t...
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
void SetAttribute(std::string name, const AttributeValue &value)
Record an attribute to be set in each Application after it is is created.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
build a set of CsmaNetDevice objects
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
AttributeValue implementation for DataRate.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
Time Seconds(double value)
Construct a Time in the indicated unit.
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 EnablePcap(std::string prefix, Ptr< NetDevice > nd, bool promiscuous=false, bool explicitFilename=false)
Enable pcap output the indicated net device.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const