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
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 "ns3/channel.h"
23
#include "ns3/error-model.h"
24
#include "ns3/mac48-address.h"
25
#include "ns3/nstime.h"
26
#include "ns3/simple-channel.h"
27
28
#include <vector>
29
30
namespace
ns3
31
{
32
33
class
SimpleNetDevice;
34
class
Packet;
35
40
class
ErrorChannel
:
public
SimpleChannel
41
{
42
public
:
47
static
TypeId
GetTypeId
();
48
ErrorChannel
();
49
50
// inherited from ns3::SimpleChannel
51
void
Send
(
Ptr<Packet>
p,
52
uint16_t protocol,
53
Mac48Address
to,
54
Mac48Address
from,
55
Ptr<SimpleNetDevice>
sender)
override
;
56
57
void
Add
(
Ptr<SimpleNetDevice>
device)
override
;
58
59
// inherited from ns3::Channel
60
std::size_t
GetNDevices
()
const override
;
61
Ptr<NetDevice>
GetDevice
(std::size_t i)
const override
;
62
67
void
SetJumpingTime
(
Time
delay);
68
73
void
SetJumpingMode
(
bool
mode);
74
79
void
SetDuplicateTime
(
Time
delay);
80
85
void
SetDuplicateMode
(
bool
mode);
86
87
private
:
88
std::vector<Ptr<SimpleNetDevice>>
m_devices
;
89
Time
m_jumpingTime
;
90
uint8_t
m_jumpingState
;
91
bool
m_jumping
;
92
Time
m_duplicateTime
;
93
bool
m_duplicate
;
94
uint8_t
m_duplicateState
;
95
};
96
97
}
// namespace ns3
98
99
#endif
/* ERROR_CHANNEL_H */
ns3::ErrorChannel
A Error channel, introducing deterministic delays on even/odd packets.
Definition:
error-channel.h:41
ns3::ErrorChannel::m_duplicateTime
Time m_duplicateTime
Duplicate time in Duplicate mode.
Definition:
error-channel.h:92
ns3::ErrorChannel::m_duplicateState
uint8_t m_duplicateState
Counter for even/odd packets in Duplicate mode.
Definition:
error-channel.h:94
ns3::ErrorChannel::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
error-channel.cc:36
ns3::ErrorChannel::GetNDevices
std::size_t GetNDevices() const override
Definition:
error-channel.cc:179
ns3::ErrorChannel::m_jumping
bool m_jumping
Flag for Jumping mode.
Definition:
error-channel.h:91
ns3::ErrorChannel::m_devices
std::vector< Ptr< SimpleNetDevice > > m_devices
devices connected by the channel
Definition:
error-channel.h:88
ns3::ErrorChannel::ErrorChannel
ErrorChannel()
Definition:
error-channel.cc:45
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:82
ns3::ErrorChannel::SetJumpingTime
void SetJumpingTime(Time delay)
Set the delay for the odd packets (even ones are not delayed)
Definition:
error-channel.cc:56
ns3::ErrorChannel::SetJumpingMode
void SetJumpingMode(bool mode)
Set if the odd packets are delayed (even ones are not delayed ever)
Definition:
error-channel.cc:62
ns3::ErrorChannel::GetDevice
Ptr< NetDevice > GetDevice(std::size_t i) const override
Definition:
error-channel.cc:185
ns3::ErrorChannel::SetDuplicateMode
void SetDuplicateMode(bool mode)
Set if the odd packets are duplicated (even ones are not duplicated ever)
Definition:
error-channel.cc:75
ns3::ErrorChannel::m_jumpingTime
Time m_jumpingTime
Delay time in Jumping mode.
Definition:
error-channel.h:89
ns3::ErrorChannel::Add
void Add(Ptr< SimpleNetDevice > device) override
Attached a net device to the channel.
Definition:
error-channel.cc:173
ns3::ErrorChannel::SetDuplicateTime
void SetDuplicateTime(Time delay)
Set the delay for the odd duplicate packets (even ones are not duplicated)
Definition:
error-channel.cc:69
ns3::ErrorChannel::m_jumpingState
uint8_t m_jumpingState
Counter for even/odd packets in Jumping mode.
Definition:
error-channel.h:90
ns3::ErrorChannel::m_duplicate
bool m_duplicate
Flag for Duplicate mode.
Definition:
error-channel.h:93
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:46
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:78
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
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
network
utils
error-channel.h
Generated on Sun Jul 2 2023 18:21:58 for ns-3 by
1.9.6