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
dsr-main-helper.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 Yufei Cheng
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Yufei Cheng <yfcheng@ittc.ku.edu>
7
*
8
* James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
9
* ResiliNets Research Group https://resilinets.org/
10
* Information and Telecommunication Technology Center (ITTC)
11
* and Department of Electrical Engineering and Computer Science
12
* The University of Kansas Lawrence, KS USA.
13
*
14
* Work supported in part by NSF FIND (Future Internet Design) Program
15
* under grant CNS-0626918 (Postmodern Internet Architecture),
16
* NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
17
* US Department of Defense (DoD), and ITTC at The University of Kansas.
18
*/
19
20
#include "
dsr-main-helper.h
"
21
22
#include "
dsr-helper.h
"
23
24
#include "ns3/dsr-rcache.h"
25
#include "ns3/dsr-routing.h"
26
#include "ns3/dsr-rreq-table.h"
27
#include "ns3/log.h"
28
#include "ns3/names.h"
29
#include "ns3/node-list.h"
30
#include "ns3/node.h"
31
#include "ns3/ptr.h"
32
33
namespace
ns3
34
{
35
36
NS_LOG_COMPONENT_DEFINE
(
"DsrMainHelper"
);
37
38
DsrMainHelper::DsrMainHelper
()
39
: m_dsrHelper(nullptr)
40
{
41
NS_LOG_FUNCTION
(
this
);
42
}
43
44
DsrMainHelper::DsrMainHelper
(
const
DsrMainHelper
& o)
45
{
46
NS_LOG_FUNCTION
(
this
);
47
m_dsrHelper
= o.
m_dsrHelper
->
Copy
();
48
}
49
50
DsrMainHelper::~DsrMainHelper
()
51
{
52
NS_LOG_FUNCTION
(
this
);
53
delete
m_dsrHelper
;
54
}
55
56
DsrMainHelper
&
57
DsrMainHelper::operator=
(
const
DsrMainHelper
& o)
58
{
59
if
(
this
== &o)
60
{
61
return
*
this
;
62
}
63
m_dsrHelper
= o.
m_dsrHelper
->
Copy
();
64
return
*
this
;
65
}
66
67
void
68
DsrMainHelper::Install
(
DsrHelper
& dsrHelper,
NodeContainer
nodes
)
69
{
70
NS_LOG_DEBUG
(
"Passed node container"
);
71
delete
m_dsrHelper
;
72
m_dsrHelper
= dsrHelper.
Copy
();
73
for
(
auto
i =
nodes
.Begin(); i !=
nodes
.End(); ++i)
74
{
75
Install
(*i);
76
}
77
}
78
79
void
80
DsrMainHelper::Install
(
Ptr<Node>
node)
81
{
82
NS_LOG_FUNCTION
(node);
83
Ptr<ns3::dsr::DsrRouting>
dsr =
m_dsrHelper
->
Create
(node);
84
// Ptr<ns3::dsr::RouteCache> routeCache = CreateObject<ns3::dsr::RouteCache> ();
85
// Ptr<ns3::dsr::RreqTable> rreqTable = CreateObject<ns3::dsr::RreqTable> ();
86
// dsr->SetRouteCache (routeCache);
87
// dsr->SetRequestTable (rreqTable);
88
dsr->SetNode(node);
89
// node->AggregateObject (routeCache);
90
// node->AggregateObject (rreqTable);
91
}
92
93
void
94
DsrMainHelper::SetDsrHelper
(
DsrHelper
& dsrHelper)
95
{
96
NS_LOG_FUNCTION
(
this
);
97
delete
m_dsrHelper
;
98
m_dsrHelper
= dsrHelper.
Copy
();
99
}
100
101
}
// namespace ns3
ns3::DsrHelper
DSR helper class to manage creation of DSR routing instance and to insert it on a node as a sublayer ...
Definition
dsr-helper.h:42
ns3::DsrHelper::Copy
DsrHelper * Copy() const
Definition
dsr-helper.cc:58
ns3::DsrHelper::Create
Ptr< ns3::dsr::DsrRouting > Create(Ptr< Node > node) const
Definition
dsr-helper.cc:65
ns3::DsrMainHelper
Helper class that adds DSR routing to nodes.
Definition
dsr-main-helper.h:39
ns3::DsrMainHelper::operator=
DsrMainHelper & operator=(const DsrMainHelper &o)
Assignment operator declared private and not implemented to disallow assignment and prevent the compi...
Definition
dsr-main-helper.cc:57
ns3::DsrMainHelper::m_dsrHelper
const DsrHelper * m_dsrHelper
helper class
Definition
dsr-main-helper.h:78
ns3::DsrMainHelper::Install
void Install(DsrHelper &dsrHelper, NodeContainer nodes)
Install routing to the nodes.
Definition
dsr-main-helper.cc:68
ns3::DsrMainHelper::SetDsrHelper
void SetDsrHelper(DsrHelper &dsrHelper)
Set the helper class.
Definition
dsr-main-helper.cc:94
ns3::DsrMainHelper::DsrMainHelper
DsrMainHelper()
Create an DsrMainHelper that makes life easier for people who want to install DSR routing to nodes.
Definition
dsr-main-helper.cc:38
ns3::DsrMainHelper::~DsrMainHelper
~DsrMainHelper()
Definition
dsr-main-helper.cc:50
ns3::NodeContainer
keep track of a set of node pointers.
Definition
node-container.h:29
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
dsr-helper.h
dsr-main-helper.h
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition
log.h:257
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition
log-macros-enabled.h:229
nodes
NodeContainer nodes
Definition
lr-wpan-bootstrap.cc:43
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
dsr
helper
dsr-main-helper.cc
Generated on Fri Nov 8 2024 13:59:00 for ns-3 by
1.11.0