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