A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
point-to-point-channel.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007 University of Washington
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*/
18
19
#ifndef POINT_TO_POINT_CHANNEL_H
20
#define POINT_TO_POINT_CHANNEL_H
21
22
#include <list>
23
#include "ns3/channel.h"
24
#include "ns3/ptr.h"
25
#include "ns3/nstime.h"
26
#include "ns3/data-rate.h"
27
#include "ns3/traced-callback.h"
28
29
namespace
ns3 {
30
31
class
PointToPointNetDevice;
32
class
Packet;
33
47
class
PointToPointChannel
:
public
Channel
48
{
49
public
:
50
static
TypeId
GetTypeId
(
void
);
51
58
PointToPointChannel
();
59
64
void
Attach
(
Ptr<PointToPointNetDevice>
device);
65
73
virtual
bool
TransmitStart
(
Ptr<Packet>
p,
Ptr<PointToPointNetDevice>
src,
Time
txTime);
74
79
virtual
uint32_t
GetNDevices
(
void
)
const
;
80
81
/*
82
* \brief Get PointToPointNetDevice corresponding to index i on this channel
83
* \param i Index number of the device requested
84
* \returns Ptr to PointToPointNetDevice requested
85
*/
86
Ptr<PointToPointNetDevice>
GetPointToPointDevice
(uint32_t i)
const
;
87
88
/*
89
* \brief Get NetDevice corresponding to index i on this channel
90
* \param i Index number of the device requested
91
* \returns Ptr to NetDevice requested
92
*/
93
virtual
Ptr<NetDevice>
GetDevice
(uint32_t i)
const
;
94
95
protected
:
96
/*
97
* \brief Get the delay associated with this channel
98
* \returns Time delay
99
*/
100
Time
GetDelay
(
void
)
const
;
101
102
/*
103
* \brief Check to make sure the link is initialized
104
* \returns true if initialized, asserts otherwise
105
*/
106
bool
IsInitialized
(
void
)
const
;
107
108
/*
109
* \brief Get the net-device source
110
* \param i the link requested
111
* \returns Ptr to PointToPointNetDevice source for the
112
* specified link
113
*/
114
Ptr<PointToPointNetDevice>
GetSource
(uint32_t i)
const
;
115
116
/*
117
* \brief Get the net-device destination
118
* \param i the link requested
119
* \returns Ptr to PointToPointNetDevice destination for
120
* the specified link
121
*/
122
Ptr<PointToPointNetDevice>
GetDestination
(uint32_t i)
const
;
123
124
private
:
125
// Each point to point link has exactly two net devices
126
static
const
int
N_DEVICES
= 2;
127
128
Time
m_delay
;
129
int32_t
m_nDevices
;
130
140
TracedCallback<Ptr<const Packet>
,
// Packet being transmitted
141
Ptr<NetDevice>
,
// Transmitting NetDevice
142
Ptr<NetDevice>
,
// Receiving NetDevice
143
Time
,
// Amount of time to transmit the pkt
144
Time
// Last bit receive time (relative to now)
145
>
m_txrxPointToPoint
;
146
147
enum
WireState
148
{
149
INITIALIZING
,
150
IDLE
,
151
TRANSMITTING
,
152
PROPAGATING
153
};
154
155
class
Link
156
{
157
public
:
158
Link
() :
m_state
(
INITIALIZING
),
m_src
(0),
m_dst
(0) {}
159
WireState
m_state
;
160
Ptr<PointToPointNetDevice>
m_src
;
161
Ptr<PointToPointNetDevice>
m_dst
;
162
};
163
164
Link
m_link
[
N_DEVICES
];
165
};
166
167
}
// namespace ns3
168
169
#endif
/* POINT_TO_POINT_CHANNEL_H */
ns3::Time
keep track of time values and allow control of global simulation resolution
Definition:
nstime.h:81
ns3::Ptr
smart pointer class similar to boost::intrusive_ptr
Definition:
ptr.h:59
ns3::PointToPointChannel::m_nDevices
int32_t m_nDevices
Definition:
point-to-point-channel.h:129
ns3::PointToPointChannel::IsInitialized
bool IsInitialized(void) const
Definition:
point-to-point-channel.cc:147
ns3::TracedCallback
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
Definition:
traced-callback.h:43
ns3::PointToPointChannel::m_link
Link m_link[N_DEVICES]
Definition:
point-to-point-channel.h:164
ns3::PointToPointChannel::m_txrxPointToPoint
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...
Definition:
point-to-point-channel.h:145
ns3::PointToPointChannel::GetTypeId
static TypeId GetTypeId(void)
Definition:
point-to-point-channel.cc:34
ns3::Channel
Abstract Channel Base Class.
Definition:
channel.h:43
ns3::PointToPointChannel::Link::m_state
WireState m_state
Definition:
point-to-point-channel.h:159
ns3::PointToPointChannel::WireState
WireState
Definition:
point-to-point-channel.h:147
ns3::PointToPointChannel::GetNDevices
virtual uint32_t GetNDevices(void) const
Get number of devices on this channel.
Definition:
point-to-point-channel.cc:107
ns3::PointToPointChannel::Attach
void Attach(Ptr< PointToPointNetDevice > device)
Attach a given netdevice to this channel.
Definition:
point-to-point-channel.cc:63
ns3::PointToPointChannel::PROPAGATING
Definition:
point-to-point-channel.h:152
ns3::PointToPointChannel::m_delay
Time m_delay
Definition:
point-to-point-channel.h:128
ns3::PointToPointChannel::PointToPointChannel
PointToPointChannel()
Create a PointToPointChannel.
Definition:
point-to-point-channel.cc:53
ns3::PointToPointChannel::Link::m_dst
Ptr< PointToPointNetDevice > m_dst
Definition:
point-to-point-channel.h:161
ns3::PointToPointChannel::GetDelay
Time GetDelay(void) const
Definition:
point-to-point-channel.cc:129
ns3::PointToPointChannel::INITIALIZING
Definition:
point-to-point-channel.h:149
ns3::PointToPointChannel::TRANSMITTING
Definition:
point-to-point-channel.h:151
ns3::PointToPointChannel::GetDevice
virtual Ptr< NetDevice > GetDevice(uint32_t i) const
Definition:
point-to-point-channel.cc:122
ns3::PointToPointChannel::Link::Link
Link()
Definition:
point-to-point-channel.h:158
ns3::PointToPointChannel
Simple Point To Point Channel.
Definition:
point-to-point-channel.h:47
ns3::PointToPointChannel::N_DEVICES
static const int N_DEVICES
Definition:
point-to-point-channel.h:126
ns3::PointToPointChannel::Link::m_src
Ptr< PointToPointNetDevice > m_src
Definition:
point-to-point-channel.h:160
ns3::PointToPointChannel::GetSource
Ptr< PointToPointNetDevice > GetSource(uint32_t i) const
Definition:
point-to-point-channel.cc:135
ns3::PointToPointChannel::IDLE
Definition:
point-to-point-channel.h:150
ns3::PointToPointChannel::TransmitStart
virtual bool TransmitStart(Ptr< Packet > p, Ptr< PointToPointNetDevice > src, Time txTime)
Transmit a packet over this channel.
Definition:
point-to-point-channel.cc:84
ns3::PointToPointChannel::GetDestination
Ptr< PointToPointNetDevice > GetDestination(uint32_t i) const
Definition:
point-to-point-channel.cc:141
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::PointToPointChannel::GetPointToPointDevice
Ptr< PointToPointNetDevice > GetPointToPointDevice(uint32_t i) const
Definition:
point-to-point-channel.cc:114
ns3::PointToPointChannel::Link
Definition:
point-to-point-channel.h:155
src
point-to-point
model
point-to-point-channel.h
Generated on Sat Apr 19 2014 14:07:07 for ns-3 by
1.8.6