A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
network-server-helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 University of Padova
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: Davide Magrin <magrinda@dei.unipd.it>
18 *
19 * Modified by: Alessandro Aimi <alessandro.aimi@unibo.it>
20 */
21
22#ifndef NETWORK_SERVER_HELPER_H
23#define NETWORK_SERVER_HELPER_H
24
25#include "ns3/address.h"
26#include "ns3/application-container.h"
27#include "ns3/attribute.h"
28#include "ns3/net-device.h"
29#include "ns3/network-server.h"
30#include "ns3/node-container.h"
31#include "ns3/object-factory.h"
32#include "ns3/point-to-point-helper.h"
33
34#include <stdint.h>
35#include <string>
36
37namespace ns3
38{
39namespace lorawan
40{
41
42/**
43 * Store network server app registration details for gateway nodes having a P2P link with the
44 * network server.
45 *
46 * For each gateway, store in a pair:
47 * - The Point-to-point net device of the network server;
48 * - The gateway node connected to the P2P net device.
49 */
50typedef std::list<std::pair<Ptr<PointToPointNetDevice>, Ptr<Node>>> P2PGwRegistration_t;
51
52/**
53 * \ingroup lorawan
54 *
55 * This class can install a NetworkServer application on a node.
56 */
58{
59 public:
60 NetworkServerHelper(); //!< Default constructor
61 ~NetworkServerHelper(); //!< Destructor
62
63 /**
64 * Record an attribute to be set in each Application after it is is created.
65 *
66 * \param name The name of the application attribute to set.
67 * \param value The value of the application attribute to set.
68 */
69 void SetAttribute(std::string name, const AttributeValue& value);
70
71 /**
72 * Create one lorawan network server application on the Node.
73 *
74 * \param node The node on which to create the Application.
75 * \return The application created.
76 */
78
79 /**
80 * Register gateways connected with point-to-point to this network server.
81 *
82 * \remark For the moment, only P2P connections are supported.
83 *
84 * \param registration The gateways registration data.
85 *
86 * \see ns3::lorawan::P2PGwRegistration_t
87 */
88 void SetGatewaysP2P(const P2PGwRegistration_t& registration);
89
90 /**
91 * Set which end devices will be managed by this network server.
92 *
93 * \param endDevices The end device nodes.
94 */
95 void SetEndDevices(NodeContainer endDevices);
96
97 /**
98 * Enable (true) or disable (false) the Adaptive Data Rate (ADR) component in the Network
99 * Server created by this helper.
100 *
101 * \param enableAdr Whether to enable ADR in the network server.
102 */
103 void EnableAdr(bool enableAdr);
104
105 /**
106 * Set the Adaptive Data Rate (ADR) implementation to use in the network server created
107 * by this helper.
108 *
109 * \param type The type of ADR implementation.
110 */
111 void SetAdr(std::string type);
112
113 private:
114 /**
115 * Install the NetworkServerComponent objects onto the NetworkServer application.
116 *
117 * \param netServer A pointer to the NetworkServer application.
118 */
120
121 /**
122 * Do the actual NetworkServer application installation on the Node.
123 *
124 * This function creates the NetworkServer application, installs it on the Node, connect the
125 * gateways to the Node with a PointToPoint link, registers gateways and devices in the
126 * NetworkServer application, and installs the necessary NetworkServerComponent objects.
127 *
128 * \param node A pointer to the Node.
129 * \return A pointer to the installed NetworkServer application.
130 */
132
133 ObjectFactory m_factory; //!< Factory to create the Network server application
134 std::list<std::pair<Ptr<NetDevice>, Ptr<Node>>>
135 m_gatewayRegistrationList; //!< List of gateway to register to this network server
136 NodeContainer m_endDevices; //!< Set of end devices to connect to this network server
137 bool m_adrEnabled; //!< Whether to enable the Adaptive Data Rate (ADR) algorithm on the
138 //!< NetworkServer application
139 ObjectFactory m_adrSupportFactory; //!< Factory to create the Adaptive Data Rate (ADR) component
140};
141
142} // namespace lorawan
143
144} // namespace ns3
145#endif /* NETWORK_SERVER_HELPER_H */
holds a vector of ns3::Application pointers.
Hold a value for an Attribute.
Definition: attribute.h:70
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
This class can install a NetworkServer application on a node.
void EnableAdr(bool enableAdr)
Enable (true) or disable (false) the Adaptive Data Rate (ADR) component in the Network Server created...
ObjectFactory m_adrSupportFactory
Factory to create the Adaptive Data Rate (ADR) component.
void SetGatewaysP2P(const P2PGwRegistration_t &registration)
Register gateways connected with point-to-point to this network server.
void InstallComponents(Ptr< NetworkServer > netServer)
Install the NetworkServerComponent objects onto the NetworkServer application.
void SetEndDevices(NodeContainer endDevices)
Set which end devices will be managed by this network server.
Ptr< Application > InstallPriv(Ptr< Node > node)
Do the actual NetworkServer application installation on the Node.
std::list< std::pair< Ptr< NetDevice >, Ptr< Node > > > m_gatewayRegistrationList
List of gateway to register to this network server.
ObjectFactory m_factory
Factory to create the Network server application.
void SetAdr(std::string type)
Set the Adaptive Data Rate (ADR) implementation to use in the network server created by this helper.
NodeContainer m_endDevices
Set of end devices to connect to this network server.
ApplicationContainer Install(Ptr< Node > node)
Create one lorawan network server application on the Node.
void SetAttribute(std::string name, const AttributeValue &value)
Record an attribute to be set in each Application after it is is created.
bool m_adrEnabled
Whether to enable the Adaptive Data Rate (ADR) algorithm on the NetworkServer application.
std::list< std::pair< Ptr< PointToPointNetDevice >, Ptr< Node > > > P2PGwRegistration_t
Store network server app registration details for gateway nodes having a P2P link with the network se...
Every class exported by the ns3 library is enclosed in the ns3 namespace.