This documentation is not the
Latest Release
.
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
tcp-error-model.h
Go to the documentation of this file.
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2015 Natale Patriciello <natale.patriciello@gmail.com>
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
*/
19
#ifndef TCPERRORCHANNEL_H
20
#define TCPERRORCHANNEL_H
21
22
#include "ns3/error-model.h"
23
#include "ns3/tcp-header.h"
24
#include "ns3/ipv4-header.h"
25
26
namespace
ns3
{
27
35
class
TcpGeneralErrorModel
:
public
ErrorModel
36
{
37
public
:
38
static
TypeId
GetTypeId
(
void
);
39
TcpGeneralErrorModel
();
40
41
void
SetDropCallback
(
Callback<void, const Ipv4Header&, const TcpHeader&>
cb)
42
{
43
m_dropCallback
= cb;
44
}
45
46
protected
:
47
virtual
bool
ShouldDrop
(
const
Ipv4Header
&ipHeader,
const
TcpHeader
&tcpHeader,
48
uint32_t
packetSize
) = 0;
49
50
51
private
:
52
virtual
bool
DoCorrupt
(
Ptr<Packet>
p);
53
Callback<void, const Ipv4Header&, const TcpHeader&>
m_dropCallback
;
54
};
55
61
class
TcpSeqErrorModel
:
public
TcpGeneralErrorModel
62
{
63
public
:
64
static
TypeId
GetTypeId
(
void
);
65
TcpSeqErrorModel
() :
TcpGeneralErrorModel
() { }
66
75
void
AddSeqToKill
(
const
SequenceNumber32
&seq)
76
{
77
m_seqToKill
.insert(
m_seqToKill
.end(), seq);
78
}
79
80
protected
:
81
virtual
bool
ShouldDrop
(
const
Ipv4Header
&ipHeader,
const
TcpHeader
&tcpHeader,
82
uint32_t
packetSize
);
83
84
protected
:
85
std::list<SequenceNumber32>
m_seqToKill
;
86
87
private
:
88
virtual
void
DoReset
(
void
);
89
};
90
101
class
TcpFlagErrorModel
:
public
TcpGeneralErrorModel
102
{
103
public
:
104
static
TypeId
GetTypeId
(
void
);
105
TcpFlagErrorModel
();
106
112
void
SetFlagToKill
(
TcpHeader::Flags_t
flags)
113
{
114
m_flagsToKill
= flags;
115
}
116
128
void
SetKillRepeat
(
int
killNumber)
129
{
130
m_killNumber
= killNumber;
131
}
132
133
protected
:
134
virtual
bool
ShouldDrop
(
const
Ipv4Header
&ipHeader,
const
TcpHeader
&tcpHeader,
135
uint32_t
packetSize
);
136
137
protected
:
138
TcpHeader::Flags_t
m_flagsToKill
;
139
int
m_killNumber
;
140
141
private
:
142
virtual
void
DoReset
(
void
);
143
};
144
145
}
// namespace ns3
146
147
#endif // TCPERRORCHANNEL_H
ns3::TcpSeqErrorModel::DoReset
virtual void DoReset(void)
Re-initialize any state.
Definition:
tcp-error-model.cc:109
ns3::TcpFlagErrorModel::GetTypeId
static TypeId GetTypeId(void)
Definition:
tcp-error-model.cc:117
ns3::Ptr< Packet >
ns3::Callback
Callback template class.
Definition:
callback.h:1164
ns3::TcpFlagErrorModel::m_killNumber
int m_killNumber
Definition:
tcp-error-model.h:139
ns3::TcpGeneralErrorModel
A general (TCP-aware) error model.
Definition:
tcp-error-model.h:35
ns3::ErrorModel
General error model that can be used to corrupt packets.
Definition:
error-model.h:115
ns3::TcpSeqErrorModel
An error model TCP aware: it drops the sequence number declared.
Definition:
tcp-error-model.h:61
ns3::Ipv4Header
Packet header for IPv4.
Definition:
ipv4-header.h:31
ns3::TcpFlagErrorModel::SetKillRepeat
void SetKillRepeat(int killNumber)
Set how many packets should be killed.
Definition:
tcp-error-model.h:128
ns3::TcpGeneralErrorModel::TcpGeneralErrorModel
TcpGeneralErrorModel()
Definition:
tcp-error-model.cc:38
ns3::TcpHeader::Flags_t
Flags_t
TCP flag field values.
Definition:
tcp-header.h:259
ns3::TcpFlagErrorModel::m_flagsToKill
TcpHeader::Flags_t m_flagsToKill
Definition:
tcp-error-model.h:138
ns3::TcpGeneralErrorModel::GetTypeId
static TypeId GetTypeId(void)
Definition:
tcp-error-model.cc:30
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::SequenceNumber< uint32_t, int32_t >
ns3::TcpHeader
Header for the Transmission Control Protocol.
Definition:
tcp-header.h:44
ns3::TcpFlagErrorModel::ShouldDrop
virtual bool ShouldDrop(const Ipv4Header &ipHeader, const TcpHeader &tcpHeader, uint32_t packetSize)
Definition:
tcp-error-model.cc:134
ns3::TcpSeqErrorModel::AddSeqToKill
void AddSeqToKill(const SequenceNumber32 &seq)
Add the sequence number to the list of segments to be killed.
Definition:
tcp-error-model.h:75
ns3::TcpGeneralErrorModel::m_dropCallback
Callback< void, const Ipv4Header &, const TcpHeader & > m_dropCallback
Definition:
tcp-error-model.h:53
ns3::TcpSeqErrorModel::m_seqToKill
std::list< SequenceNumber32 > m_seqToKill
Definition:
tcp-error-model.h:85
ns3::TcpGeneralErrorModel::SetDropCallback
void SetDropCallback(Callback< void, const Ipv4Header &, const TcpHeader & > cb)
Definition:
tcp-error-model.h:41
ns3::TcpSeqErrorModel::GetTypeId
static TypeId GetTypeId(void)
Definition:
tcp-error-model.cc:75
ns3::TcpFlagErrorModel
Error model which drop packets with specified TCP flags.
Definition:
tcp-error-model.h:101
ns3::TcpFlagErrorModel::TcpFlagErrorModel
TcpFlagErrorModel()
Definition:
tcp-error-model.cc:126
ns3::TcpGeneralErrorModel::DoCorrupt
virtual bool DoCorrupt(Ptr< Packet > p)
Corrupt a packet according to the specified model.
Definition:
tcp-error-model.cc:44
packetSize
static const uint32_t packetSize
Definition:
power-adaptation-distance.cc:107
ns3::TcpSeqErrorModel::ShouldDrop
virtual bool ShouldDrop(const Ipv4Header &ipHeader, const TcpHeader &tcpHeader, uint32_t packetSize)
Definition:
tcp-error-model.cc:85
ns3::TcpFlagErrorModel::DoReset
virtual void DoReset(void)
Re-initialize any state.
Definition:
tcp-error-model.cc:163
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::TcpSeqErrorModel::TcpSeqErrorModel
TcpSeqErrorModel()
Definition:
tcp-error-model.h:65
ns3::TcpFlagErrorModel::SetFlagToKill
void SetFlagToKill(TcpHeader::Flags_t flags)
Set the flags of the segment that should be killed.
Definition:
tcp-error-model.h:112
ns3::TcpGeneralErrorModel::ShouldDrop
virtual bool ShouldDrop(const Ipv4Header &ipHeader, const TcpHeader &tcpHeader, uint32_t packetSize)=0
src
internet
test
tcp-error-model.h
Generated on Wed Nov 11 2015 20:00:35 for ns-3 by
1.8.9.1