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" 
   47main (
int argc, 
char *argv[])
 
   50  std::string clickConfigFolder = 
"src/click/examples";
 
   53  cmd.AddValue (
"clickConfigFolder", 
"Base folder for click configuration files", clickConfigFolder);
 
   54  cmd.Parse (argc, argv);
 
   66  ClickInternetStackHelper clickinternet;
 
   67  clickinternet.SetClickFile (n.
Get (0), clickConfigFolder + 
"/nsclick-routing-node0.click");
 
   68  clickinternet.SetClickFile (n.
Get (1), clickConfigFolder + 
"/nsclick-ip-router.click");
 
   69  clickinternet.SetClickFile (n.
Get (2), clickConfigFolder + 
"/nsclick-routing-node2.click");
 
   70  clickinternet.SetRoutingTableElement (n.
Get (0), 
"kernel/rt");
 
   71  clickinternet.SetRoutingTableElement (n.
Get (1), 
"u/rt");
 
   72  clickinternet.SetRoutingTableElement (n.
Get (2), 
"kernel/rt");
 
   73  clickinternet.Install (n);
 
   91  ipv4.
SetBase (
"172.16.1.0", 
"255.255.255.0");
 
   94  ipv4.
SetBase (
"172.16.2.0", 
"255.255.255.0");
 
  101  uint16_t 
port = 4000;
 
  115  client.SetAttribute (
"MaxPackets", 
UintegerValue (maxPacketCount));
 
  116  client.SetAttribute (
"Interval", 
TimeValue (interPacketInterval));
 
  117  client.SetAttribute (
"PacketSize", 
UintegerValue (MaxPacketSize));
 
  122  csma.EnablePcap (
"nsclick-routing", d01, 
false);
 
  123  csma.EnablePcap (
"nsclick-routing", d12, 
false);
 
  129  Simulator::Stop (
Seconds (20.0));
 
  131  Simulator::Destroy ();
 
  134  NS_FATAL_ERROR (
"Can't use ns-3-click without NSCLICK compiled in");
 
holds a vector of ns3::Application pointers.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
Parse command-line arguments.
build a set of CsmaNetDevice objects
Class for representing data rates.
AttributeValue implementation for DataRate.
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.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
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.
AttributeValue implementation for Time.
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
Create a server application which waits for input UDP packets and uses the information carried into t...
Hold an unsigned integer type.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
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.