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
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Yufei Cheng <yfcheng@ittc.ku.edu>
18
*
19
* James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
20
* ResiliNets Research Group https://resilinets.org/
21
* Information and Telecommunication Technology Center (ITTC)
22
* and Department of Electrical Engineering and Computer Science
23
* The University of Kansas Lawrence, KS USA.
24
*
25
* Work supported in part by NSF FIND (Future Internet Design) Program
26
* under grant CNS-0626918 (Postmodern Internet Architecture),
27
* NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
28
* US Department of Defense (DoD), and ITTC at The University of Kansas.
29
*/
30
31
#include "
dsr-main-helper.h
"
32
33
#include "ns3/dsr-helper.h"
34
#include "ns3/dsr-rcache.h"
35
#include "ns3/dsr-routing.h"
36
#include "ns3/dsr-rreq-table.h"
37
#include "ns3/log.h"
38
#include "ns3/names.h"
39
#include "ns3/node-list.h"
40
#include "ns3/node.h"
41
#include "ns3/ptr.h"
42
43
namespace
ns3
44
{
45
46
NS_LOG_COMPONENT_DEFINE
(
"DsrMainHelper"
);
47
48
DsrMainHelper::DsrMainHelper
()
49
: m_dsrHelper(nullptr)
50
{
51
NS_LOG_FUNCTION
(
this
);
52
}
53
54
DsrMainHelper::DsrMainHelper
(
const
DsrMainHelper
& o)
55
{
56
NS_LOG_FUNCTION
(
this
);
57
m_dsrHelper
= o.
m_dsrHelper
->
Copy
();
58
}
59
60
DsrMainHelper::~DsrMainHelper
()
61
{
62
NS_LOG_FUNCTION
(
this
);
63
delete
m_dsrHelper
;
64
}
65
66
DsrMainHelper
&
67
DsrMainHelper::operator=
(
const
DsrMainHelper
& o)
68
{
69
if
(
this
== &o)
70
{
71
return
*
this
;
72
}
73
m_dsrHelper
= o.
m_dsrHelper
->
Copy
();
74
return
*
this
;
75
}
76
77
void
78
DsrMainHelper::Install
(
DsrHelper
& dsrHelper,
NodeContainer
nodes
)
79
{
80
NS_LOG_DEBUG
(
"Passed node container"
);
81
delete
m_dsrHelper
;
82
m_dsrHelper
= dsrHelper.
Copy
();
83
for
(
NodeContainer::Iterator
i =
nodes
.Begin(); i !=
nodes
.End(); ++i)
84
{
85
Install
(*i);
86
}
87
}
88
89
void
90
DsrMainHelper::Install
(
Ptr<Node>
node)
91
{
92
NS_LOG_FUNCTION
(node);
93
Ptr<ns3::dsr::DsrRouting>
dsr =
m_dsrHelper
->
Create
(node);
94
// Ptr<ns3::dsr::RouteCache> routeCache = CreateObject<ns3::dsr::RouteCache> ();
95
// Ptr<ns3::dsr::RreqTable> rreqTable = CreateObject<ns3::dsr::RreqTable> ();
96
// dsr->SetRouteCache (routeCache);
97
// dsr->SetRequestTable (rreqTable);
98
dsr->SetNode(node);
99
// node->AggregateObject (routeCache);
100
// node->AggregateObject (rreqTable);
101
}
102
103
void
104
DsrMainHelper::SetDsrHelper
(
DsrHelper
& dsrHelper)
105
{
106
NS_LOG_FUNCTION
(
this
);
107
delete
m_dsrHelper
;
108
m_dsrHelper
= dsrHelper.
Copy
();
109
}
110
111
}
// 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:53
ns3::DsrHelper::Copy
DsrHelper * Copy() const
Definition:
dsr-helper.cc:69
ns3::DsrHelper::Create
Ptr< ns3::dsr::DsrRouting > Create(Ptr< Node > node) const
Definition:
dsr-helper.cc:76
ns3::DsrMainHelper
Helper class that adds DSR routing to nodes.
Definition:
dsr-main-helper.h:49
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:67
ns3::DsrMainHelper::m_dsrHelper
const DsrHelper * m_dsrHelper
helper class
Definition:
dsr-main-helper.h:88
ns3::DsrMainHelper::Install
void Install(DsrHelper &dsrHelper, NodeContainer nodes)
Install routing to the nodes.
Definition:
dsr-main-helper.cc:78
ns3::DsrMainHelper::SetDsrHelper
void SetDsrHelper(DsrHelper &dsrHelper)
Set the helper class.
Definition:
dsr-main-helper.cc:104
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:48
ns3::DsrMainHelper::~DsrMainHelper
~DsrMainHelper()
Definition:
dsr-main-helper.cc:60
ns3::NodeContainer
keep track of a set of node pointers.
Definition:
node-container.h:40
ns3::NodeContainer::Iterator
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Definition:
node-container.h:43
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:78
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:202
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition:
log.h:268
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:238
nodes
NodeContainer nodes
Definition:
lr-wpan-bootstrap.cc:53
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
dsr
helper
dsr-main-helper.cc
Generated on Sun Jul 2 2023 18:21:35 for ns-3 by
1.9.6