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
error-channel.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011 Universita' di Firenze, Italy
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
* Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
19
*/
20
#ifndef ERROR_CHANNEL_H
21
#define ERROR_CHANNEL_H
22
23
#include "ns3/simple-channel.h"
24
#include "ns3/error-model.h"
25
#include "ns3/mac48-address.h"
26
#include "ns3/nstime.h"
27
#include <vector>
28
29
namespace
ns3 {
30
31
class
SimpleNetDevice;
32
class
Packet;
33
38
class
ErrorChannel
:
public
SimpleChannel
39
{
40
public
:
41
static
TypeId
GetTypeId
(
void
);
42
ErrorChannel
();
43
44
virtual
void
Send
(
Ptr<Packet>
p, uint16_t protocol,
Mac48Address
to,
Mac48Address
from,
45
Ptr<SimpleNetDevice>
sender);
46
47
virtual
void
Add
(
Ptr<SimpleNetDevice>
device);
48
49
// inherited from ns3::Channel
50
virtual
uint32_t
GetNDevices
(
void
)
const
;
51
virtual
Ptr<NetDevice>
GetDevice
(uint32_t i)
const
;
52
57
void
SetJumpingTime
(
Time
delay);
58
63
void
SetJumpingMode
(
bool
mode);
64
65
private
:
66
std::vector<Ptr<SimpleNetDevice> >
m_devices
;
67
Time
jumpingTime
;
68
uint8_t
jumpingState
;
69
bool
jumping
;
70
71
};
72
73
class
BinaryErrorModel
:
public
ErrorModel
74
{
75
public
:
76
static
TypeId
GetTypeId
(
void
);
77
78
BinaryErrorModel
();
79
virtual
~BinaryErrorModel
();
80
void
Reset
(
void
);
81
82
private
:
83
virtual
bool
DoCorrupt
(
Ptr<Packet>
p);
84
virtual
void
DoReset
(
void
);
85
86
uint8_t
counter
;
87
88
};
89
90
}
// namespace ns3
91
92
#endif
/* ERROR_CHANNEL_H */
ns3::BinaryErrorModel::DoCorrupt
virtual bool DoCorrupt(Ptr< Packet > p)
Definition:
error-channel.cc:131
ns3::Time
keep track of time values and allow control of global simulation resolution
Definition:
nstime.h:81
ns3::Ptr< Packet >
ns3::ErrorChannel::ErrorChannel
ErrorChannel()
Definition:
error-channel.cc:44
ns3::ErrorChannel::m_devices
std::vector< Ptr< SimpleNetDevice > > m_devices
Definition:
error-channel.h:66
ns3::BinaryErrorModel::Reset
void Reset(void)
Definition:
error-channel.cc:143
ns3::BinaryErrorModel::GetTypeId
static TypeId GetTypeId(void)
Definition:
error-channel.cc:111
ns3::ErrorChannel::jumping
bool jumping
Definition:
error-channel.h:69
ns3::ErrorModel
General error model that can be used to corrupt packets.
Definition:
error-model.h:115
ns3::BinaryErrorModel::~BinaryErrorModel
virtual ~BinaryErrorModel()
Definition:
error-channel.cc:125
ns3::BinaryErrorModel::DoReset
virtual void DoReset(void)
Definition:
error-channel.cc:149
ns3::ErrorChannel::jumpingTime
Time jumpingTime
Definition:
error-channel.h:67
ns3::ErrorChannel::GetTypeId
static TypeId GetTypeId(void)
Definition:
error-channel.cc:35
ns3::ErrorChannel::SetJumpingMode
void SetJumpingMode(bool mode)
Set if the odd packets are delayed (even ones are not delayed ever)
Definition:
error-channel.cc:57
ns3::BinaryErrorModel::counter
uint8_t counter
Definition:
error-channel.h:86
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:41
ns3::BinaryErrorModel
Definition:
error-channel.h:73
ns3::ErrorChannel
A Error channel, introducing deterministic delays on even/odd packets.
Definition:
error-channel.h:38
ns3::SimpleChannel
A simple channel, for simple things and testing.
Definition:
simple-channel.h:36
ns3::ErrorChannel::jumpingState
uint8_t jumpingState
Definition:
error-channel.h:68
ns3::ErrorChannel::SetJumpingTime
void SetJumpingTime(Time delay)
Set the delay for the odd packets (even ones are not delayed)
Definition:
error-channel.cc:51
ns3::ErrorChannel::Add
virtual void Add(Ptr< SimpleNetDevice > device)
Attached a net device to the channel.
Definition:
error-channel.cc:92
ns3::ErrorChannel::Send
virtual void Send(Ptr< Packet > p, uint16_t protocol, Mac48Address to, Mac48Address from, Ptr< SimpleNetDevice > sender)
A packet is sent by a net device.
Definition:
error-channel.cc:64
ns3::ErrorChannel::GetNDevices
virtual uint32_t GetNDevices(void) const
Definition:
error-channel.cc:98
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::BinaryErrorModel::BinaryErrorModel
BinaryErrorModel()
Definition:
error-channel.cc:120
ns3::ErrorChannel::GetDevice
virtual Ptr< NetDevice > GetDevice(uint32_t i) const
Definition:
error-channel.cc:103
src
internet
test
error-channel.h
Generated on Sat Apr 19 2014 14:06:58 for ns-3 by
1.8.6