lora-network-controller-components.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2017 University of Padova
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Davide Magrin <magrinda@dei.unipd.it>
19  *
20  * Modified by: Bastien Tauran <bastien.tauran@viveris.fr>s
21  */
22 
23 #ifndef LORA_NETWORK_CONTROLLER_COMPONENTS_H
24 #define LORA_NETWORK_CONTROLLER_COMPONENTS_H
25 
26 #include "lora-network-status.h"
27 
28 #include <ns3/log.h>
29 #include <ns3/object.h>
30 #include <ns3/packet.h>
31 
32 namespace ns3
33 {
34 
35 class LoraNetworkStatus;
36 
38 // Base class //
40 
48 class LoraNetworkControllerComponent : public Object
49 {
50  public:
51  static TypeId GetTypeId(void);
52 
53  // Constructor and destructor
56 
57  // Virtual methods whose implementation is left to child classes
64  virtual void OnReceivedPacket(Ptr<const Packet> packet,
65  Ptr<LoraEndDeviceStatus> status,
66  Ptr<LoraNetworkStatus> networkStatus) = 0;
67 
68  virtual void BeforeSendingReply(Ptr<LoraEndDeviceStatus> status,
69  Ptr<LoraNetworkStatus> networkStatus) = 0;
70 
78  virtual void OnFailedReply(Ptr<LoraEndDeviceStatus> status,
79  Ptr<LoraNetworkStatus> networkStatus) = 0;
80 };
81 
83 // Acknowledgment management //
85 
87 {
88  public:
89  static TypeId GetTypeId(void);
90 
91  // Constructor and destructor
94 
102  void OnReceivedPacket(Ptr<const Packet> packet,
103  Ptr<LoraEndDeviceStatus> status,
104  Ptr<LoraNetworkStatus> networkStatus);
105 
106  void BeforeSendingReply(Ptr<LoraEndDeviceStatus> status, Ptr<LoraNetworkStatus> networkStatus);
107 
108  void OnFailedReply(Ptr<LoraEndDeviceStatus> status, Ptr<LoraNetworkStatus> networkStatus);
109 };
110 
112 // LinkCheck commands management //
114 
116 {
117  public:
118  static TypeId GetTypeId(void);
119 
120  // Constructor and destructor
122  virtual ~LoraLinkCheckComponent();
123 
131  void OnReceivedPacket(Ptr<const Packet> packet,
132  Ptr<LoraEndDeviceStatus> status,
133  Ptr<LoraNetworkStatus> networkStatus);
134 
135  void BeforeSendingReply(Ptr<LoraEndDeviceStatus> status, Ptr<LoraNetworkStatus> networkStatus);
136 
137  void OnFailedReply(Ptr<LoraEndDeviceStatus> status, Ptr<LoraNetworkStatus> networkStatus);
138 
139  private:
140  void UpdateLinkCheckAns(Ptr<const Packet> packet, Ptr<LoraEndDeviceStatus> status);
141 };
142 
143 } // namespace ns3
144 #endif
void OnFailedReply(Ptr< LoraEndDeviceStatus > status, Ptr< LoraNetworkStatus > networkStatus)
Method that is called when a packet cannot be sent in the downlink.
void BeforeSendingReply(Ptr< LoraEndDeviceStatus > status, Ptr< LoraNetworkStatus > networkStatus)
void OnReceivedPacket(Ptr< const Packet > packet, Ptr< LoraEndDeviceStatus > status, Ptr< LoraNetworkStatus > networkStatus)
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 OnReceivedPacket(Ptr< const Packet > packet, Ptr< LoraEndDeviceStatus > status, Ptr< LoraNetworkStatus > networkStatus)=0
Method that is called when a new packet is received by the NetworkServer.
virtual void BeforeSendingReply(Ptr< LoraEndDeviceStatus > status, Ptr< LoraNetworkStatus > networkStatus)=0
virtual void OnFailedReply(Ptr< LoraEndDeviceStatus > status, Ptr< LoraNetworkStatus > networkStatus)=0
Method that is called when a packet cannot be sent in the downlink.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.