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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Davide Magrin <magrinda@dei.unipd.it>
7 */
8
9#ifndef TEST_UTILITIES_H
10#define TEST_UTILITIES_H
11
12#include "ns3/lora-channel.h"
13#include "ns3/lora-net-device.h"
14#include "ns3/mobility-helper.h"
15#include "ns3/node-container.h"
16
17namespace ns3
18{
19namespace lorawan
20{
21
22/**
23 * @ingroup lorawan
24 *
25 * Stores the main elements of a simulated LoRaWAN network
26 */
28{
29 Ptr<LoraChannel> channel; //!< A pointer to the LoraChannel object.
30 NodeContainer endDevices; //!< Container of the end device nodes.
31 NodeContainer gateways; //!< Container of the gateway nodes.
32 Ptr<Node> nsNode; //!< A pointer to the network server Node.
33};
34
36
38
40
42
43template <typename T>
46{
47 return DynamicCast<T>(DynamicCast<LoraNetDevice>(n->GetDevice(0))->GetMac());
48}
49
50NetworkComponents InitializeNetwork(int nDevices, int nGateways);
51
52} // namespace lorawan
53} // namespace ns3
54
55#endif /* TEST_UTILITIES_H */
Helper class used to assign positions and mobility models to nodes.
keep track of a set of node pointers.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
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:92
Ptr< LoraChannel > CreateChannel()
Definition utilities.cc:24
NodeContainer CreateGateways(int nGateways, MobilityHelper mobility, Ptr< LoraChannel > channel)
Definition utilities.cc:65
NetworkComponents InitializeNetwork(int nDevices, int nGateways)
Definition utilities.cc:124
Ptr< T > GetMacLayerFromNode(Ptr< Node > n)
Definition utilities.h:45
NodeContainer CreateEndDevices(int nDevices, MobilityHelper mobility, Ptr< LoraChannel > channel)
Definition utilities.cc:37
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Definition ptr.h:605
Stores the main elements of a simulated LoRaWAN network.
Definition utilities.h:28
Ptr< Node > nsNode
A pointer to the network server Node.
Definition utilities.h:32
Ptr< LoraChannel > channel
A pointer to the LoraChannel object.
Definition utilities.h:29
NodeContainer endDevices
Container of the end device nodes.
Definition utilities.h:30
NodeContainer gateways
Container of the gateway nodes.
Definition utilities.h:31