lora-forwarder.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>
21  */
22 
23 #ifndef LORA_FORWARDER_H
24 #define LORA_FORWARDER_H
25 
27 
28 #include <ns3/application.h>
29 #include <ns3/attribute.h>
30 #include <ns3/nstime.h>
31 #include <ns3/point-to-point-net-device.h>
32 
33 #include <map>
34 
35 namespace ns3
36 {
37 
42 class LoraForwarder : public Application
43 {
44  public:
45  LoraForwarder();
47 
48  static TypeId GetTypeId(void);
49 
56  void SetLoraNetDevice(uint8_t beamId, Ptr<SatLorawanNetDevice> loraNetDevice);
57 
63  void SetPointToPointNetDevice(Ptr<PointToPointNetDevice> pointToPointNetDevice);
64 
74  bool ReceiveFromLora(Ptr<SatLorawanNetDevice> loraNetDevice,
75  Ptr<const Packet> packet,
76  uint16_t protocol,
77  const Address& sender);
78 
82  bool ReceiveFromPointToPoint(Ptr<NetDevice> pointToPointNetDevice,
83  Ptr<const Packet> packet,
84  uint16_t protocol,
85  const Address& sender);
86 
90  void StartApplication(void);
91 
95  void StopApplication(void);
96 
97  private:
98  std::map<uint8_t, Ptr<SatLorawanNetDevice>>
101 
102  Ptr<PointToPointNetDevice> m_pointToPointNetDevice;
105 };
106 
107 } // namespace ns3
108 
109 #endif /* LORA_FORWARDER_H */
This application forwards packets between NetDevices: SatLorawanNetDevice -> PointToPointNetDevice an...
Ptr< PointToPointNetDevice > m_pointToPointNetDevice
Pointer to the P2PNetDevice we use to.
bool ReceiveFromLora(Ptr< SatLorawanNetDevice > loraNetDevice, Ptr< const Packet > packet, uint16_t protocol, const Address &sender)
Receive a packet from the LoraNetDevice.
std::map< uint8_t, Ptr< SatLorawanNetDevice > > m_satLorawanNetDevices
Map between beam ID and pointer to the node's SatLorawanNetDevice.
static TypeId GetTypeId(void)
void StartApplication(void)
Start the application.
void StopApplication(void)
Stop the application.
void SetLoraNetDevice(uint8_t beamId, Ptr< SatLorawanNetDevice > loraNetDevice)
Sets the device to use to communicate with the EDs.
bool ReceiveFromPointToPoint(Ptr< NetDevice > pointToPointNetDevice, Ptr< const Packet > packet, uint16_t protocol, const Address &sender)
Receive a packet from the PointToPointNetDevice.
void SetPointToPointNetDevice(Ptr< PointToPointNetDevice > pointToPointNetDevice)
Sets the P2P device to use to communicate with the NS.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.