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