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-option-sack-permitted.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011 Adrian Sai-wah Tam
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
* Original Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
19
* Documentation, test cases: Truc Anh N. Nguyen <annguyen@ittc.ku.edu>
20
* ResiliNets Research Group http://wiki.ittc.ku.edu/resilinets
21
* The University of Kansas
22
* James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
23
*/
24
25
#include "
tcp-option-sack-permitted.h
"
26
#include "ns3/log.h"
27
28
namespace
ns3
{
29
30
NS_LOG_COMPONENT_DEFINE
(
"TcpOptionSackPermitted"
);
31
32
NS_OBJECT_ENSURE_REGISTERED
(TcpOptionSackPermitted);
33
34
TcpOptionSackPermitted::TcpOptionSackPermitted
()
35
:
TcpOption
()
36
{
37
}
38
39
TcpOptionSackPermitted::~TcpOptionSackPermitted
()
40
{
41
}
42
43
TypeId
44
TcpOptionSackPermitted::GetTypeId
(
void
)
45
{
46
static
TypeId
tid =
TypeId
(
"ns3::TcpOptionSackPermitted"
)
47
.
SetParent
<
TcpOption
> ()
48
.SetGroupName (
"Internet"
)
49
.AddConstructor<
TcpOptionSackPermitted
> ()
50
;
51
return
tid;
52
}
53
54
TypeId
55
TcpOptionSackPermitted::GetInstanceTypeId
(
void
)
const
56
{
57
return
GetTypeId
();
58
}
59
60
void
61
TcpOptionSackPermitted::Print
(std::ostream &os)
const
62
{
63
os <<
"[sack_perm]"
;
64
}
65
66
uint32_t
67
TcpOptionSackPermitted::GetSerializedSize
(
void
)
const
68
{
69
return
2;
70
}
71
72
void
73
TcpOptionSackPermitted::Serialize
(
Buffer::Iterator
start
)
const
74
{
75
Buffer::Iterator
i =
start
;
76
i.
WriteU8
(
GetKind
());
// Kind
77
i.
WriteU8
(2);
// Length
78
}
79
80
uint32_t
81
TcpOptionSackPermitted::Deserialize
(
Buffer::Iterator
start
)
82
{
83
Buffer::Iterator
i =
start
;
84
85
uint8_t readKind = i.
ReadU8
();
86
if
(readKind !=
GetKind
())
87
{
88
NS_LOG_WARN
(
"Malformed Sack-Permitted option"
);
89
return
0;
90
}
91
92
uint8_t size = i.
ReadU8
();
93
if
(size != 2)
94
{
95
NS_LOG_WARN
(
"Malformed Sack-Permitted option"
);
96
return
0;
97
}
98
return
GetSerializedSize
();
99
}
100
101
uint8_t
102
TcpOptionSackPermitted::GetKind
(
void
)
const
103
{
104
return
TcpOption::SACKPERMITTED
;
105
}
106
107
}
// namespace ns3
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
visualizer.core.start
def start()
Definition:
core.py:1790
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:201
ns3::TcpOptionSackPermitted::TcpOptionSackPermitted
TcpOptionSackPermitted()
Definition:
tcp-option-sack-permitted.cc:34
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:98
ns3::TcpOptionSackPermitted::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the Option to a buffer iterator.
Definition:
tcp-option-sack-permitted.cc:73
ns3::TcpOptionSackPermitted::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the Option from a buffer iterator.
Definition:
tcp-option-sack-permitted.cc:81
ns3::TcpOptionSackPermitted
Defines the TCP option of kind 4 (selective acknowledgment permitted option) as in RFC 2018 ...
Definition:
tcp-option-sack-permitted.h:42
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::TcpOptionSackPermitted::Print
virtual void Print(std::ostream &os) const
Print the Option contents.
Definition:
tcp-option-sack-permitted.cc:61
ns3::TcpOptionSackPermitted::~TcpOptionSackPermitted
virtual ~TcpOptionSackPermitted()
Definition:
tcp-option-sack-permitted.cc:39
ns3::TcpOptionSackPermitted::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
tcp-option-sack-permitted.cc:44
ns3::Buffer::Iterator::WriteU8
void WriteU8(uint8_t data)
Definition:
buffer.h:869
NS_LOG_WARN
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition:
log.h:261
ns3::TcpOptionSackPermitted::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Returns number of bytes required for Option serialization.
Definition:
tcp-option-sack-permitted.cc:67
ns3::Buffer::Iterator::ReadU8
uint8_t ReadU8(void)
Definition:
buffer.h:1021
ns3::TcpOption
Base class for all kinds of TCP options.
Definition:
tcp-option.h:36
ns3::TcpOptionSackPermitted::GetKind
virtual uint8_t GetKind(void) const
Get the `kind' (as in RFC 793) of this option.
Definition:
tcp-option-sack-permitted.cc:102
tcp-option-sack-permitted.h
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:914
ns3::TcpOptionSackPermitted::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition:
tcp-option-sack-permitted.cc:55
ns3::TcpOption::SACKPERMITTED
SACKPERMITTED.
Definition:
tcp-option.h:61
src
internet
model
tcp-option-sack-permitted.cc
Generated on Wed Mar 21 2018 14:24:12 for ns-3 by
1.8.9.1