A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
forwarder.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 FORWARDER_H
21
#define FORWARDER_H
22
23
#include "
lora-net-device.h
"
24
25
#include "ns3/application.h"
26
#include "ns3/attribute.h"
27
#include "ns3/nstime.h"
28
#include "ns3/point-to-point-net-device.h"
29
30
namespace
ns3
31
{
32
namespace
lorawan
33
{
34
35
/**
36
* \ingroup lorawan
37
*
38
* This application forwards packets between NetDevices:
39
* LoraNetDevice -> PointToPointNetDevice and vice versa.
40
*/
41
class
Forwarder
:
public
Application
42
{
43
public
:
44
Forwarder
();
//!< Default constructor
45
~Forwarder
()
override
;
//!< Destructor
46
47
/**
48
* Register this type.
49
* \return The object TypeId.
50
*/
51
static
TypeId
GetTypeId
();
52
53
/**
54
* Sets the device to use to communicate with the end devices.
55
*
56
* \param loraNetDevice The LoraNetDevice on this node.
57
*/
58
void
SetLoraNetDevice
(
Ptr<LoraNetDevice>
loraNetDevice);
59
60
/**
61
* Sets the P2P device to use to communicate with the network server.
62
*
63
* \param pointToPointNetDevice The P2PNetDevice on this node.
64
*/
65
void
SetPointToPointNetDevice
(
Ptr<PointToPointNetDevice>
pointToPointNetDevice);
66
67
/**
68
* Receive a packet from the LoraNetDevice.
69
*
70
* \param loraNetDevice The LoraNetDevice we received the packet from.
71
* \param packet The packet we received.
72
* \param protocol The protocol number associated to this packet.
73
* \param sender The address of the sender.
74
* \return True if we can handle the packet, false otherwise.
75
*/
76
bool
ReceiveFromLora
(
Ptr<NetDevice>
loraNetDevice,
77
Ptr<const Packet>
packet,
78
uint16_t protocol,
79
const
Address
& sender);
80
81
/**
82
* Receive a packet from the PointToPointNetDevice.
83
*
84
* \copydoc ns3::NetDevice::ReceiveCallback
85
*/
86
bool
ReceiveFromPointToPoint
(
Ptr<NetDevice>
device,
87
Ptr<const Packet>
packet,
88
uint16_t protocol,
89
const
Address
& sender);
90
91
/**
92
* Start the application.
93
*/
94
void
StartApplication
()
override
;
95
96
/**
97
* Stop the application.
98
*/
99
void
StopApplication
()
override
;
100
101
private
:
102
Ptr<LoraNetDevice>
m_loraNetDevice
;
//!< Pointer to the node's LoraNetDevice
103
104
Ptr<PointToPointNetDevice>
m_pointToPointNetDevice
;
//!< Pointer to the P2PNetDevice we use to
105
//!< communicate with the network server
106
};
107
108
}
// namespace lorawan
109
110
}
// namespace ns3
111
#endif
/* FORWARDER */
ns3::Address
a polymophic address class
Definition:
address.h:101
ns3::Application
The base class for all ns3 applications.
Definition:
application.h:62
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::lorawan::Forwarder
This application forwards packets between NetDevices: LoraNetDevice -> PointToPointNetDevice and vice...
Definition:
forwarder.h:42
ns3::lorawan::Forwarder::SetPointToPointNetDevice
void SetPointToPointNetDevice(Ptr< PointToPointNetDevice > pointToPointNetDevice)
Sets the P2P device to use to communicate with the network server.
Definition:
forwarder.cc:54
ns3::lorawan::Forwarder::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition:
forwarder.cc:34
ns3::lorawan::Forwarder::Forwarder
Forwarder()
Default constructor.
Definition:
forwarder.cc:43
ns3::lorawan::Forwarder::StopApplication
void StopApplication() override
Stop the application.
Definition:
forwarder.cc:108
ns3::lorawan::Forwarder::StartApplication
void StartApplication() override
Start the application.
Definition:
forwarder.cc:100
ns3::lorawan::Forwarder::m_loraNetDevice
Ptr< LoraNetDevice > m_loraNetDevice
Pointer to the node's LoraNetDevice.
Definition:
forwarder.h:102
ns3::lorawan::Forwarder::ReceiveFromPointToPoint
bool ReceiveFromPointToPoint(Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, const Address &sender)
Receive a packet from the PointToPointNetDevice.
Definition:
forwarder.cc:85
ns3::lorawan::Forwarder::ReceiveFromLora
bool ReceiveFromLora(Ptr< NetDevice > loraNetDevice, Ptr< const Packet > packet, uint16_t protocol, const Address &sender)
Receive a packet from the LoraNetDevice.
Definition:
forwarder.cc:70
ns3::lorawan::Forwarder::SetLoraNetDevice
void SetLoraNetDevice(Ptr< LoraNetDevice > loraNetDevice)
Sets the device to use to communicate with the end devices.
Definition:
forwarder.cc:62
ns3::lorawan::Forwarder::m_pointToPointNetDevice
Ptr< PointToPointNetDevice > m_pointToPointNetDevice
Pointer to the P2PNetDevice we use to communicate with the network server.
Definition:
forwarder.h:104
ns3::lorawan::Forwarder::~Forwarder
~Forwarder() override
Destructor.
Definition:
forwarder.cc:48
lora-net-device.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
lorawan
model
forwarder.h
Generated on Mon Aug 12 2024 11:16:15 for ns-3 by
1.9.6