A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
utilities.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 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 * Authors: Davide Magrin <magrinda@dei.unipd.it>
18 */
19
20#ifndef TEST_UTILITIES_H
21#define TEST_UTILITIES_H
22
23#include "ns3/forwarder-helper.h"
24#include "ns3/lora-helper.h"
25#include "ns3/mobility-helper.h"
26#include "ns3/network-server-helper.h"
27#include "ns3/position-allocator.h"
28
29namespace ns3
30{
31namespace lorawan
32{
33
34/**
35 * \ingroup lorawan
36 *
37 * Stores the main elements of a simulated LoRaWAN network
38 */
40{
41 Ptr<LoraChannel> channel; //!< A pointer to the LoraChannel object.
42 NodeContainer endDevices; //!< Container of the end device nodes.
43 NodeContainer gateways; //!< Container of the gateway nodes.
44 Ptr<Node> nsNode; //!< A pointer to the network server Node.
45};
46
48
50
52
54
55template <typename T>
58{
59 return n->GetDevice(0)->GetObject<LoraNetDevice>()->GetMac()->GetObject<T>();
60}
61
62NetworkComponents InitializeNetwork(int nDevices, int nGateways);
63} // namespace lorawan
64
65} // namespace ns3
66#endif
Helper class used to assign positions and mobility models to nodes.
keep track of a set of node pointers.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:522
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Hold together all LoRa related objects.
int nDevices
Number of end device nodes to create.
int nGateways
Number of gateway nodes to create.
Ptr< Node > CreateNetworkServer(NodeContainer endDevices, NodeContainer gateways)
Definition: utilities.cc:96
Ptr< LoraChannel > CreateChannel()
Definition: utilities.cc:28
NodeContainer CreateGateways(int nGateways, MobilityHelper mobility, Ptr< LoraChannel > channel)
Definition: utilities.cc:69
NetworkComponents InitializeNetwork(int nDevices, int nGateways)
Definition: utilities.cc:128
Ptr< T > GetMacLayerFromNode(Ptr< Node > n)
Definition: utilities.h:57
NodeContainer CreateEndDevices(int nDevices, MobilityHelper mobility, Ptr< LoraChannel > channel)
Definition: utilities.cc:41
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Stores the main elements of a simulated LoRaWAN network.
Definition: utilities.h:40
Ptr< Node > nsNode
A pointer to the network server Node.
Definition: utilities.h:44
Ptr< LoraChannel > channel
A pointer to the LoraChannel object.
Definition: utilities.h:41
NodeContainer endDevices
Container of the end device nodes.
Definition: utilities.h:42
NodeContainer gateways
Container of the gateway nodes.
Definition: utilities.h:43