A Discrete-Event Network Simulator
API
tcp-option.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2011 Adrian Sai-wah Tam
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: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
19 */
20
21#ifndef TCP_OPTION_H
22#define TCP_OPTION_H
23
24#include <stdint.h>
25#include "ns3/object.h"
26#include "ns3/buffer.h"
27#include "ns3/object-factory.h"
28
29namespace ns3 {
30
36class TcpOption : public Object
37{
38public:
39 TcpOption ();
40 virtual ~TcpOption ();
41
46 static TypeId GetTypeId (void);
47
48 virtual TypeId GetInstanceTypeId (void) const;
49
53 enum Kind
54 {
55 // Remember to extend IsKindKnown() with new value, when adding values here
56 //
57 END = 0,
58 NOP = 1,
59 MSS = 2,
62 SACK = 5,
63 TS = 8,
64 UNKNOWN = 255
65 };
66
71 virtual void Print (std::ostream &os) const = 0;
76 virtual void Serialize (Buffer::Iterator start) const = 0;
77
84
89 virtual uint8_t GetKind (void) const = 0;
97 virtual uint32_t GetSerializedSize (void) const = 0;
98
104 static Ptr<TcpOption> CreateOption (uint8_t kind);
105
111 static bool IsKindKnown (uint8_t kind);
112};
113
123{
124public:
126 virtual ~TcpOptionUnknown ();
127
132 static TypeId GetTypeId (void);
133 virtual TypeId GetInstanceTypeId (void) const;
134
135 virtual void Print (std::ostream &os) const;
136 virtual void Serialize (Buffer::Iterator start) const;
138
139 virtual uint8_t GetKind (void) const;
140 virtual uint32_t GetSerializedSize (void) const;
141
142private:
143 uint8_t m_kind;
145 uint8_t m_content[40];
146
147};
148
149} // namespace ns3
150
151#endif /* TCP_OPTION */
iterator in a Buffer instance
Definition: buffer.h:99
A base class which provides memory management and object aggregation.
Definition: object.h:88
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Base class for all kinds of TCP options.
Definition: tcp-option.h:37
virtual uint8_t GetKind(void) const =0
Get the ‘kind’ (as in RFC 793) of this option.
static Ptr< TcpOption > CreateOption(uint8_t kind)
Creates an option.
Definition: tcp-option.cc:65
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: tcp-option.cc:59
virtual void Serialize(Buffer::Iterator start) const =0
Serialize the Option to a buffer iterator.
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-option.cc:49
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the Option from a buffer iterator.
virtual ~TcpOption()
Definition: tcp-option.cc:44
static bool IsKindKnown(uint8_t kind)
Check if the option is implemented.
Definition: tcp-option.cc:99
virtual void Print(std::ostream &os) const =0
Print the Option contents.
Kind
The option Kind, as defined in the respective RFCs.
Definition: tcp-option.h:54
@ UNKNOWN
not a standardized value; for unknown recv'd options
Definition: tcp-option.h:64
@ SACKPERMITTED
SACKPERMITTED.
Definition: tcp-option.h:61
@ WINSCALE
WINSCALE.
Definition: tcp-option.h:60
virtual uint32_t GetSerializedSize(void) const =0
Returns number of bytes required for Option serialization.
An unknown TCP option.
Definition: tcp-option.h:123
virtual void Serialize(Buffer::Iterator start) const
Serialize the Option to a buffer iterator.
Definition: tcp-option.cc:160
virtual uint8_t GetKind(void) const
Get the ‘kind’ (as in RFC 793) of this option.
Definition: tcp-option.cc:194
uint8_t m_content[40]
The option data.
Definition: tcp-option.h:145
virtual ~TcpOptionUnknown()
Definition: tcp-option.cc:126
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-option.cc:131
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: tcp-option.cc:142
virtual uint32_t GetSerializedSize(void) const
Returns number of bytes required for Option serialization.
Definition: tcp-option.cc:154
uint32_t m_size
The unknown option size.
Definition: tcp-option.h:144
virtual void Print(std::ostream &os) const
Print the Option contents.
Definition: tcp-option.cc:148
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the Option from a buffer iterator.
Definition: tcp-option.cc:174
uint8_t m_kind
The unknown option kind.
Definition: tcp-option.h:143
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
def start()
Definition: core.py:1852