A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
network-status.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: Martina Capuzzo <capuzzom@dei.unipd.it>
7
* Davide Magrin <magrinda@dei.unipd.it>
8
*/
9
10
#ifndef NETWORK_STATUS_H
11
#define NETWORK_STATUS_H
12
13
#include "
class-a-end-device-lorawan-mac.h
"
14
#include "
end-device-status.h
"
15
#include "
gateway-status.h
"
16
#include "
lora-device-address.h
"
17
#include "
network-scheduler.h
"
18
19
#include <iterator>
20
21
namespace
ns3
22
{
23
namespace
lorawan
24
{
25
26
/**
27
* \ingroup lorawan
28
*
29
* This class represents the knowledge about the state of the network that is
30
* available at the network server. It is essentially a collection of two maps:
31
* one containing DeviceStatus objects, and the other containing GatewayStatus
32
* objects.
33
*
34
* This class is meant to be queried by NetworkController components, which
35
* can decide to take action based on the current status of the network.
36
*/
37
class
NetworkStatus
:
public
Object
38
{
39
public
:
40
/**
41
* Register this type.
42
* \return The object TypeId.
43
*/
44
static
TypeId
GetTypeId
();
45
46
NetworkStatus
();
//!< Default constructor
47
~NetworkStatus
()
override
;
//!< Destructor
48
49
/**
50
* Add a device to the ones that are tracked by this NetworkStatus object.
51
*
52
* \param edMac Pointer to the MAC layer object of the device to be tracked.
53
*/
54
void
AddNode
(
Ptr<ClassAEndDeviceLorawanMac>
edMac);
55
56
/**
57
* Add a new gateway to the list of gateways connected to the network.
58
*
59
* Each gateway is identified by its NetDevice Address in the network connecting it to the
60
* network server.
61
*
62
* \param address The gateway's NetDevice Address.
63
* \param gwStatus A pointer to a GatewayStatus object for the gateway.
64
*/
65
void
AddGateway
(
Address
& address,
Ptr<GatewayStatus>
gwStatus);
66
67
/**
68
* Update network status on a received packet.
69
*
70
* \param packet The received packet.
71
* \param gwaddress Address of the gateway this packet was received from.
72
*/
73
void
OnReceivedPacket
(
Ptr<const Packet>
packet,
const
Address
& gwaddress);
74
75
/**
76
* Return whether the specified device needs a reply.
77
*
78
* \param deviceAddress The address of the device we are interested in.
79
* \return True if we need to reply to the last packet from the device, false otherwise.
80
*/
81
bool
NeedsReply
(
LoraDeviceAddress
deviceAddress);
82
83
/**
84
* Return whether we have a gateway that is available to send a reply to the specified
85
* device.
86
*
87
* \param deviceAddress The address of the device we are interested in.
88
* \param window The device reception window we are currently targeting (1 or 2).
89
* \return The Address of the gateway which measured the best RSSI of the last packet from the
90
* device, selected among the gateways being currently available for downlink transmission.
91
*/
92
Address
GetBestGatewayForDevice
(
LoraDeviceAddress
deviceAddress,
int
window);
93
94
/**
95
* Send a packet through a gateway.
96
*
97
* This function assumes that the packet is already tagged with a LoraTag
98
* that will inform the gateway of the parameters to use for the
99
* transmission.
100
*
101
* \param packet The packet.
102
* \param gwAddress The address of the gateway.
103
*/
104
void
SendThroughGateway
(
Ptr<Packet>
packet,
Address
gwAddress);
105
106
/**
107
* Get the reply packet prepared for a reception window of a device.
108
*
109
* \param edAddress The address of the device.
110
* \param windowNumber The reception window number (1 or 2).
111
* \return The reply packet.
112
*/
113
Ptr<Packet>
GetReplyForDevice
(
LoraDeviceAddress
edAddress,
int
windowNumber);
114
115
/**
116
* Get the EndDeviceStatus of the device that sent a packet.
117
*
118
* \param packet The packet sent by the end device.
119
* \return A pointer to the end device status.
120
*/
121
Ptr<EndDeviceStatus>
GetEndDeviceStatus
(
Ptr<const Packet>
packet);
122
123
/**
124
* Get the EndDeviceStatus corresponding to a LoraDeviceAddress.
125
*
126
* \param address The LoraDeviceAddress of the end device.
127
* \return A pointer to the end device status.
128
*/
129
Ptr<EndDeviceStatus>
GetEndDeviceStatus
(
LoraDeviceAddress
address);
130
131
/**
132
* Return the number of end devices currently managed by the server.
133
*
134
* \return The number of end devices as an int.
135
*/
136
int
CountEndDevices
();
137
138
public
:
139
std::map<LoraDeviceAddress, Ptr<EndDeviceStatus>>
140
m_endDeviceStatuses
;
//!< Map tracking the state of devices connected to this network server
141
std::map<Address, Ptr<GatewayStatus>>
142
m_gatewayStatuses
;
//!< Map tracking the state of gateways connected to this network server
143
};
144
145
}
// namespace lorawan
146
147
}
// namespace ns3
148
#endif
/* NETWORK_STATUS_H */
class-a-end-device-lorawan-mac.h
ns3::Address
a polymophic address class
Definition
address.h:90
ns3::Object
A base class which provides memory management and object aggregation.
Definition
object.h:78
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::lorawan::LoraDeviceAddress
This class represents the device address of a LoraWAN end device.
Definition
lora-device-address.h:106
ns3::lorawan::NetworkStatus
This class represents the knowledge about the state of the network that is available at the network s...
Definition
network-status.h:38
ns3::lorawan::NetworkStatus::~NetworkStatus
~NetworkStatus() override
Destructor.
Definition
network-status.cc:46
ns3::lorawan::NetworkStatus::GetEndDeviceStatus
Ptr< EndDeviceStatus > GetEndDeviceStatus(Ptr< const Packet > packet)
Get the EndDeviceStatus of the device that sent a packet.
Definition
network-status.cc:192
ns3::lorawan::NetworkStatus::OnReceivedPacket
void OnReceivedPacket(Ptr< const Packet > packet, const Address &gwaddress)
Update network status on a received packet.
Definition
network-status.cc:88
ns3::lorawan::NetworkStatus::NetworkStatus
NetworkStatus()
Default constructor.
Definition
network-status.cc:41
ns3::lorawan::NetworkStatus::NeedsReply
bool NeedsReply(LoraDeviceAddress deviceAddress)
Return whether the specified device needs a reply.
Definition
network-status.cc:109
ns3::lorawan::NetworkStatus::AddNode
void AddNode(Ptr< ClassAEndDeviceLorawanMac > edMac)
Add a device to the ones that are tracked by this NetworkStatus object.
Definition
network-status.cc:52
ns3::lorawan::NetworkStatus::CountEndDevices
int CountEndDevices()
Return the number of end devices currently managed by the server.
Definition
network-status.cc:232
ns3::lorawan::NetworkStatus::m_endDeviceStatuses
std::map< LoraDeviceAddress, Ptr< EndDeviceStatus > > m_endDeviceStatuses
Map tracking the state of devices connected to this network server.
Definition
network-status.h:140
ns3::lorawan::NetworkStatus::SendThroughGateway
void SendThroughGateway(Ptr< Packet > packet, Address gwAddress)
Send a packet through a gateway.
Definition
network-status.cc:159
ns3::lorawan::NetworkStatus::m_gatewayStatuses
std::map< Address, Ptr< GatewayStatus > > m_gatewayStatuses
Map tracking the state of gateways connected to this network server.
Definition
network-status.h:142
ns3::lorawan::NetworkStatus::AddGateway
void AddGateway(Address &address, Ptr< GatewayStatus > gwStatus)
Add a new gateway to the list of gateways connected to the network.
Definition
network-status.cc:72
ns3::lorawan::NetworkStatus::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition
network-status.cc:32
ns3::lorawan::NetworkStatus::GetReplyForDevice
Ptr< Packet > GetReplyForDevice(LoraDeviceAddress edAddress, int windowNumber)
Get the reply packet prepared for a reception window of a device.
Definition
network-status.cc:167
ns3::lorawan::NetworkStatus::GetBestGatewayForDevice
Address GetBestGatewayForDevice(LoraDeviceAddress deviceAddress, int window)
Return whether we have a gateway that is available to send a reply to the specified device.
Definition
network-status.cc:116
end-device-status.h
gateway-status.h
lora-device-address.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
network-scheduler.h
src
lorawan
model
network-status.h
Generated on Fri Nov 8 2024 13:59:02 for ns-3 by
1.11.0