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
tcp-header.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007 Georgia Tech Research Corporation
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: Raj Bhattacharjea <raj.b@gatech.edu>
19
*/
20
21
#ifndef TCP_HEADER_H
22
#define TCP_HEADER_H
23
24
#include <stdint.h>
25
#include "ns3/header.h"
26
#include "ns3/buffer.h"
27
#include "ns3/tcp-socket-factory.h"
28
#include "ns3/ipv4-address.h"
29
#include "ns3/ipv6-address.h"
30
#include "ns3/sequence-number.h"
31
32
namespace
ns3 {
33
43
class
TcpHeader
:
public
Header
44
{
45
public
:
46
TcpHeader
();
47
virtual
~TcpHeader
();
48
54
void
EnableChecksums
(
void
);
55
//Setters
59
void
SetSourcePort
(uint16_t
port
);
63
void
SetDestinationPort
(uint16_t port);
67
void
SetSequenceNumber
(
SequenceNumber32
sequenceNumber);
71
void
SetAckNumber
(
SequenceNumber32
ackNumber);
75
void
SetLength
(uint8_t length);
79
void
SetFlags
(uint8_t flags);
83
void
SetWindowSize
(uint16_t windowSize);
87
void
SetUrgentPointer
(uint16_t urgentPointer);
88
89
90
//Getters
94
uint16_t
GetSourcePort
()
const
;
98
uint16_t
GetDestinationPort
()
const
;
102
SequenceNumber32
GetSequenceNumber
()
const
;
106
SequenceNumber32
GetAckNumber
()
const
;
110
uint8_t
GetLength
()
const
;
114
uint8_t
GetFlags
()
const
;
118
uint16_t
GetWindowSize
()
const
;
122
uint16_t
GetUrgentPointer
()
const
;
123
135
void
InitializeChecksum
(
Ipv4Address
source,
136
Ipv4Address
destination,
137
uint8_t protocol);
138
void
InitializeChecksum
(
Ipv6Address
source,
139
Ipv6Address
destination,
140
uint8_t protocol);
141
void
InitializeChecksum
(
Address
source,
142
Address
destination,
143
uint8_t protocol);
144
145
typedef
enum
{
NONE
= 0,
FIN
= 1,
SYN
= 2,
RST
= 4,
PSH
= 8,
ACK
= 16,
146
URG
= 32,
ECE
= 64,
CWR
= 128}
Flags_t
;
147
148
static
TypeId
GetTypeId
(
void
);
149
virtual
TypeId
GetInstanceTypeId
(
void
)
const
;
150
virtual
void
Print
(std::ostream &os)
const
;
151
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
152
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
;
153
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start
);
154
159
bool
IsChecksumOk
(
void
)
const
;
160
161
private
:
162
uint16_t
CalculateHeaderChecksum
(uint16_t size)
const
;
163
uint16_t
m_sourcePort
;
164
uint16_t
m_destinationPort
;
165
SequenceNumber32
m_sequenceNumber
;
166
SequenceNumber32
m_ackNumber
;
167
uint8_t
m_length
;
// really a uint4_t
168
uint8_t
m_flags
;
// really a uint6_t
169
uint16_t
m_windowSize
;
170
uint16_t
m_urgentPointer
;
171
172
Address
m_source
;
173
Address
m_destination
;
174
uint8_t
m_protocol
;
175
176
uint16_t
m_initialChecksum
;
177
bool
m_calcChecksum
;
178
bool
m_goodChecksum
;
179
};
180
181
}
// namespace ns3
182
183
#endif
/* TCP_HEADER */
src
internet
model
tcp-header.h
Generated on Fri Aug 30 2013 01:42:52 for ns-3 by
1.8.1.2