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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
7
*/
8
#ifndef ERROR_CHANNEL_H
9
#define ERROR_CHANNEL_H
10
11
#include "
error-model.h
"
12
#include "
mac48-address.h
"
13
#include "
simple-channel.h
"
14
15
#include "ns3/channel.h"
16
#include "ns3/nstime.h"
17
18
#include <vector>
19
20
namespace
ns3
21
{
22
23
class
SimpleNetDevice;
24
class
Packet;
25
26
/**
27
* \ingroup channel
28
* \brief A Error channel, introducing deterministic delays on even/odd packets. Used for testing
29
*/
30
class
ErrorChannel
:
public
SimpleChannel
31
{
32
public
:
33
/**
34
* \brief Get the type ID.
35
* \return the object TypeId
36
*/
37
static
TypeId
GetTypeId
();
38
ErrorChannel
();
39
40
// inherited from ns3::SimpleChannel
41
void
Send
(
Ptr<Packet>
p,
42
uint16_t protocol,
43
Mac48Address
to,
44
Mac48Address
from,
45
Ptr<SimpleNetDevice>
sender)
override
;
46
47
void
Add
(
Ptr<SimpleNetDevice>
device)
override
;
48
49
// inherited from ns3::Channel
50
std::size_t
GetNDevices
()
const override
;
51
Ptr<NetDevice>
GetDevice
(std::size_t i)
const override
;
52
53
/**
54
* \brief Set the delay for the odd packets (even ones are not delayed)
55
* \param delay Delay for the odd packets.
56
*/
57
void
SetJumpingTime
(
Time
delay);
58
59
/**
60
* \brief Set if the odd packets are delayed (even ones are not delayed ever)
61
* \param mode true if the odd packets should be delayed.
62
*/
63
void
SetJumpingMode
(
bool
mode);
64
65
/**
66
* \brief Set the delay for the odd duplicate packets (even ones are not duplicated)
67
* \param delay Delay for the odd packets.
68
*/
69
void
SetDuplicateTime
(
Time
delay);
70
71
/**
72
* \brief Set if the odd packets are duplicated (even ones are not duplicated ever)
73
* \param mode true if the odd packets should be duplicated.
74
*/
75
void
SetDuplicateMode
(
bool
mode);
76
77
private
:
78
std::vector<Ptr<SimpleNetDevice>>
m_devices
;
//!< devices connected by the channel
79
Time
m_jumpingTime
;
//!< Delay time in Jumping mode.
80
uint8_t
m_jumpingState
;
//!< Counter for even/odd packets in Jumping mode.
81
bool
m_jumping
;
//!< Flag for Jumping mode.
82
Time
m_duplicateTime
;
//!< Duplicate time in Duplicate mode.
83
bool
m_duplicate
;
//!< Flag for Duplicate mode.
84
uint8_t
m_duplicateState
;
//!< Counter for even/odd packets in Duplicate mode.
85
};
86
87
}
// namespace ns3
88
89
#endif
/* ERROR_CHANNEL_H */
ns3::ErrorChannel
A Error channel, introducing deterministic delays on even/odd packets.
Definition
error-channel.h:31
ns3::ErrorChannel::m_duplicateTime
Time m_duplicateTime
Duplicate time in Duplicate mode.
Definition
error-channel.h:82
ns3::ErrorChannel::m_duplicateState
uint8_t m_duplicateState
Counter for even/odd packets in Duplicate mode.
Definition
error-channel.h:84
ns3::ErrorChannel::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
error-channel.cc:26
ns3::ErrorChannel::GetNDevices
std::size_t GetNDevices() const override
Definition
error-channel.cc:167
ns3::ErrorChannel::m_jumping
bool m_jumping
Flag for Jumping mode.
Definition
error-channel.h:81
ns3::ErrorChannel::m_devices
std::vector< Ptr< SimpleNetDevice > > m_devices
devices connected by the channel
Definition
error-channel.h:78
ns3::ErrorChannel::ErrorChannel
ErrorChannel()
Definition
error-channel.cc:35
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:72
ns3::ErrorChannel::SetJumpingTime
void SetJumpingTime(Time delay)
Set the delay for the odd packets (even ones are not delayed)
Definition
error-channel.cc:46
ns3::ErrorChannel::SetJumpingMode
void SetJumpingMode(bool mode)
Set if the odd packets are delayed (even ones are not delayed ever)
Definition
error-channel.cc:52
ns3::ErrorChannel::GetDevice
Ptr< NetDevice > GetDevice(std::size_t i) const override
Definition
error-channel.cc:173
ns3::ErrorChannel::SetDuplicateMode
void SetDuplicateMode(bool mode)
Set if the odd packets are duplicated (even ones are not duplicated ever)
Definition
error-channel.cc:65
ns3::ErrorChannel::m_jumpingTime
Time m_jumpingTime
Delay time in Jumping mode.
Definition
error-channel.h:79
ns3::ErrorChannel::Add
void Add(Ptr< SimpleNetDevice > device) override
Attached a net device to the channel.
Definition
error-channel.cc:161
ns3::ErrorChannel::SetDuplicateTime
void SetDuplicateTime(Time delay)
Set the delay for the odd duplicate packets (even ones are not duplicated)
Definition
error-channel.cc:59
ns3::ErrorChannel::m_jumpingState
uint8_t m_jumpingState
Counter for even/odd packets in Jumping mode.
Definition
error-channel.h:80
ns3::ErrorChannel::m_duplicate
bool m_duplicate
Flag for Duplicate mode.
Definition
error-channel.h:83
ns3::Mac48Address
an EUI-48 address
Definition
mac48-address.h:35
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::SimpleChannel
A simple channel, for simple things and testing.
Definition
simple-channel.h:38
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
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 Fri Nov 8 2024 13:59:05 for ns-3 by
1.11.0