A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
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
13
using namespace
ns3
;
14
15
NS_LOG_COMPONENT_DEFINE
(
"NsclickRouting"
);
16
17
int
18
main(
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."
);
32
NodeContainer
n;
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
43
ClickInternetStackHelper
clickinternet
;
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."
);
53
Simulator::Stop
(
Seconds
(20.0));
54
Simulator::Run
();
55
Simulator::Destroy
();
56
NS_LOG_INFO
(
"Done."
);
57
58
return
0;
59
}
ns3::ClickInternetStackHelper
aggregate Click/IP/TCP/UDP functionality to existing Nodes.
Definition
click-internet-stack-helper.h:38
ns3::CommandLine
Parse command-line arguments.
Definition
command-line.h:221
ns3::NodeContainer
keep track of a set of node pointers.
Definition
node-container.h:29
ns3::NodeContainer::Create
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Definition
node-container.cc:73
ns3::Simulator::Destroy
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition
simulator.cc:131
ns3::Simulator::Run
static void Run()
Run the simulation.
Definition
simulator.cc:167
ns3::Simulator::Stop
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition
simulator.cc:175
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition
log.h:264
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition
nstime.h:1308
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
nsclick-simple-lan.clickConfigFolder
clickConfigFolder
Definition
nsclick-simple-lan.py:22
nsclick-simple-lan.clickinternet
clickinternet
Definition
nsclick-simple-lan.py:38
second.cmd
cmd
Definition
second.py:29
src
click
examples
nsclick-defines.cc
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0