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
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
error-channel.h
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/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
ErrorNetDevice;
32
class
Packet;
33
38
class
ErrorChannel
:
public
Channel
39
{
40
public
:
41
static
TypeId
GetTypeId (
void
);
42
ErrorChannel
();
43
44
void
Send (
Ptr<Packet>
p, uint16_t protocol,
Mac48Address
to,
Mac48Address
from,
45
Ptr<ErrorNetDevice>
sender);
46
47
void
Add (
Ptr<ErrorNetDevice>
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<ErrorNetDevice> > 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::Time
keep track of time unit.
Definition:
nstime.h:149
ns3::Ptr< Packet >
ns3::Channel
Abstract Channel Base Class.
Definition:
channel.h:43
ns3::ErrorModel
General error model that can be used to corrupt packets.
Definition:
error-model.h:115
ns3::ErrorChannel::SetJumpingMode
void SetJumpingMode(bool mode)
Set if the odd packets are delayed (even ones are not delayed ever)
Definition:
error-channel.cc:56
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. Used for testing.
Definition:
error-channel.h:38
ns3::ErrorChannel::SetJumpingTime
void SetJumpingTime(Time delay)
Set the delay for the odd packets (even ones are not delayed)
Definition:
error-channel.cc:50
ns3::ErrorChannel::GetNDevices
virtual uint32_t GetNDevices(void) const
Definition:
error-channel.cc:97
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:44
ns3::ErrorChannel::GetDevice
virtual Ptr< NetDevice > GetDevice(uint32_t i) const
Definition:
error-channel.cc:102
src
internet
test
error-channel.h
Generated on Sun Mar 16 2014 11:25:05 for ns-3 by
1.8.6