A Discrete-Event Network Simulator
API
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 
24 namespace ns3
25 {
26 
32 class TcpOptionEnd : public TcpOption
33 {
34  public:
35  TcpOptionEnd();
36  ~TcpOptionEnd() override;
37 
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;
47  uint32_t Deserialize(Buffer::Iterator start) override;
48 
49  uint8_t GetKind() const override;
50  uint32_t GetSerializedSize() const override;
51 };
52 
56 class TcpOptionNOP : public TcpOption
57 {
58  public:
59  TcpOptionNOP();
60  ~TcpOptionNOP() override;
61 
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;
71  uint32_t Deserialize(Buffer::Iterator start) override;
72 
73  uint8_t GetKind() const override;
74  uint32_t GetSerializedSize() const override;
75 };
76 
80 class TcpOptionMSS : public TcpOption
81 {
82  public:
83  TcpOptionMSS();
84  ~TcpOptionMSS() override;
85 
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;
95  uint32_t Deserialize(Buffer::Iterator start) override;
96 
97  uint8_t GetKind() const override;
98  uint32_t GetSerializedSize() const override;
99 
104  uint16_t GetMSS() const;
109  void SetMSS(uint16_t mss);
110 
111  protected:
112  uint16_t m_mss;
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.