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