A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ripng-helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014 Universita' di Firenze, Italy
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: Tommaso Pecorella <tommaso.pecorella@unifi.it>
18 */
19
20#ifndef RIPNG_HELPER_H
21#define RIPNG_HELPER_H
22
23#include "ipv6-routing-helper.h"
24
25#include "ns3/node-container.h"
26#include "ns3/node.h"
27#include "ns3/object-factory.h"
28
29#include <map>
30
31namespace ns3
32{
33
34/**
35 * \ingroup ipv6Helpers
36 *
37 * \brief Helper class that adds RIPng routing to nodes.
38 *
39 * This class is expected to be used in conjunction with
40 * ns3::InternetStackHelper::SetRoutingHelper
41 *
42 */
44{
45 public:
46 /*
47 * Construct an RipNgHelper to make life easier while adding RIPng
48 * routing to nodes.
49 */
51
52 /**
53 * \brief Construct an RipNgHelper from another previously
54 * initialized instance (Copy Constructor).
55 * \param o The object to copy from.
56 */
57 RipNgHelper(const RipNgHelper& o);
58
59 ~RipNgHelper() override;
60
61 // Delete assignment operator to avoid misuse
63
64 /**
65 * \returns pointer to clone of this RipNgHelper
66 *
67 * This method is mainly for internal use by the other helpers;
68 * clients are expected to free the dynamic memory allocated by this method
69 */
70 RipNgHelper* Copy() const override;
71
72 /**
73 * \param node the node on which the routing protocol will run
74 * \returns a newly-created routing protocol
75 *
76 * This method will be called by ns3::InternetStackHelper::Install
77 */
78 Ptr<Ipv6RoutingProtocol> Create(Ptr<Node> node) const override;
79
80 /**
81 * \param name the name of the attribute to set
82 * \param value the value of the attribute to set.
83 *
84 * This method controls the attributes of ns3::RipNg
85 */
86 void Set(std::string name, const AttributeValue& value);
87
88 /**
89 * Assign a fixed random variable stream number to the random variables
90 * used by this model. Return the number of streams (possibly zero) that
91 * have been assigned. The Install() method should have previously been
92 * called by the user.
93 *
94 * \param c NetDeviceContainer of the set of net devices for which the
95 * SixLowPanNetDevice should be modified to use a fixed stream
96 * \param stream first stream index to use
97 * \return the number of stream indices assigned by this helper
98 */
99 int64_t AssignStreams(NodeContainer c, int64_t stream);
100
101 /**
102 * \brief Install a default route in the node.
103 *
104 * The traffic will be routed to the nextHop, located on the specified
105 * interface, unless a more specific route is found.
106 *
107 * \param node the node
108 * \param nextHop the next hop
109 * \param interface the network interface
110 */
111 void SetDefaultRouter(Ptr<Node> node, Ipv6Address nextHop, uint32_t interface);
112
113 /**
114 * \brief Exclude an interface from RIPng protocol.
115 *
116 * You have to call this function \a before installing RIPng in the nodes.
117 *
118 * Note: the exclusion means that RIPng will not be propagated on that interface.
119 * The network prefix on that interface will be still considered in RIPng.
120 *
121 * \param node the node
122 * \param interface the network interface to be excluded
123 */
124 void ExcludeInterface(Ptr<Node> node, uint32_t interface);
125
126 /**
127 * \brief Set a metric for an interface.
128 *
129 * You have to call this function \a before installing RIPng in the nodes.
130 *
131 * Note: RIPng will apply the metric on route message reception.
132 * As a consequence, interface metric should be set on the receiver.
133 *
134 * \param node the node
135 * \param interface the network interface
136 * \param metric the interface metric
137 */
138 void SetInterfaceMetric(Ptr<Node> node, uint32_t interface, uint8_t metric);
139
140 private:
141 ObjectFactory m_factory; //!< Object Factory
142
143 std::map<Ptr<Node>, std::set<uint32_t>> m_interfaceExclusions; //!< Interface Exclusion set
144 std::map<Ptr<Node>, std::map<uint32_t, uint8_t>> m_interfaceMetrics; //!< Interface Metric set
145};
146
147} // namespace ns3
148
149#endif /* RIPNG_HELPER_H */
Hold a value for an Attribute.
Definition: attribute.h:70
Describes an IPv6 address.
Definition: ipv6-address.h:49
A factory to create ns3::Ipv6RoutingProtocol objects.
keep track of a set of node pointers.
Instantiate subclasses of ns3::Object.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Helper class that adds RIPng routing to nodes.
Definition: ripng-helper.h:44
void SetDefaultRouter(Ptr< Node > node, Ipv6Address nextHop, uint32_t interface)
Install a default route in the node.
void ExcludeInterface(Ptr< Node > node, uint32_t interface)
Exclude an interface from RIPng protocol.
Ptr< Ipv6RoutingProtocol > Create(Ptr< Node > node) const override
Definition: ripng-helper.cc:57
int64_t AssignStreams(NodeContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: ripng-helper.cc:89
RipNgHelper * Copy() const override
Definition: ripng-helper.cc:51
void SetInterfaceMetric(Ptr< Node > node, uint32_t interface, uint8_t metric)
Set a metric for an interface.
std::map< Ptr< Node >, std::set< uint32_t > > m_interfaceExclusions
Interface Exclusion set.
Definition: ripng-helper.h:143
void Set(std::string name, const AttributeValue &value)
Definition: ripng-helper.cc:83
~RipNgHelper() override
Definition: ripng-helper.cc:44
std::map< Ptr< Node >, std::map< uint32_t, uint8_t > > m_interfaceMetrics
Interface Metric set.
Definition: ripng-helper.h:144
ObjectFactory m_factory
Object Factory.
Definition: ripng-helper.h:141
RipNgHelper & operator=(const RipNgHelper &)=delete
Every class exported by the ns3 library is enclosed in the ns3 namespace.