A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
network-controller-components.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_CONTROLLER_COMPONENTS_H
21#define NETWORK_CONTROLLER_COMPONENTS_H
22
23#include "network-status.h"
24
25#include "ns3/log.h"
26#include "ns3/object.h"
27#include "ns3/packet.h"
28
29namespace ns3
30{
31namespace lorawan
32{
33
34class NetworkStatus;
35
36////////////////
37// Base class //
38////////////////
39
40/**
41 * \ingroup lorawan
42 *
43 * Generic class describing a component of the NetworkController.
44 *
45 * This is the class that is meant to be extended by all NetworkController
46 * components, and provides a common interface for the NetworkController to
47 * query available components and prompt them to act on new packet arrivals.
48 */
50{
51 public:
52 /**
53 * Register this type.
54 * \return The object TypeId.
55 */
56 static TypeId GetTypeId();
57
58 NetworkControllerComponent(); //!< Default constructor
59 ~NetworkControllerComponent() override; //!< Destructor
60
61 // Virtual methods whose implementation is left to child classes
62 /**
63 * Function called as a new uplink packet is received by the NetworkServer application.
64 *
65 * \param packet The newly received packet.
66 * \param status A pointer to the status of the end device that sent the packet.
67 * \param networkStatus A pointer to the NetworkStatus object.
68 */
71 Ptr<NetworkStatus> networkStatus) = 0;
72 /**
73 * Function called as a downlink reply is about to leave the NetworkServer application.
74 *
75 * \param status A pointer to the status of the end device which we are sending the reply to.
76 * \param networkStatus A pointer to the NetworkStatus object.
77 */
79 Ptr<NetworkStatus> networkStatus) = 0;
80 /**
81 * Method that is called when a packet cannot be sent in the downlink.
82 *
83 * \param status The EndDeviceStatus of the device to which it was impossible to send a reply.
84 * \param networkStatus A pointer to the NetworkStatus object.
85 */
86 virtual void OnFailedReply(Ptr<EndDeviceStatus> status, Ptr<NetworkStatus> networkStatus) = 0;
87};
88
89/**
90 * \ingroup lorawan
91 *
92 * Network controller component for acknowledgments management.
93 */
95{
96 public:
97 /**
98 * Register this type.
99 * \return The object TypeId.
100 */
101 static TypeId GetTypeId();
102
103 ConfirmedMessagesComponent(); //!< Default constructor
104 ~ConfirmedMessagesComponent() override; //!< Destructor
105
106 /**
107 * This method checks whether the received packet requires an acknowledgment
108 * and sets up the appropriate reply in case it does.
109 *
110 * \param packet The newly received packet.
111 * \param status A pointer to the EndDeviceStatus object of the sender.
112 * \param networkStatus A pointer to the NetworkStatus object.
113 */
116 Ptr<NetworkStatus> networkStatus) override;
117
118 void BeforeSendingReply(Ptr<EndDeviceStatus> status, Ptr<NetworkStatus> networkStatus) override;
119
120 void OnFailedReply(Ptr<EndDeviceStatus> status, Ptr<NetworkStatus> networkStatus) override;
121};
122
123/**
124 * \ingroup lorawan
125 *
126 * Network controller component for LinkCheck commands management.
127 */
129{
130 public:
131 /**
132 * Register this type.
133 * \return The object TypeId.
134 */
135 static TypeId GetTypeId();
136
137 LinkCheckComponent(); //!< Default constructor
138 ~LinkCheckComponent() override; //!< Destructor
139
140 /**
141 * This method checks whether the received packet requires an acknowledgment
142 * and sets up the appropriate reply in case it does.
143 *
144 * \param packet The newly received packet.
145 * \param status A pointer to the EndDeviceStatus object of the sender.
146 * \param networkStatus A pointer to the NetworkStatus object.
147 */
150 Ptr<NetworkStatus> networkStatus) override;
151
152 void BeforeSendingReply(Ptr<EndDeviceStatus> status, Ptr<NetworkStatus> networkStatus) override;
153
154 void OnFailedReply(Ptr<EndDeviceStatus> status, Ptr<NetworkStatus> networkStatus) override;
155
156 private:
157};
158} // namespace lorawan
159
160} // namespace ns3
161#endif
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
a unique identifier for an interface.
Definition: type-id.h:59
Network controller component for acknowledgments management.
void BeforeSendingReply(Ptr< EndDeviceStatus > status, Ptr< NetworkStatus > networkStatus) override
Function called as a downlink reply is about to leave the NetworkServer application.
void OnFailedReply(Ptr< EndDeviceStatus > status, Ptr< NetworkStatus > networkStatus) override
Method that is called when a packet cannot be sent in the downlink.
void OnReceivedPacket(Ptr< const Packet > packet, Ptr< EndDeviceStatus > status, Ptr< NetworkStatus > networkStatus) override
This method checks whether the received packet requires an acknowledgment and sets up the appropriate...
Generic class describing a component of the NetworkController.
virtual void BeforeSendingReply(Ptr< EndDeviceStatus > status, Ptr< NetworkStatus > networkStatus)=0
Function called as a downlink reply is about to leave the NetworkServer application.
virtual void OnReceivedPacket(Ptr< const Packet > packet, Ptr< EndDeviceStatus > status, Ptr< NetworkStatus > networkStatus)=0
Function called as a new uplink packet is received by the NetworkServer application.
virtual void OnFailedReply(Ptr< EndDeviceStatus > status, Ptr< NetworkStatus > networkStatus)=0
Method that is called when a packet cannot be sent in the downlink.
Every class exported by the ns3 library is enclosed in the ns3 namespace.