A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
point-to-point-channel.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007 University of Washington
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
18#ifndef POINT_TO_POINT_CHANNEL_H
19#define POINT_TO_POINT_CHANNEL_H
20
21#include "ns3/channel.h"
22#include "ns3/data-rate.h"
23#include "ns3/nstime.h"
24#include "ns3/ptr.h"
25#include "ns3/traced-callback.h"
26
27#include <list>
28
29namespace ns3
30{
31
32class PointToPointNetDevice;
33class Packet;
34
52{
53 public:
59 static TypeId GetTypeId();
60
68
74
83
88 std::size_t GetNDevices() const override;
89
96
102 Ptr<NetDevice> GetDevice(std::size_t i) const override;
103
104 protected:
109 Time GetDelay() const;
110
115 bool IsInitialized() const;
116
124
132
145 Ptr<NetDevice> txDevice,
146 Ptr<NetDevice> rxDevice,
147 Time duration,
148 Time lastBitTime);
149
150 private:
152 static const std::size_t N_DEVICES = 2;
153
155 std::size_t m_nDevices;
156
168 TracedCallback<Ptr<const Packet>, // Packet being transmitted
169 Ptr<NetDevice>, // Transmitting NetDevice
170 Ptr<NetDevice>, // Receiving NetDevice
171 Time, // Amount of time to transmit the pkt
172 Time // Last bit receive time (relative to now)
173 >
175
180 {
189 };
190
194 class Link
195 {
196 public:
202 m_src(nullptr),
203 m_dst(nullptr)
204 {
205 }
206
210 };
211
213};
214
215} // namespace ns3
216
217#endif /* POINT_TO_POINT_CHANNEL_H */
Abstract Channel Base Class.
Definition: channel.h:45
Simple Point To Point Channel.
Time GetDelay() const
Get the delay associated with this channel.
static TypeId GetTypeId()
Get the TypeId.
Link m_link[N_DEVICES]
Link model.
std::size_t m_nDevices
Devices of this channel.
void Attach(Ptr< PointToPointNetDevice > device)
Attach a given netdevice to this channel.
Ptr< PointToPointNetDevice > GetSource(uint32_t i) const
Get the net-device source.
std::size_t GetNDevices() const override
Get number of devices on this channel.
Ptr< NetDevice > GetDevice(std::size_t i) const override
Get NetDevice corresponding to index i on this channel.
PointToPointChannel()
Create a PointToPointChannel.
Ptr< PointToPointNetDevice > GetDestination(uint32_t i) const
Get the net-device destination.
@ PROPAGATING
Propagating state (data is being propagated in the channel.
@ TRANSMITTING
Transmitting state (data being transmitted from NetDevice.
@ IDLE
Idle state (no transmission from NetDevice)
@ INITIALIZING
Initializing state.
Ptr< PointToPointNetDevice > GetPointToPointDevice(std::size_t i) const
Get PointToPointNetDevice corresponding to index i on this channel.
bool IsInitialized() const
Check to make sure the link is initialized.
TracedCallback< Ptr< const Packet >, Ptr< NetDevice >, Ptr< NetDevice >, Time, Time > m_txrxPointToPoint
The trace source for the packet transmission animation events that the device can fire.
Time m_delay
Propagation delay.
virtual bool TransmitStart(Ptr< const Packet > p, Ptr< PointToPointNetDevice > src, Time txTime)
Transmit a packet over this channel.
static const std::size_t N_DEVICES
Each point to point link has exactly two net devices.
void(* TxRxAnimationCallback)(Ptr< const Packet > packet, Ptr< NetDevice > txDevice, Ptr< NetDevice > rxDevice, Time duration, Time lastBitTime)
TracedCallback signature for packet transmission animation events.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.