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