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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
7 */
8#ifndef TCPOPTIONRFC793_H
9#define TCPOPTIONRFC793_H
10
11#include "tcp-option.h"
12
13namespace ns3
14{
15
16/**
17 * @ingroup tcp
18 *
19 * Defines the TCP option of kind 0 (end of option list) as in \RFC{793}
20 */
21class TcpOptionEnd : public TcpOption
22{
23 public:
25 ~TcpOptionEnd() override;
26
27 /**
28 * @brief Get the type ID.
29 * @return the object TypeId
30 */
31 static TypeId GetTypeId();
32 TypeId GetInstanceTypeId() const override;
33
34 void Print(std::ostream& os) const override;
35 void Serialize(Buffer::Iterator start) const override;
37
38 uint8_t GetKind() const override;
39 uint32_t GetSerializedSize() const override;
40};
41
42/**
43 * Defines the TCP option of kind 1 (no operation) as in \RFC{793}
44 */
45class TcpOptionNOP : public TcpOption
46{
47 public:
49 ~TcpOptionNOP() override;
50
51 /**
52 * @brief Get the type ID.
53 * @return the object TypeId
54 */
55 static TypeId GetTypeId();
56 TypeId GetInstanceTypeId() const override;
57
58 void Print(std::ostream& os) const override;
59 void Serialize(Buffer::Iterator start) const override;
61
62 uint8_t GetKind() const override;
63 uint32_t GetSerializedSize() const override;
64};
65
66/**
67 * Defines the TCP option of kind 2 (maximum segment size) as in \RFC{793}
68 */
69class TcpOptionMSS : public TcpOption
70{
71 public:
73 ~TcpOptionMSS() override;
74
75 /**
76 * @brief Get the type ID.
77 * @return the object TypeId
78 */
79 static TypeId GetTypeId();
80 TypeId GetInstanceTypeId() const override;
81
82 void Print(std::ostream& os) const override;
83 void Serialize(Buffer::Iterator start) const override;
85
86 uint8_t GetKind() const override;
87 uint32_t GetSerializedSize() const override;
88
89 /**
90 * @brief Get the Maximum Segment Size stored in the Option
91 * @return The Maximum Segment Size
92 */
93 uint16_t GetMSS() const;
94 /**
95 * @brief Set the Maximum Segment Size stored in the Option
96 * @param mss The Maximum Segment Size
97 */
98 void SetMSS(uint16_t mss);
99
100 protected:
101 uint16_t m_mss; //!< maximum segment size
102};
103
104} // namespace ns3
105
106#endif // TCPOPTIONRFC793_H
iterator in a Buffer instance
Definition buffer.h:89
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:27
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:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.