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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Davide Magrin <magrinda@dei.unipd.it>
7 */
8
9#ifndef NETWORK_CONTROLLER_COMPONENTS_H
10#define NETWORK_CONTROLLER_COMPONENTS_H
11
12#include "network-status.h"
13
14#include "ns3/log.h"
15#include "ns3/object.h"
16#include "ns3/packet.h"
17
18namespace ns3
19{
20namespace lorawan
21{
22
23class NetworkStatus;
24
25////////////////
26// Base class //
27////////////////
28
29/**
30 * \ingroup lorawan
31 *
32 * Generic class describing a component of the NetworkController.
33 *
34 * This is the class that is meant to be extended by all NetworkController
35 * components, and provides a common interface for the NetworkController to
36 * query available components and prompt them to act on new packet arrivals.
37 */
39{
40 public:
41 /**
42 * Register this type.
43 * \return The object TypeId.
44 */
45 static TypeId GetTypeId();
46
47 NetworkControllerComponent(); //!< Default constructor
48 ~NetworkControllerComponent() override; //!< Destructor
49
50 // Virtual methods whose implementation is left to child classes
51 /**
52 * Function called as a new uplink packet is received by the NetworkServer application.
53 *
54 * \param packet The newly received packet.
55 * \param status A pointer to the status of the end device that sent the packet.
56 * \param networkStatus A pointer to the NetworkStatus object.
57 */
60 Ptr<NetworkStatus> networkStatus) = 0;
61 /**
62 * Function called as a downlink reply is about to leave the NetworkServer application.
63 *
64 * \param status A pointer to the status of the end device which we are sending the reply to.
65 * \param networkStatus A pointer to the NetworkStatus object.
66 */
68 Ptr<NetworkStatus> networkStatus) = 0;
69 /**
70 * Method that is called when a packet cannot be sent in the downlink.
71 *
72 * \param status The EndDeviceStatus of the device to which it was impossible to send a reply.
73 * \param networkStatus A pointer to the NetworkStatus object.
74 */
75 virtual void OnFailedReply(Ptr<EndDeviceStatus> status, Ptr<NetworkStatus> networkStatus) = 0;
76};
77
78/**
79 * \ingroup lorawan
80 *
81 * Network controller component for acknowledgments management.
82 */
84{
85 public:
86 /**
87 * Register this type.
88 * \return The object TypeId.
89 */
90 static TypeId GetTypeId();
91
92 ConfirmedMessagesComponent(); //!< Default constructor
93 ~ConfirmedMessagesComponent() override; //!< Destructor
94
95 /**
96 * This method checks whether the received packet requires an acknowledgment
97 * and sets up the appropriate reply in case it does.
98 *
99 * \param packet The newly received packet.
100 * \param status A pointer to the EndDeviceStatus object of the sender.
101 * \param networkStatus A pointer to the NetworkStatus object.
102 */
105 Ptr<NetworkStatus> networkStatus) override;
106
107 void BeforeSendingReply(Ptr<EndDeviceStatus> status, Ptr<NetworkStatus> networkStatus) override;
108
109 void OnFailedReply(Ptr<EndDeviceStatus> status, Ptr<NetworkStatus> networkStatus) override;
110};
111
112/**
113 * \ingroup lorawan
114 *
115 * Network controller component for LinkCheck commands management.
116 */
118{
119 public:
120 /**
121 * Register this type.
122 * \return The object TypeId.
123 */
124 static TypeId GetTypeId();
125
126 LinkCheckComponent(); //!< Default constructor
127 ~LinkCheckComponent() override; //!< Destructor
128
129 /**
130 * This method checks whether the received packet requires an acknowledgment
131 * and sets up the appropriate reply in case it does.
132 *
133 * \param packet The newly received packet.
134 * \param status A pointer to the EndDeviceStatus object of the sender.
135 * \param networkStatus A pointer to the NetworkStatus object.
136 */
139 Ptr<NetworkStatus> networkStatus) override;
140
141 void BeforeSendingReply(Ptr<EndDeviceStatus> status, Ptr<NetworkStatus> networkStatus) override;
142
143 void OnFailedReply(Ptr<EndDeviceStatus> status, Ptr<NetworkStatus> networkStatus) override;
144
145 private:
146};
147} // namespace lorawan
148
149} // namespace ns3
150#endif
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
Definition type-id.h:48
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.