A Discrete-Event Network Simulator
API
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 "dsr-helper.h"
34 
35 #include "ns3/dsr-rcache.h"
36 #include "ns3/dsr-routing.h"
37 #include "ns3/dsr-rreq-table.h"
38 #include "ns3/log.h"
39 #include "ns3/names.h"
40 #include "ns3/node-list.h"
41 #include "ns3/node.h"
42 #include "ns3/ptr.h"
43 
44 namespace ns3
45 {
46 
47 NS_LOG_COMPONENT_DEFINE("DsrMainHelper");
48 
50  : m_dsrHelper(nullptr)
51 {
52  NS_LOG_FUNCTION(this);
53 }
54 
56 {
57  NS_LOG_FUNCTION(this);
59 }
60 
62 {
63  NS_LOG_FUNCTION(this);
64  delete m_dsrHelper;
65 }
66 
69 {
70  if (this == &o)
71  {
72  return *this;
73  }
75  return *this;
76 }
77 
78 void
80 {
81  NS_LOG_DEBUG("Passed node container");
82  delete m_dsrHelper;
83  m_dsrHelper = dsrHelper.Copy();
84  for (auto i = nodes.Begin(); i != nodes.End(); ++i)
85  {
86  Install(*i);
87  }
88 }
89 
90 void
92 {
93  NS_LOG_FUNCTION(node);
95  // Ptr<ns3::dsr::RouteCache> routeCache = CreateObject<ns3::dsr::RouteCache> ();
96  // Ptr<ns3::dsr::RreqTable> rreqTable = CreateObject<ns3::dsr::RreqTable> ();
97  // dsr->SetRouteCache (routeCache);
98  // dsr->SetRequestTable (rreqTable);
99  dsr->SetNode(node);
100  // node->AggregateObject (routeCache);
101  // node->AggregateObject (rreqTable);
102 }
103 
104 void
106 {
107  NS_LOG_FUNCTION(this);
108  delete m_dsrHelper;
109  m_dsrHelper = dsrHelper.Copy();
110 }
111 
112 } // namespace ns3
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
DsrHelper * Copy() const
Definition: dsr-helper.cc:69
Ptr< ns3::dsr::DsrRouting > Create(Ptr< Node > node) const
Definition: dsr-helper.cc:76
Helper class that adds DSR routing to nodes.
DsrMainHelper & operator=(const DsrMainHelper &o)
Assignment operator declared private and not implemented to disallow assignment and prevent the compi...
const DsrHelper * m_dsrHelper
helper class
void Install(DsrHelper &dsrHelper, NodeContainer nodes)
Install routing to the nodes.
void SetDsrHelper(DsrHelper &dsrHelper)
Set the helper class.
DsrMainHelper()
Create an DsrMainHelper that makes life easier for people who want to install DSR routing to nodes.
keep track of a set of node pointers.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
NodeContainer nodes
Every class exported by the ns3 library is enclosed in the ns3 namespace.