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/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 */
src
internet
test
error-channel.h
Generated on Tue Nov 13 2012 10:32:16 for ns-3 by
1.8.1.2