A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
nsclick-defines.cc
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-2.0-only
3 *
4 * Authors: Sascha Jopen <jopen@cs.uni-bonn.de>
5 */
6
7#include "ns3/click-internet-stack-helper.h"
8#include "ns3/core-module.h"
9#include "ns3/ipv4-click-routing.h"
10
11#include <map>
12
13using namespace ns3;
14
15NS_LOG_COMPONENT_DEFINE("NsclickRouting");
16
17int
18main(int argc, char* argv[])
19{
20 std::string clickConfigFolder = "src/click/examples";
21
22 CommandLine cmd(__FILE__);
23 cmd.AddValue("clickConfigFolder",
24 "Base folder for click configuration files",
25 clickConfigFolder);
26 cmd.Parse(argc, argv);
27
28 //
29 // Explicitly create the nodes required by the topology (shown above).
30 //
31 NS_LOG_INFO("Create a node.");
33 n.Create(1);
34
35 //
36 // Install Click on the nodes
37 //
38 std::map<std::string, std::string> defines;
39 // Strings, especially with blanks in it, have to be enclosed in quotation
40 // marks, like in click configuration files.
41 defines["OUTPUT"] = "\"Hello World!\"";
42
44 clickinternet.SetClickFile(n, clickConfigFolder + "/nsclick-defines.click");
45 clickinternet.SetRoutingTableElement(n, "rt");
46 clickinternet.SetDefines(n, defines);
47 clickinternet.Install(n);
48
49 //
50 // Now, do the actual simulation.
51 //
52 NS_LOG_INFO("Run Simulation.");
56 NS_LOG_INFO("Done.");
57
58 return 0;
59}
aggregate Click/IP/TCP/UDP functionality to existing Nodes.
Parse command-line arguments.
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.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static void Run()
Run the simulation.
Definition simulator.cc:167
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:175
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:264
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
Every class exported by the ns3 library is enclosed in the ns3 namespace.