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
point-to-point-remote-channel.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007, 2008 University of Washington
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: George Riley <riley@ece.gatech.edu>
7
*/
8
9
#include "
point-to-point-remote-channel.h
"
10
11
#include "
point-to-point-net-device.h
"
12
13
#include "ns3/log.h"
14
#include "ns3/mpi-interface.h"
15
#include "ns3/packet.h"
16
#include "ns3/simulator.h"
17
18
#include <iostream>
19
20
namespace
ns3
21
{
22
23
NS_LOG_COMPONENT_DEFINE
(
"PointToPointRemoteChannel"
);
24
25
NS_OBJECT_ENSURE_REGISTERED
(PointToPointRemoteChannel);
26
27
TypeId
28
PointToPointRemoteChannel::GetTypeId
()
29
{
30
static
TypeId
tid =
TypeId
(
"ns3::PointToPointRemoteChannel"
)
31
.
SetParent
<
PointToPointChannel
>()
32
.SetGroupName(
"PointToPoint"
)
33
.AddConstructor<
PointToPointRemoteChannel
>();
34
return
tid;
35
}
36
37
PointToPointRemoteChannel::PointToPointRemoteChannel
()
38
:
PointToPointChannel
()
39
{
40
}
41
42
PointToPointRemoteChannel::~PointToPointRemoteChannel
()
43
{
44
}
45
46
bool
47
PointToPointRemoteChannel::TransmitStart
(
Ptr<const Packet>
p,
48
Ptr<PointToPointNetDevice>
src,
49
Time
txTime)
50
{
51
NS_LOG_FUNCTION
(
this
<< p << src);
52
NS_LOG_LOGIC
(
"UID is "
<< p->GetUid() <<
")"
);
53
54
IsInitialized
();
55
56
uint32_t
wire = src ==
GetSource
(0) ? 0 : 1;
57
Ptr<PointToPointNetDevice>
dst =
GetDestination
(wire);
58
59
// Calculate the rxTime (absolute)
60
Time
rxTime =
Simulator::Now
() + txTime +
GetDelay
();
61
MpiInterface::SendPacket
(p->Copy(), rxTime, dst->GetNode()->GetId(), dst->GetIfIndex());
62
return
true
;
63
}
64
65
}
// namespace ns3
ns3::MpiInterface::SendPacket
static void SendPacket(Ptr< Packet > p, const Time &rxTime, uint32_t node, uint32_t dev)
Send a packet to a remote node.
Definition
mpi-interface.cc:128
ns3::PointToPointChannel
Simple Point To Point Channel.
Definition
point-to-point-channel.h:41
ns3::PointToPointChannel::GetDelay
Time GetDelay() const
Get the delay associated with this channel.
Definition
point-to-point-channel.cc:122
ns3::PointToPointChannel::GetSource
Ptr< PointToPointNetDevice > GetSource(uint32_t i) const
Get the net-device source.
Definition
point-to-point-channel.cc:128
ns3::PointToPointChannel::GetDestination
Ptr< PointToPointNetDevice > GetDestination(uint32_t i) const
Get the net-device destination.
Definition
point-to-point-channel.cc:134
ns3::PointToPointChannel::IsInitialized
bool IsInitialized() const
Check to make sure the link is initialized.
Definition
point-to-point-channel.cc:140
ns3::PointToPointRemoteChannel
A Remote Point-To-Point Channel.
Definition
point-to-point-remote-channel.h:31
ns3::PointToPointRemoteChannel::TransmitStart
bool TransmitStart(Ptr< const Packet > p, Ptr< PointToPointNetDevice > src, Time txTime) override
Transmit the packet.
Definition
point-to-point-remote-channel.cc:47
ns3::PointToPointRemoteChannel::~PointToPointRemoteChannel
~PointToPointRemoteChannel() override
Deconstructor.
Definition
point-to-point-remote-channel.cc:42
ns3::PointToPointRemoteChannel::GetTypeId
static TypeId GetTypeId()
Get the TypeId.
Definition
point-to-point-remote-channel.cc:28
ns3::PointToPointRemoteChannel::PointToPointRemoteChannel
PointToPointRemoteChannel()
Constructor.
Definition
point-to-point-remote-channel.cc:37
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::Simulator::Now
static Time Now()
Return the current simulation virtual time.
Definition
simulator.cc:197
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
uint32_t
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition
log.h:271
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition
log-macros-enabled.h:229
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
point-to-point-net-device.h
point-to-point-remote-channel.h
src
point-to-point
model
point-to-point-remote-channel.cc
Generated on Fri Nov 8 2024 13:59:05 for ns-3 by
1.11.0