A Discrete-Event Network Simulator
API
tcp-option-ts.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_TS_H
22 #define TCP_OPTION_TS_H
23 
24 #include "ns3/tcp-option.h"
25 #include "ns3/timer.h"
26 
27 namespace ns3 {
28 
35 class TcpOptionTS : public TcpOption
36 {
37 public:
38  TcpOptionTS ();
39  virtual ~TcpOptionTS ();
40 
45  static TypeId GetTypeId (void);
46  virtual TypeId GetInstanceTypeId (void) const;
47 
48  virtual void Print (std::ostream &os) const;
49  virtual void Serialize (Buffer::Iterator start) const;
50  virtual uint32_t Deserialize (Buffer::Iterator start);
51 
52  virtual uint8_t GetKind (void) const;
53  virtual uint32_t GetSerializedSize (void) const;
54 
59  uint32_t GetTimestamp (void) const;
64  uint32_t GetEcho (void) const;
69  void SetTimestamp (uint32_t ts);
74  void SetEcho (uint32_t ts);
75 
90  static uint32_t NowToTsValue ();
91 
101  static Time ElapsedTimeFromTsValue (uint32_t echoTime);
102 
103 protected:
104  uint32_t m_timestamp;
105  uint32_t m_echo;
106 };
107 
108 } // namespace ns3
109 
110 #endif /* TCP_OPTION_TS */
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
static Time ElapsedTimeFromTsValue(uint32_t echoTime)
Estimate the Time elapsed from a TS echo value.
def start()
Definition: core.py:1844
void SetTimestamp(uint32_t ts)
Set the timestamp stored in the Option.
virtual ~TcpOptionTS()
static TypeId GetTypeId(void)
Get the type ID.
void SetEcho(uint32_t ts)
Set the timestamp echo stored in the Option.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
uint32_t GetTimestamp(void) const
Get the timestamp stored in the Option.
iterator in a Buffer instance
Definition: buffer.h:98
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the Option from a buffer iterator.
virtual uint32_t GetSerializedSize(void) const
Returns number of bytes required for Option serialization.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void Print(std::ostream &os) const
Print the Option contents.
virtual void Serialize(Buffer::Iterator start) const
Serialize the Option to a buffer iterator.
static uint32_t NowToTsValue()
Return an uint32_t value which represent "now".
Defines the TCP option of kind 8 (timestamp option) as in RFC 1323
Definition: tcp-option-ts.h:35
Base class for all kinds of TCP options.
Definition: tcp-option.h:36
virtual uint8_t GetKind(void) const
Get the ‘kind’ (as in RFC 793) of this option.
uint32_t m_timestamp
local timestamp
a unique identifier for an interface.
Definition: type-id.h:58
uint32_t m_echo
echo timestamp
uint32_t GetEcho(void) const
Get the timestamp echo stored in the Option.