A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
network-scheduler.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 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 * Author: Davide Magrin <magrinda@dei.unipd.it>
18 */
19
20#ifndef NETWORK_SCHEDULER_H
21#define NETWORK_SCHEDULER_H
22
23#include "lora-device-address.h"
24#include "lora-frame-header.h"
25#include "lorawan-mac-header.h"
26#include "network-controller.h"
27#include "network-status.h"
28
29#include "ns3/core-module.h"
30#include "ns3/object.h"
31#include "ns3/packet.h"
32
33namespace ns3
34{
35namespace lorawan
36{
37
38class NetworkStatus; // Forward declaration
39class NetworkController; // Forward declaration
40
41/**
42 * \ingroup lorawan
43 *
44 * Network server component in charge of scheduling downling packets onto devices' reception windows
45 *
46 * \todo We should probably add getters and setters or remove default constructor
47 */
49{
50 public:
51 /**
52 * Register this type.
53 * \return The object TypeId.
54 */
55 static TypeId GetTypeId();
56
57 NetworkScheduler(); //!< Default constructor
58 ~NetworkScheduler() override; //!< Destructor
59
60 /**
61 * Construct a new NetworkScheduler providing the NetworkStatus and the NetworkController
62 * objects.
63 *
64 * \param status A pointer to the NetworkStatus object.
65 * \param controller A pointer to the NetworkController object.
66 */
68
69 /**
70 * Method called by NetworkServer application to inform the Scheduler of a newly arrived uplink
71 * packet.
72 *
73 * This function schedules the OnReceiveWindowOpportunity events 1 and 2 seconds later.
74 *
75 * \param packet A pointer to the new Packet instance.
76 */
78
79 /**
80 * Method that is scheduled after packet arrival in order to take action on
81 * sender's receive windows openings.
82 *
83 * \param deviceAddress The Address of the end device.
84 * \param window The reception window number (1 or 2).
85 */
86 void OnReceiveWindowOpportunity(LoraDeviceAddress deviceAddress, int window);
87
88 private:
90 m_receiveWindowOpened; //!< Trace callback source for reception windows openings.
91 //!< \todo Never called. Place calls in the right places.
92 Ptr<NetworkStatus> m_status; //!< A pointer to the NetworkStatus object.
93 Ptr<NetworkController> m_controller; //!< A pointer to the NetworkController object.
94};
95
96} // namespace lorawan
97
98} // namespace ns3
99#endif /* NETWORK_SCHEDULER_H */
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
This class represents the device address of a LoraWAN end device.
Network server component in charge of scheduling downling packets onto devices' reception windows.
~NetworkScheduler() override
Destructor.
void OnReceivedPacket(Ptr< const Packet > packet)
Method called by NetworkServer application to inform the Scheduler of a newly arrived uplink packet.
Ptr< NetworkController > m_controller
A pointer to the NetworkController object.
Ptr< NetworkStatus > m_status
A pointer to the NetworkStatus object.
NetworkScheduler()
Default constructor.
static TypeId GetTypeId()
Register this type.
void OnReceiveWindowOpportunity(LoraDeviceAddress deviceAddress, int window)
Method that is scheduled after packet arrival in order to take action on sender's receive windows ope...
TracedCallback< Ptr< const Packet > > m_receiveWindowOpened
Trace callback source for reception windows openings.
Every class exported by the ns3 library is enclosed in the ns3 namespace.