A Discrete-Event Network Simulator
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
10
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
20namespace ns3
21{
22
23NS_LOG_COMPONENT_DEFINE("PointToPointRemoteChannel");
24
25NS_OBJECT_ENSURE_REGISTERED(PointToPointRemoteChannel);
26
27TypeId
29{
30 static TypeId tid = TypeId("ns3::PointToPointRemoteChannel")
32 .SetGroupName("PointToPoint")
33 .AddConstructor<PointToPointRemoteChannel>();
34 return tid;
35}
36
41
45
46bool
49 Time txTime)
50{
51 NS_LOG_FUNCTION(this << p << src);
52 NS_LOG_LOGIC("UID is " << p->GetUid() << ")");
53
55
56 uint32_t wire = src == GetSource(0) ? 0 : 1;
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
static void SendPacket(Ptr< Packet > p, const Time &rxTime, uint32_t node, uint32_t dev)
Send a packet to a remote node.
Simple Point To Point Channel.
Time GetDelay() const
Get the delay associated with this channel.
Ptr< PointToPointNetDevice > GetSource(uint32_t i) const
Get the net-device source.
Ptr< PointToPointNetDevice > GetDestination(uint32_t i) const
Get the net-device destination.
bool IsInitialized() const
Check to make sure the link is initialized.
A Remote Point-To-Point Channel.
bool TransmitStart(Ptr< const Packet > p, Ptr< PointToPointNetDevice > src, Time txTime) override
Transmit the packet.
~PointToPointRemoteChannel() override
Deconstructor.
static TypeId GetTypeId()
Get the TypeId.
Smart pointer class similar to boost::intrusive_ptr.
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.