A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
olsr-helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8#ifndef OLSR_HELPER_H
9#define OLSR_HELPER_H
10
11#include "ns3/ipv4-routing-helper.h"
12#include "ns3/node-container.h"
13#include "ns3/node.h"
14#include "ns3/object-factory.h"
15
16#include <map>
17#include <set>
18
19namespace ns3
20{
21
22/**
23 * \ingroup olsr
24 *
25 * \brief Helper class that adds OLSR routing to nodes.
26 *
27 * This class is expected to be used in conjunction with
28 * ns3::InternetStackHelper::SetRoutingHelper
29 */
31{
32 public:
33 /**
34 * Create an OlsrHelper that makes life easier for people who want to install
35 * OLSR routing to nodes.
36 */
37 OlsrHelper();
38
39 /**
40 * \brief Construct an OlsrHelper from another previously initialized instance
41 * (Copy Constructor).
42 *
43 * \param o object to copy
44 */
45 OlsrHelper(const OlsrHelper& o);
46
47 // Delete assignment operator to avoid misuse
48 OlsrHelper& operator=(const OlsrHelper&) = delete;
49
50 /**
51 * \returns pointer to clone of this OlsrHelper
52 *
53 * This method is mainly for internal use by the other helpers;
54 * clients are expected to free the dynamic memory allocated by this method
55 */
56 OlsrHelper* Copy() const override;
57
58 /**
59 * \param node the node for which an exception is to be defined
60 * \param interface an interface of node on which OLSR is not to be installed
61 *
62 * This method allows the user to specify an interface on which OLSR is not to be installed on
63 */
64 void ExcludeInterface(Ptr<Node> node, uint32_t interface);
65
66 /**
67 * \param node the node on which the routing protocol will run
68 * \returns a newly-created routing protocol
69 *
70 * This method will be called by ns3::InternetStackHelper::Install
71 */
72 Ptr<Ipv4RoutingProtocol> Create(Ptr<Node> node) const override;
73
74 /**
75 * \param name the name of the attribute to set
76 * \param value the value of the attribute to set.
77 *
78 * This method controls the attributes of ns3::olsr::RoutingProtocol
79 */
80 void Set(std::string name, const AttributeValue& value);
81
82 /**
83 * Assign a fixed random variable stream number to the random variables
84 * used by this model. Return the number of streams (possibly zero) that
85 * have been assigned. The Install() method of the InternetStackHelper
86 * should have previously been called by the user.
87 *
88 * \param stream first stream index to use
89 * \param c NodeContainer of the set of nodes for which the OlsrRoutingProtocol
90 * should be modified to use a fixed stream
91 * \return the number of stream indices assigned by this helper
92 */
93 int64_t AssignStreams(NodeContainer c, int64_t stream);
94
95 private:
96 ObjectFactory m_agentFactory; //!< Object factory
97
98 std::map<Ptr<Node>, std::set<uint32_t>>
99 m_interfaceExclusions; //!< container of interfaces excluded from OLSR operations
100};
101
102} // namespace ns3
103
104#endif /* OLSR_HELPER_H */
Hold a value for an Attribute.
Definition attribute.h:59
a factory to create ns3::Ipv4RoutingProtocol objects
keep track of a set of node pointers.
Instantiate subclasses of ns3::Object.
Helper class that adds OLSR routing to nodes.
Definition olsr-helper.h:31
void Set(std::string name, const AttributeValue &value)
void ExcludeInterface(Ptr< Node > node, uint32_t interface)
int64_t AssignStreams(NodeContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
OlsrHelper()
Create an OlsrHelper that makes life easier for people who want to install OLSR routing to nodes.
OlsrHelper * Copy() const override
std::map< Ptr< Node >, std::set< uint32_t > > m_interfaceExclusions
container of interfaces excluded from OLSR operations
Definition olsr-helper.h:99
Ptr< Ipv4RoutingProtocol > Create(Ptr< Node > node) const override
ObjectFactory m_agentFactory
Object factory.
Definition olsr-helper.h:96
OlsrHelper & operator=(const OlsrHelper &)=delete
Smart pointer class similar to boost::intrusive_ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.