A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
error-channel.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2013 Universita' di Firenze, Italy
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
* Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
18
*/
19
#ifndef ERROR_CHANNEL_H
20
#define ERROR_CHANNEL_H
21
22
#include "
error-model.h
"
23
#include "
mac48-address.h
"
24
#include "
simple-channel.h
"
25
26
#include "ns3/channel.h"
27
#include "ns3/nstime.h"
28
29
#include <vector>
30
31
namespace
ns3
32
{
33
34
class
SimpleNetDevice;
35
class
Packet;
36
41
class
ErrorChannel
:
public
SimpleChannel
42
{
43
public
:
48
static
TypeId
GetTypeId
();
49
ErrorChannel
();
50
51
// inherited from ns3::SimpleChannel
52
void
Send
(
Ptr<Packet>
p,
53
uint16_t protocol,
54
Mac48Address
to,
55
Mac48Address
from,
56
Ptr<SimpleNetDevice>
sender)
override
;
57
58
void
Add
(
Ptr<SimpleNetDevice>
device)
override
;
59
60
// inherited from ns3::Channel
61
std::size_t
GetNDevices
()
const override
;
62
Ptr<NetDevice>
GetDevice
(std::size_t i)
const override
;
63
68
void
SetJumpingTime
(
Time
delay);
69
74
void
SetJumpingMode
(
bool
mode);
75
80
void
SetDuplicateTime
(
Time
delay);
81
86
void
SetDuplicateMode
(
bool
mode);
87
88
private
:
89
std::vector<Ptr<SimpleNetDevice>>
m_devices
;
90
Time
m_jumpingTime
;
91
uint8_t
m_jumpingState
;
92
bool
m_jumping
;
93
Time
m_duplicateTime
;
94
bool
m_duplicate
;
95
uint8_t
m_duplicateState
;
96
};
97
98
}
// namespace ns3
99
100
#endif
/* ERROR_CHANNEL_H */
ns3::ErrorChannel
A Error channel, introducing deterministic delays on even/odd packets.
Definition:
error-channel.h:42
ns3::ErrorChannel::m_duplicateTime
Time m_duplicateTime
Duplicate time in Duplicate mode.
Definition:
error-channel.h:93
ns3::ErrorChannel::m_duplicateState
uint8_t m_duplicateState
Counter for even/odd packets in Duplicate mode.
Definition:
error-channel.h:95
ns3::ErrorChannel::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
error-channel.cc:37
ns3::ErrorChannel::GetNDevices
std::size_t GetNDevices() const override
Definition:
error-channel.cc:178
ns3::ErrorChannel::m_jumping
bool m_jumping
Flag for Jumping mode.
Definition:
error-channel.h:92
ns3::ErrorChannel::m_devices
std::vector< Ptr< SimpleNetDevice > > m_devices
devices connected by the channel
Definition:
error-channel.h:89
ns3::ErrorChannel::ErrorChannel
ErrorChannel()
Definition:
error-channel.cc:46
ns3::ErrorChannel::Send
void Send(Ptr< Packet > p, uint16_t protocol, Mac48Address to, Mac48Address from, Ptr< SimpleNetDevice > sender) override
A packet is sent by a net device.
Definition:
error-channel.cc:83
ns3::ErrorChannel::SetJumpingTime
void SetJumpingTime(Time delay)
Set the delay for the odd packets (even ones are not delayed)
Definition:
error-channel.cc:57
ns3::ErrorChannel::SetJumpingMode
void SetJumpingMode(bool mode)
Set if the odd packets are delayed (even ones are not delayed ever)
Definition:
error-channel.cc:63
ns3::ErrorChannel::GetDevice
Ptr< NetDevice > GetDevice(std::size_t i) const override
Definition:
error-channel.cc:184
ns3::ErrorChannel::SetDuplicateMode
void SetDuplicateMode(bool mode)
Set if the odd packets are duplicated (even ones are not duplicated ever)
Definition:
error-channel.cc:76
ns3::ErrorChannel::m_jumpingTime
Time m_jumpingTime
Delay time in Jumping mode.
Definition:
error-channel.h:90
ns3::ErrorChannel::Add
void Add(Ptr< SimpleNetDevice > device) override
Attached a net device to the channel.
Definition:
error-channel.cc:172
ns3::ErrorChannel::SetDuplicateTime
void SetDuplicateTime(Time delay)
Set the delay for the odd duplicate packets (even ones are not duplicated)
Definition:
error-channel.cc:70
ns3::ErrorChannel::m_jumpingState
uint8_t m_jumpingState
Counter for even/odd packets in Jumping mode.
Definition:
error-channel.h:91
ns3::ErrorChannel::m_duplicate
bool m_duplicate
Flag for Duplicate mode.
Definition:
error-channel.h:94
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:46
ns3::Ptr< Packet >
ns3::SimpleChannel
A simple channel, for simple things and testing.
Definition:
simple-channel.h:49
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
error-model.h
mac48-address.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
simple-channel.h
src
network
utils
error-channel.h
Generated on Sun Mar 3 2024 17:11:06 for ns-3 by
1.9.1