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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Davide Magrin <magrinda@dei.unipd.it>
7
*/
8
9
#ifndef FORWARDER_H
10
#define FORWARDER_H
11
12
#include "
lora-net-device.h
"
13
14
#include "ns3/application.h"
15
#include "ns3/attribute.h"
16
#include "ns3/nstime.h"
17
#include "ns3/point-to-point-net-device.h"
18
19
namespace
ns3
20
{
21
namespace
lorawan
22
{
23
24
/**
25
* \ingroup lorawan
26
*
27
* This application forwards packets between NetDevices:
28
* LoraNetDevice -> PointToPointNetDevice and vice versa.
29
*/
30
class
Forwarder
:
public
Application
31
{
32
public
:
33
Forwarder
();
//!< Default constructor
34
~Forwarder
()
override
;
//!< Destructor
35
36
/**
37
* Register this type.
38
* \return The object TypeId.
39
*/
40
static
TypeId
GetTypeId
();
41
42
/**
43
* Sets the device to use to communicate with the end devices.
44
*
45
* \param loraNetDevice The LoraNetDevice on this node.
46
*/
47
void
SetLoraNetDevice
(
Ptr<LoraNetDevice>
loraNetDevice);
48
49
/**
50
* Sets the P2P device to use to communicate with the network server.
51
*
52
* \param pointToPointNetDevice The P2PNetDevice on this node.
53
*/
54
void
SetPointToPointNetDevice
(
Ptr<PointToPointNetDevice>
pointToPointNetDevice);
55
56
/**
57
* Receive a packet from the LoraNetDevice.
58
*
59
* \param loraNetDevice The LoraNetDevice we received the packet from.
60
* \param packet The packet we received.
61
* \param protocol The protocol number associated to this packet.
62
* \param sender The address of the sender.
63
* \return True if we can handle the packet, false otherwise.
64
*/
65
bool
ReceiveFromLora
(
Ptr<NetDevice>
loraNetDevice,
66
Ptr<const Packet>
packet,
67
uint16_t protocol,
68
const
Address
& sender);
69
70
/**
71
* Receive a packet from the PointToPointNetDevice.
72
*
73
* \copydoc ns3::NetDevice::ReceiveCallback
74
*/
75
bool
ReceiveFromPointToPoint
(
Ptr<NetDevice>
device,
76
Ptr<const Packet>
packet,
77
uint16_t protocol,
78
const
Address
& sender);
79
80
/**
81
* Start the application.
82
*/
83
void
StartApplication
()
override
;
84
85
/**
86
* Stop the application.
87
*/
88
void
StopApplication
()
override
;
89
90
private
:
91
Ptr<LoraNetDevice>
m_loraNetDevice
;
//!< Pointer to the node's LoraNetDevice
92
93
Ptr<PointToPointNetDevice>
m_pointToPointNetDevice
;
//!< Pointer to the P2PNetDevice we use to
94
//!< communicate with the network server
95
};
96
97
}
// namespace lorawan
98
99
}
// namespace ns3
100
#endif
/* FORWARDER */
ns3::Address
a polymophic address class
Definition
address.h:90
ns3::Application
The base class for all ns3 applications.
Definition
application.h:51
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::lorawan::Forwarder
This application forwards packets between NetDevices: LoraNetDevice -> PointToPointNetDevice and vice...
Definition
forwarder.h:31
ns3::lorawan::Forwarder::SetPointToPointNetDevice
void SetPointToPointNetDevice(Ptr< PointToPointNetDevice > pointToPointNetDevice)
Sets the P2P device to use to communicate with the network server.
Definition
forwarder.cc:43
ns3::lorawan::Forwarder::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition
forwarder.cc:23
ns3::lorawan::Forwarder::Forwarder
Forwarder()
Default constructor.
Definition
forwarder.cc:32
ns3::lorawan::Forwarder::StopApplication
void StopApplication() override
Stop the application.
Definition
forwarder.cc:97
ns3::lorawan::Forwarder::StartApplication
void StartApplication() override
Start the application.
Definition
forwarder.cc:89
ns3::lorawan::Forwarder::m_loraNetDevice
Ptr< LoraNetDevice > m_loraNetDevice
Pointer to the node's LoraNetDevice.
Definition
forwarder.h:91
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:74
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:59
ns3::lorawan::Forwarder::SetLoraNetDevice
void SetLoraNetDevice(Ptr< LoraNetDevice > loraNetDevice)
Sets the device to use to communicate with the end devices.
Definition
forwarder.cc:51
ns3::lorawan::Forwarder::m_pointToPointNetDevice
Ptr< PointToPointNetDevice > m_pointToPointNetDevice
Pointer to the P2PNetDevice we use to communicate with the network server.
Definition
forwarder.h:93
ns3::lorawan::Forwarder::~Forwarder
~Forwarder() override
Destructor.
Definition
forwarder.cc:37
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 Fri Nov 8 2024 13:59:02 for ns-3 by
1.11.0