A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
nsclick-defines.cc
Go to the documentation of this file.
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation;
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14 *
15 * Authors: Sascha Jopen <jopen@cs.uni-bonn.de>
16 */
17
18#include "ns3/click-internet-stack-helper.h"
19#include "ns3/core-module.h"
20#include "ns3/ipv4-click-routing.h"
21
22#include <map>
23
24using namespace ns3;
25
26NS_LOG_COMPONENT_DEFINE("NsclickRouting");
27
28int
29main(int argc, char* argv[])
30{
31 std::string clickConfigFolder = "src/click/examples";
32
33 CommandLine cmd(__FILE__);
34 cmd.AddValue("clickConfigFolder",
35 "Base folder for click configuration files",
36 clickConfigFolder);
37 cmd.Parse(argc, argv);
38
39 //
40 // Explicitly create the nodes required by the topology (shown above).
41 //
42 NS_LOG_INFO("Create a node.");
44 n.Create(1);
45
46 //
47 // Install Click on the nodes
48 //
49 std::map<std::string, std::string> defines;
50 // Strings, especially with blanks in it, have to be enclosed in quotation
51 // marks, like in click configuration files.
52 defines["OUTPUT"] = "\"Hello World!\"";
53
55 clickinternet.SetClickFile(n, clickConfigFolder + "/nsclick-defines.click");
56 clickinternet.SetRoutingTableElement(n, "rt");
57 clickinternet.SetDefines(n, defines);
58 clickinternet.Install(n);
59
60 //
61 // Now, do the actual simulation.
62 //
63 NS_LOG_INFO("Run Simulation.");
67 NS_LOG_INFO("Done.");
68
69 return 0;
70}
aggregate Click/IP/TCP/UDP functionality to existing Nodes.
Parse command-line arguments.
Definition: command-line.h:232
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:142
static void Run()
Run the simulation.
Definition: simulator.cc:178
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:186
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1319
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns cmd
Definition: second.py:40