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