A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-option-rfc793.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Adrian Sai-wah Tam
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
18 */
19#ifndef TCPOPTIONRFC793_H
20#define TCPOPTIONRFC793_H
21
22#include "tcp-option.h"
23
24namespace ns3
25{
26
27/**
28 * \ingroup tcp
29 *
30 * Defines the TCP option of kind 0 (end of option list) as in \RFC{793}
31 */
32class TcpOptionEnd : public TcpOption
33{
34 public:
36 ~TcpOptionEnd() override;
37
38 /**
39 * \brief Get the type ID.
40 * \return the object TypeId
41 */
42 static TypeId GetTypeId();
43 TypeId GetInstanceTypeId() const override;
44
45 void Print(std::ostream& os) const override;
46 void Serialize(Buffer::Iterator start) const override;
48
49 uint8_t GetKind() const override;
50 uint32_t GetSerializedSize() const override;
51};
52
53/**
54 * Defines the TCP option of kind 1 (no operation) as in \RFC{793}
55 */
56class TcpOptionNOP : public TcpOption
57{
58 public:
60 ~TcpOptionNOP() override;
61
62 /**
63 * \brief Get the type ID.
64 * \return the object TypeId
65 */
66 static TypeId GetTypeId();
67 TypeId GetInstanceTypeId() const override;
68
69 void Print(std::ostream& os) const override;
70 void Serialize(Buffer::Iterator start) const override;
72
73 uint8_t GetKind() const override;
74 uint32_t GetSerializedSize() const override;
75};
76
77/**
78 * Defines the TCP option of kind 2 (maximum segment size) as in \RFC{793}
79 */
80class TcpOptionMSS : public TcpOption
81{
82 public:
84 ~TcpOptionMSS() override;
85
86 /**
87 * \brief Get the type ID.
88 * \return the object TypeId
89 */
90 static TypeId GetTypeId();
91 TypeId GetInstanceTypeId() const override;
92
93 void Print(std::ostream& os) const override;
94 void Serialize(Buffer::Iterator start) const override;
96
97 uint8_t GetKind() const override;
98 uint32_t GetSerializedSize() const override;
99
100 /**
101 * \brief Get the Maximum Segment Size stored in the Option
102 * \return The Maximum Segment Size
103 */
104 uint16_t GetMSS() const;
105 /**
106 * \brief Set the Maximum Segment Size stored in the Option
107 * \param mss The Maximum Segment Size
108 */
109 void SetMSS(uint16_t mss);
110
111 protected:
112 uint16_t m_mss; //!< maximum segment size
113};
114
115} // namespace ns3
116
117#endif // TCPOPTIONRFC793_H
iterator in a Buffer instance
Definition: buffer.h:100
Defines the TCP option of kind 0 (end of option list) as in RFC 793
void Serialize(Buffer::Iterator start) const override
Serialize the Option to a buffer iterator.
uint32_t GetSerializedSize() const override
Returns number of bytes required for Option serialization.
static TypeId GetTypeId()
Get the type ID.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the Option from a buffer iterator.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint8_t GetKind() const override
Get the ‘kind’ (as in RFC 793) of this option.
void Print(std::ostream &os) const override
Print the Option contents.
Base class for all kinds of TCP options.
Definition: tcp-option.h:38
Defines the TCP option of kind 2 (maximum segment size) as in RFC 793
uint16_t GetMSS() const
Get the Maximum Segment Size stored in the Option.
uint16_t m_mss
maximum segment size
void SetMSS(uint16_t mss)
Set the Maximum Segment Size stored in the Option.
static TypeId GetTypeId()
Get the type ID.
uint8_t GetKind() const override
Get the ‘kind’ (as in RFC 793) of this option.
void Print(std::ostream &os) const override
Print the Option contents.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint32_t GetSerializedSize() const override
Returns number of bytes required for Option serialization.
void Serialize(Buffer::Iterator start) const override
Serialize the Option to a buffer iterator.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the Option from a buffer iterator.
Defines the TCP option of kind 1 (no operation) as in RFC 793
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the Option from a buffer iterator.
void Serialize(Buffer::Iterator start) const override
Serialize the Option to a buffer iterator.
uint32_t GetSerializedSize() const override
Returns number of bytes required for Option serialization.
uint8_t GetKind() const override
Get the ‘kind’ (as in RFC 793) of this option.
void Print(std::ostream &os) const override
Print the Option contents.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
static TypeId GetTypeId()
Get the type ID.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.