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
33 void Print(std::ostream& os) const override;
34 void Serialize(Buffer::Iterator start) const override;
36
37 uint8_t GetKind() const override;
38 uint32_t GetSerializedSize() const override;
39};
40
41/**
42 * Defines the TCP option of kind 1 (no operation) as in \RFC{793}
43 */
44class TcpOptionNOP : public TcpOption
45{
46 public:
48 ~TcpOptionNOP() override;
49
50 /**
51 * @brief Get the type ID.
52 * @return the object TypeId
53 */
54 static TypeId GetTypeId();
55
56 void Print(std::ostream& os) const override;
57 void Serialize(Buffer::Iterator start) const override;
59
60 uint8_t GetKind() const override;
61 uint32_t GetSerializedSize() const override;
62};
63
64/**
65 * Defines the TCP option of kind 2 (maximum segment size) as in \RFC{793}
66 */
67class TcpOptionMSS : public TcpOption
68{
69 public:
71 ~TcpOptionMSS() override;
72
73 /**
74 * @brief Get the type ID.
75 * @return the object TypeId
76 */
77 static TypeId GetTypeId();
78
79 void Print(std::ostream& os) const override;
80 void Serialize(Buffer::Iterator start) const override;
82
83 uint8_t GetKind() const override;
84 uint32_t GetSerializedSize() const override;
85
86 /**
87 * @brief Get the Maximum Segment Size stored in the Option
88 * @return The Maximum Segment Size
89 */
90 uint16_t GetMSS() const;
91 /**
92 * @brief Set the Maximum Segment Size stored in the Option
93 * @param mss The Maximum Segment Size
94 */
95 void SetMSS(uint16_t mss);
96
97 protected:
98 uint16_t m_mss; //!< maximum segment size
99};
100
101} // namespace ns3
102
103#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.
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.
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.
static TypeId GetTypeId()
Get the type ID.
a unique identifier for an interface.
Definition type-id.h:49
Every class exported by the ns3 library is enclosed in the ns3 namespace.