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
mpi-receiver.h
Go to the documentation of this file.
1
/*
2
* SPDX-License-Identifier: GPL-2.0-only
3
*
4
* Author: George Riley <riley@ece.gatech.edu>
5
*/
6
7
/**
8
* \file
9
* \ingroup mpi
10
* ns3::MpiReceiver declaration,
11
* provides an interface to aggregate to MPI-compatible NetDevices.
12
*/
13
14
#ifndef NS3_MPI_RECEIVER_H
15
#define NS3_MPI_RECEIVER_H
16
17
#include "ns3/object.h"
18
#include "ns3/packet.h"
19
20
namespace
ns3
21
{
22
23
/**
24
* \ingroup mpi
25
*
26
* \brief Class to aggregate to a NetDevice if it supports MPI capability
27
*
28
* MpiInterface::ReceiveMessages () needs to send packets to a NetDevice
29
* Receive() method. Since each NetDevice's Receive() method is specific
30
* to the derived class, and since we do not know whether such a NetDevice
31
* is MPI-capable, we aggregate one of these objects to each MPI-capable
32
* device. In addition, we must hook up a NetDevice::Receive() method
33
* to the callback. So the two steps to enable MPI capability are to
34
* aggregate this object to a NetDevice, and to set the callback.
35
*/
36
class
MpiReceiver
:
public
Object
37
{
38
public
:
39
/**
40
* Register this type.
41
* \return The object TypeId.
42
*/
43
static
TypeId
GetTypeId
();
44
~MpiReceiver
()
override
;
45
46
/**
47
* \brief Direct an incoming packet to the device Receive() method
48
* \param p Packet to receive
49
*/
50
void
Receive
(
Ptr<Packet>
p);
51
/**
52
* \brief Set the receive callback to get packets to net devices
53
* \param callback the callback itself
54
*/
55
void
SetReceiveCallback
(
Callback
<
void
,
Ptr<Packet>
> callback);
56
57
private
:
58
void
DoDispose
()
override
;
59
60
/** Callback to send received packets to. */
61
Callback<void, Ptr<Packet>
>
m_rxCallback
;
62
};
63
64
}
// namespace ns3
65
66
#endif
/* NS3_MPI_RECEIVER_H */
ns3::Callback
Callback template class.
Definition
callback.h:422
ns3::MpiReceiver
Class to aggregate to a NetDevice if it supports MPI capability.
Definition
mpi-receiver.h:37
ns3::MpiReceiver::m_rxCallback
Callback< void, Ptr< Packet > > m_rxCallback
Callback to send received packets to.
Definition
mpi-receiver.h:61
ns3::MpiReceiver::Receive
void Receive(Ptr< Packet > p)
Direct an incoming packet to the device Receive() method.
Definition
mpi-receiver.cc:40
ns3::MpiReceiver::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition
mpi-receiver.cc:20
ns3::MpiReceiver::DoDispose
void DoDispose() override
Destructor implementation.
Definition
mpi-receiver.cc:47
ns3::MpiReceiver::~MpiReceiver
~MpiReceiver() override
Definition
mpi-receiver.cc:29
ns3::MpiReceiver::SetReceiveCallback
void SetReceiveCallback(Callback< void, Ptr< Packet > > callback)
Set the receive callback to get packets to net devices.
Definition
mpi-receiver.cc:34
ns3::Object
A base class which provides memory management and object aggregation.
Definition
object.h:78
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
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
mpi
model
mpi-receiver.h
Generated on Fri Nov 8 2024 13:59:04 for ns-3 by
1.11.0