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