A Discrete-Event Network Simulator
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
33namespace ns3
34{
35
36NS_LOG_COMPONENT_DEFINE("DsrMainHelper");
37
39 : m_dsrHelper(nullptr)
40{
41 NS_LOG_FUNCTION(this);
42}
43
49
55
58{
59 if (this == &o)
60 {
61 return *this;
62 }
64 return *this;
65}
66
67void
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
79void
81{
82 NS_LOG_FUNCTION(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
93void
95{
96 NS_LOG_FUNCTION(this);
97 delete m_dsrHelper;
98 m_dsrHelper = dsrHelper.Copy();
99}
100
101} // 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:42
DsrHelper * Copy() const
Definition dsr-helper.cc:58
Ptr< ns3::dsr::DsrRouting > Create(Ptr< Node > node) const
Definition dsr-helper.cc:65
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.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#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.