View | Details | Raw Unified | Return to bug 2041
Collapse All | Expand All

(-)a/src/internet/bindings/modulegen__gcc_ILP32.py (-11 / +15 lines)
 Lines 5328-5334    Link Here 
5328
    return
5328
    return
5329
5329
5330
def register_Ns3Int64x64_t_methods(root_module, cls):
5330
def register_Ns3Int64x64_t_methods(root_module, cls):
5331
    cls.add_binary_comparison_operator('<=')
5332
    cls.add_binary_comparison_operator('!=')
5331
    cls.add_binary_comparison_operator('!=')
5333
    cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', u'right'))
5332
    cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', u'right'))
5334
    cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right'))
5333
    cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right'))
 Lines 5342-5347    Link Here 
5342
    cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', u'right'))
5341
    cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', u'right'))
5343
    cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', u'right'))
5342
    cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', u'right'))
5344
    cls.add_output_stream_operator()
5343
    cls.add_output_stream_operator()
5344
    cls.add_binary_comparison_operator('<=')
5345
    cls.add_binary_comparison_operator('==')
5345
    cls.add_binary_comparison_operator('==')
5346
    cls.add_binary_comparison_operator('>=')
5346
    cls.add_binary_comparison_operator('>=')
5347
    ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor]
5347
    ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor]
 Lines 7974-7984    Link Here 
7974
                   'ns3::Ptr< ns3::RttEstimator >', 
7974
                   'ns3::Ptr< ns3::RttEstimator >', 
7975
                   [], 
7975
                   [], 
7976
                   is_pure_virtual=True, is_const=True, is_virtual=True)
7976
                   is_pure_virtual=True, is_const=True, is_virtual=True)
7977
    ## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::EstimateRttFromSeq(ns3::SequenceNumber32 ackSeq) [member function]
7978
    cls.add_method('EstimateRttFromSeq', 
7979
                   'ns3::Time', 
7980
                   [param('ns3::SequenceNumber32', 'ackSeq')], 
7981
                   is_virtual=True)
7982
    ## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetCurrentEstimate() const [member function]
7977
    ## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetCurrentEstimate() const [member function]
7983
    cls.add_method('GetCurrentEstimate', 
7978
    cls.add_method('GetCurrentEstimate', 
7984
                   'ns3::Time', 
7979
                   'ns3::Time', 
 Lines 7994-7999    Link Here 
7994
                   'ns3::Time', 
7989
                   'ns3::Time', 
7995
                   [], 
7990
                   [], 
7996
                   is_const=True)
7991
                   is_const=True)
7992
    ## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetRttFor(ns3::TcpHeader const & tcpHeader) [member function]
7993
    cls.add_method('GetRttFor', 
7994
                   'ns3::Time', 
7995
                   [param('ns3::TcpHeader const &', 'tcpHeader')], 
7996
                   is_virtual=True)
7997
    ## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttEstimator::GetTypeId() [member function]
7997
    ## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttEstimator::GetTypeId() [member function]
7998
    cls.add_method('GetTypeId', 
7998
    cls.add_method('GetTypeId', 
7999
                   'ns3::TypeId', 
7999
                   'ns3::TypeId', 
 Lines 8024-8033    Link Here 
8024
                   'ns3::Time', 
8024
                   'ns3::Time', 
8025
                   [], 
8025
                   [], 
8026
                   is_pure_virtual=True, is_virtual=True)
8026
                   is_pure_virtual=True, is_virtual=True)
8027
    ## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SentSeq(ns3::SequenceNumber32 seq, uint32_t size) [member function]
8027
    ## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SentPkt(ns3::TcpHeader const & tcpHeader, uint32_t size) [member function]
8028
    cls.add_method('SentSeq', 
8028
    cls.add_method('SentPkt', 
8029
                   'void', 
8029
                   'void', 
8030
                   [param('ns3::SequenceNumber32', 'seq'), param('uint32_t', 'size')], 
8030
                   [param('ns3::TcpHeader const &', 'tcpHeader'), param('uint32_t', 'size')], 
8031
                   is_virtual=True)
8031
                   is_virtual=True)
8032
    ## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetCurrentEstimate(ns3::Time estimate) [member function]
8032
    ## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetCurrentEstimate(ns3::Time estimate) [member function]
8033
    cls.add_method('SetCurrentEstimate', 
8033
    cls.add_method('SetCurrentEstimate', 
 Lines 8037-8042    Link Here 
8037
    cls.add_method('SetMinRto', 
8037
    cls.add_method('SetMinRto', 
8038
                   'void', 
8038
                   'void', 
8039
                   [param('ns3::Time', 'minRto')])
8039
                   [param('ns3::Time', 'minRto')])
8040
    ## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetTimestampEnabled(bool enabled) [member function]
8041
    cls.add_method('SetTimestampEnabled', 
8042
                   'void', 
8043
                   [param('bool', 'enabled')])
8040
    return
8044
    return
8041
8045
8042
def register_Ns3RttMeanDeviation_methods(root_module, cls):
8046
def register_Ns3RttMeanDeviation_methods(root_module, cls):
 Lines 10110-10116    Link Here 
10110
    return
10114
    return
10111
10115
10112
def register_Ns3Time_methods(root_module, cls):
10116
def register_Ns3Time_methods(root_module, cls):
10113
    cls.add_binary_comparison_operator('<=')
10114
    cls.add_binary_comparison_operator('!=')
10117
    cls.add_binary_comparison_operator('!=')
10115
    cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', u'right'))
10118
    cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', u'right'))
10116
    cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right'))
10119
    cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right'))
 Lines 10121-10126    Link Here 
10121
    cls.add_binary_comparison_operator('>')
10124
    cls.add_binary_comparison_operator('>')
10122
    cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', u'right'))
10125
    cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', u'right'))
10123
    cls.add_output_stream_operator()
10126
    cls.add_output_stream_operator()
10127
    cls.add_binary_comparison_operator('<=')
10124
    cls.add_binary_comparison_operator('==')
10128
    cls.add_binary_comparison_operator('==')
10125
    cls.add_binary_comparison_operator('>=')
10129
    cls.add_binary_comparison_operator('>=')
10126
    ## nstime.h (module 'core'): ns3::Time::Time() [constructor]
10130
    ## nstime.h (module 'core'): ns3::Time::Time() [constructor]
(-)a/src/internet/bindings/modulegen__gcc_LP64.py (-11 / +15 lines)
 Lines 5328-5334    Link Here 
5328
    return
5328
    return
5329
5329
5330
def register_Ns3Int64x64_t_methods(root_module, cls):
5330
def register_Ns3Int64x64_t_methods(root_module, cls):
5331
    cls.add_binary_comparison_operator('<=')
5332
    cls.add_binary_comparison_operator('!=')
5331
    cls.add_binary_comparison_operator('!=')
5333
    cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', u'right'))
5332
    cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', u'right'))
5334
    cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right'))
5333
    cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right'))
 Lines 5342-5347    Link Here 
5342
    cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', u'right'))
5341
    cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', u'right'))
5343
    cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', u'right'))
5342
    cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', u'right'))
5344
    cls.add_output_stream_operator()
5343
    cls.add_output_stream_operator()
5344
    cls.add_binary_comparison_operator('<=')
5345
    cls.add_binary_comparison_operator('==')
5345
    cls.add_binary_comparison_operator('==')
5346
    cls.add_binary_comparison_operator('>=')
5346
    cls.add_binary_comparison_operator('>=')
5347
    ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor]
5347
    ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor]
 Lines 7974-7984    Link Here 
7974
                   'ns3::Ptr< ns3::RttEstimator >', 
7974
                   'ns3::Ptr< ns3::RttEstimator >', 
7975
                   [], 
7975
                   [], 
7976
                   is_pure_virtual=True, is_const=True, is_virtual=True)
7976
                   is_pure_virtual=True, is_const=True, is_virtual=True)
7977
    ## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::EstimateRttFromSeq(ns3::SequenceNumber32 ackSeq) [member function]
7978
    cls.add_method('EstimateRttFromSeq', 
7979
                   'ns3::Time', 
7980
                   [param('ns3::SequenceNumber32', 'ackSeq')], 
7981
                   is_virtual=True)
7982
    ## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetCurrentEstimate() const [member function]
7977
    ## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetCurrentEstimate() const [member function]
7983
    cls.add_method('GetCurrentEstimate', 
7978
    cls.add_method('GetCurrentEstimate', 
7984
                   'ns3::Time', 
7979
                   'ns3::Time', 
 Lines 7994-7999    Link Here 
7994
                   'ns3::Time', 
7989
                   'ns3::Time', 
7995
                   [], 
7990
                   [], 
7996
                   is_const=True)
7991
                   is_const=True)
7992
    ## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetRttFor(ns3::TcpHeader const & tcpHeader) [member function]
7993
    cls.add_method('GetRttFor', 
7994
                   'ns3::Time', 
7995
                   [param('ns3::TcpHeader const &', 'tcpHeader')], 
7996
                   is_virtual=True)
7997
    ## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttEstimator::GetTypeId() [member function]
7997
    ## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttEstimator::GetTypeId() [member function]
7998
    cls.add_method('GetTypeId', 
7998
    cls.add_method('GetTypeId', 
7999
                   'ns3::TypeId', 
7999
                   'ns3::TypeId', 
 Lines 8024-8033    Link Here 
8024
                   'ns3::Time', 
8024
                   'ns3::Time', 
8025
                   [], 
8025
                   [], 
8026
                   is_pure_virtual=True, is_virtual=True)
8026
                   is_pure_virtual=True, is_virtual=True)
8027
    ## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SentSeq(ns3::SequenceNumber32 seq, uint32_t size) [member function]
8027
    ## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SentPkt(ns3::TcpHeader const & tcpHeader, uint32_t size) [member function]
8028
    cls.add_method('SentSeq', 
8028
    cls.add_method('SentPkt', 
8029
                   'void', 
8029
                   'void', 
8030
                   [param('ns3::SequenceNumber32', 'seq'), param('uint32_t', 'size')], 
8030
                   [param('ns3::TcpHeader const &', 'tcpHeader'), param('uint32_t', 'size')], 
8031
                   is_virtual=True)
8031
                   is_virtual=True)
8032
    ## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetCurrentEstimate(ns3::Time estimate) [member function]
8032
    ## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetCurrentEstimate(ns3::Time estimate) [member function]
8033
    cls.add_method('SetCurrentEstimate', 
8033
    cls.add_method('SetCurrentEstimate', 
 Lines 8037-8042    Link Here 
8037
    cls.add_method('SetMinRto', 
8037
    cls.add_method('SetMinRto', 
8038
                   'void', 
8038
                   'void', 
8039
                   [param('ns3::Time', 'minRto')])
8039
                   [param('ns3::Time', 'minRto')])
8040
    ## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetTimestampEnabled(bool enabled) [member function]
8041
    cls.add_method('SetTimestampEnabled', 
8042
                   'void', 
8043
                   [param('bool', 'enabled')])
8040
    return
8044
    return
8041
8045
8042
def register_Ns3RttMeanDeviation_methods(root_module, cls):
8046
def register_Ns3RttMeanDeviation_methods(root_module, cls):
 Lines 10110-10116    Link Here 
10110
    return
10114
    return
10111
10115
10112
def register_Ns3Time_methods(root_module, cls):
10116
def register_Ns3Time_methods(root_module, cls):
10113
    cls.add_binary_comparison_operator('<=')
10114
    cls.add_binary_comparison_operator('!=')
10117
    cls.add_binary_comparison_operator('!=')
10115
    cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', u'right'))
10118
    cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', u'right'))
10116
    cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right'))
10119
    cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right'))
 Lines 10121-10126    Link Here 
10121
    cls.add_binary_comparison_operator('>')
10124
    cls.add_binary_comparison_operator('>')
10122
    cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', u'right'))
10125
    cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', u'right'))
10123
    cls.add_output_stream_operator()
10126
    cls.add_output_stream_operator()
10127
    cls.add_binary_comparison_operator('<=')
10124
    cls.add_binary_comparison_operator('==')
10128
    cls.add_binary_comparison_operator('==')
10125
    cls.add_binary_comparison_operator('>=')
10129
    cls.add_binary_comparison_operator('>=')
10126
    ## nstime.h (module 'core'): ns3::Time::Time() [constructor]
10130
    ## nstime.h (module 'core'): ns3::Time::Time() [constructor]
(-)a/src/internet/model/rtt-estimator.cc (-19 / +54 lines)
 Lines 33-38    Link Here 
33
#include "ns3/integer.h"
33
#include "ns3/integer.h"
34
#include "ns3/uinteger.h"
34
#include "ns3/uinteger.h"
35
#include "ns3/log.h"
35
#include "ns3/log.h"
36
#include "ns3/packet.h"
37
#include "ns3/tcp-header.h"
38
#include "tcp-option-ts.h"
36
39
37
namespace ns3 {
40
namespace ns3 {
38
41
 Lines 107-113    Link Here 
107
RttEstimator::RttEstimator ()
110
RttEstimator::RttEstimator ()
108
  : m_next (1), m_history (),
111
  : m_next (1), m_history (),
109
    m_nSamples (0),
112
    m_nSamples (0),
110
    m_multiplier (1)
113
    m_multiplier (1),
114
    m_timestampEnabled (false)
111
{ 
115
{ 
112
  NS_LOG_FUNCTION (this);
116
  NS_LOG_FUNCTION (this);
113
  //note next=1 everywhere since first segment will have sequence 1
117
  //note next=1 everywhere since first segment will have sequence 1
 Lines 124-130    Link Here 
124
    m_maxMultiplier (c.m_maxMultiplier), 
128
    m_maxMultiplier (c.m_maxMultiplier), 
125
    m_initialEstimatedRtt (c.m_initialEstimatedRtt),
129
    m_initialEstimatedRtt (c.m_initialEstimatedRtt),
126
    m_currentEstimatedRtt (c.m_currentEstimatedRtt), m_minRto (c.m_minRto),
130
    m_currentEstimatedRtt (c.m_currentEstimatedRtt), m_minRto (c.m_minRto),
127
    m_nSamples (c.m_nSamples), m_multiplier (c.m_multiplier)
131
    m_nSamples (c.m_nSamples), m_multiplier (c.m_multiplier),
132
    m_timestampEnabled (c.m_timestampEnabled)
128
{
133
{
129
  NS_LOG_FUNCTION (this);
134
  NS_LOG_FUNCTION (this);
130
}
135
}
 Lines 140-148    Link Here 
140
  return GetTypeId ();
145
  return GetTypeId ();
141
}
146
}
142
147
143
void RttEstimator::SentSeq (SequenceNumber32 seq, uint32_t size)
148
void RttEstimator::SentPkt (const TcpHeader &tcpHeader, uint32_t size)
144
{ 
149
{ 
145
  NS_LOG_FUNCTION (this << seq << size);
150
  NS_LOG_FUNCTION (this << tcpHeader);
151
152
  SequenceNumber32 seq = tcpHeader.GetSequenceNumber();
153
146
  // Note that a particular sequence has been sent
154
  // Note that a particular sequence has been sent
147
  if (seq == m_next)
155
  if (seq == m_next)
148
    { // This is the next expected one, just log at end
156
    { // This is the next expected one, just log at end
 Lines 168-188    Link Here 
168
    }
176
    }
169
}
177
}
170
178
171
Time RttEstimator::EstimateRttFromSeq (SequenceNumber32 ackSeq)
179
Time
180
RttEstimator::GetRttFor (const TcpHeader &tcpHeader)
172
{ 
181
{ 
173
  NS_LOG_FUNCTION (this << ackSeq);
182
  NS_LOG_FUNCTION (this << tcpHeader);
174
  // An ack has been received, calculate rtt and log this measurement
183
175
  // Note we use a linear search (O(n)) for this since for the common
184
  SequenceNumber32 ackSeq = tcpHeader.GetAckNumber();
176
  // case the ack'ed packet will be at the head of the list
185
177
  Time m = Seconds (0.0);
186
  Time m = Time (0.0);
178
  if (m_history.size () == 0) return (m);    // No pending history, just exit
187
179
  RttHistory& h = m_history.front ();
188
  if (m_timestampEnabled && tcpHeader.HasOption (TcpOption::TS))
180
  if (!h.retx && ackSeq >= (h.seq + SequenceNumber32 (h.count)))
189
    {
181
    { // Ok to use this sample
190
      Ptr<TcpOptionTS> ts;
182
      m = Simulator::Now () - h.time; // Elapsed time
191
      ts = DynamicCast<TcpOptionTS> (tcpHeader.GetOption (TcpOption::TS));
183
      Measurement (m);                // Log the measurement
192
      m = TcpOptionTS::ElapsedTimeFromTsValue (ts->GetEcho ());
184
      ResetMultiplier ();             // Reset multiplier on valid measurement
185
    }
193
    }
194
  else
195
    {
196
      // An ack has been received, calculate rtt and log this measurement
197
      // Note we use a linear search (O(n)) for this since for the common
198
      // case the ack'ed packet will be at the head of the list
199
      if (m_history.size () == 0) return (m);    // No pending history, just exit
200
      RttHistory& h = m_history.front ();
201
      if (!h.retx && ackSeq >= (h.seq + SequenceNumber32 (h.count)))
202
        { // Ok to use this sample
203
          m = Simulator::Now () - h.time; // Elapsed time
204
        }
205
    }
206
186
  // Now delete all ack history with seq <= ack
207
  // Now delete all ack history with seq <= ack
187
  while(m_history.size () > 0)
208
  while(m_history.size () > 0)
188
    {
209
    {
 Lines 190-196    Link Here 
190
      if ((h.seq + SequenceNumber32 (h.count)) > ackSeq) break;               // Done removing
211
      if ((h.seq + SequenceNumber32 (h.count)) > ackSeq) break;               // Done removing
191
      m_history.pop_front (); // Remove
212
      m_history.pop_front (); // Remove
192
    }
213
    }
193
  return m;
214
215
  if (!m.IsZero ())
216
    {
217
      Measurement (m);                // Log the measurement
218
      ResetMultiplier ();             // Reset multiplier on valid measurement
219
      return m;
220
    }
221
  else
222
    {
223
      return m_currentEstimatedRtt;
224
    }
194
}
225
}
195
226
196
void RttEstimator::ClearSent ()
227
void RttEstimator::ClearSent ()
 Lines 225-231    Link Here 
225
  ResetMultiplier ();
256
  ResetMultiplier ();
226
}
257
}
227
258
228
259
void
260
RttEstimator::SetTimestampEnabled (bool enabled)
261
{
262
  m_timestampEnabled = enabled;
263
}
229
264
230
//-----------------------------------------------------------------------------
265
//-----------------------------------------------------------------------------
231
//-----------------------------------------------------------------------------
266
//-----------------------------------------------------------------------------
(-)a/src/internet/model/rtt-estimator.h (-8 / +22 lines)
 Lines 61-66    Link Here 
61
/// Container for RttHistory objects
61
/// Container for RttHistory objects
62
typedef std::deque<RttHistory> RttHistory_t;
62
typedef std::deque<RttHistory> RttHistory_t;
63
63
64
class Packet;
65
class TcpHeader;
66
64
/**
67
/**
65
 * \ingroup tcp
68
 * \ingroup tcp
66
 *
69
 *
 Lines 86-103    Link Here 
86
  virtual TypeId GetInstanceTypeId (void) const;
89
  virtual TypeId GetInstanceTypeId (void) const;
87
90
88
  /**
91
  /**
89
   * \brief Note that a particular sequence has been sent
92
   * \brief Note that a particular packet (its sequence number) has been sent.
90
   * \param seq the packet sequence number.
93
   * \param tcpHeader the packet TCP header.
91
   * \param size the packet size.
94
   * \param size the packet size.
92
   */
95
   */
93
  virtual void SentSeq (SequenceNumber32 seq, uint32_t size);
96
  virtual void SentPkt (const TcpHeader &tcpHeader, uint32_t size);
94
97
95
  /**
98
  /**
96
   * \brief Note that a particular ack sequence has been received
99
   * \brief Note that a particular packet has been received. Depending on
97
   * \param ackSeq the ack sequence number.
100
   * the TCP TimeStamp option presence, the ack number or the TimeStamp will be used to
98
   * \return The measured RTT for this ack.
101
   * calculate the estimate RTT.
102
   * \param tcpHeader the packet TCP header.
103
   * \return The estimated RTT.
99
   */
104
   */
100
  virtual Time EstimateRttFromSeq (SequenceNumber32 ackSeq);
105
  virtual Time GetRttFor (const TcpHeader &tcpHeader);
101
106
102
  /**
107
  /**
103
   * \brief Clear all history entries
108
   * \brief Clear all history entries
 Lines 156-166    Link Here 
156
  void SetCurrentEstimate (Time estimate);
161
  void SetCurrentEstimate (Time estimate);
157
162
158
  /**
163
  /**
159
   * \brief gets the current RTT estimate.
164
   * \brief Gets the current RTT estimate.
160
   * \return The current RTT estimate.
165
   * \return The current RTT estimate.
161
   */
166
   */
162
  Time GetCurrentEstimate (void) const;
167
  Time GetCurrentEstimate (void) const;
163
168
169
  /**
170
   * \brief Enable (or disable) the use of TCP TimeStamp option
171
   * \param true: use TCP TimeStamp option
172
   */
173
  void SetTimestampEnabled (bool enabled);
174
164
private:
175
private:
165
  SequenceNumber32 m_next;    //!< Next expected sequence to be sent
176
  SequenceNumber32 m_next;    //!< Next expected sequence to be sent
166
  RttHistory_t m_history;     //!< List of sent packet
177
  RttHistory_t m_history;     //!< List of sent packet
 Lines 172-177    Link Here 
172
  Time         m_minRto;                  //!< minimum value of the timeout
183
  Time         m_minRto;                  //!< minimum value of the timeout
173
  uint32_t     m_nSamples;                //!< Number of samples
184
  uint32_t     m_nSamples;                //!< Number of samples
174
  uint16_t     m_multiplier;              //!< RTO Multiplier
185
  uint16_t     m_multiplier;              //!< RTO Multiplier
186
187
private:
188
  bool m_timestampEnabled;                //!< Use TCP TimeStamp option
175
};
189
};
176
190
177
/**
191
/**
(-)a/src/internet/model/tcp-socket-base.cc (-17 / +10 lines)
 Lines 148-155    Link Here 
148
    m_sndScaleFactor (0),
148
    m_sndScaleFactor (0),
149
    m_rcvScaleFactor (0),
149
    m_rcvScaleFactor (0),
150
    m_timestampEnabled (true),
150
    m_timestampEnabled (true),
151
    m_timestampToEcho (0),
151
    m_timestampToEcho (0)
152
    m_lastEchoedTime (0)
153
152
154
{
153
{
155
  NS_LOG_FUNCTION (this);
154
  NS_LOG_FUNCTION (this);
 Lines 190-197    Link Here 
190
    m_sndScaleFactor (sock.m_sndScaleFactor),
189
    m_sndScaleFactor (sock.m_sndScaleFactor),
191
    m_rcvScaleFactor (sock.m_rcvScaleFactor),
190
    m_rcvScaleFactor (sock.m_rcvScaleFactor),
192
    m_timestampEnabled (sock.m_timestampEnabled),
191
    m_timestampEnabled (sock.m_timestampEnabled),
193
    m_timestampToEcho (sock.m_timestampToEcho),
192
    m_timestampToEcho (sock.m_timestampToEcho)
194
    m_lastEchoedTime (sock.m_lastEchoedTime)
195
193
196
{
194
{
197
  NS_LOG_FUNCTION (this);
195
  NS_LOG_FUNCTION (this);
 Lines 1979-1985    Link Here 
1979
      m_tcp->SendPacket (p, header, m_endPoint6->GetLocalAddress (),
1977
      m_tcp->SendPacket (p, header, m_endPoint6->GetLocalAddress (),
1980
                         m_endPoint6->GetPeerAddress (), m_boundnetdevice);
1978
                         m_endPoint6->GetPeerAddress (), m_boundnetdevice);
1981
    }
1979
    }
1982
  m_rtt->SentSeq (seq, sz);       // notify the RTT
1980
  m_rtt->SentPkt (header, sz);       // notify the RTT
1983
  // Notify the application of the data being sent unless this is a retransmit
1981
  // Notify the application of the data being sent unless this is a retransmit
1984
  if (seq == m_nextTxSequence)
1982
  if (seq == m_nextTxSequence)
1985
    {
1983
    {
 Lines 2157-2172    Link Here 
2157
{
2155
{
2158
  Time nextRtt;
2156
  Time nextRtt;
2159
2157
2160
  if (m_timestampEnabled)
2158
  // Use m_rtt for the estimation. Note, RTT of duplicated acknowledgement
2161
    {
2159
  // (which should be ignored) is handled by m_rtt.
2162
      nextRtt = TcpOptionTS::ElapsedTimeFromTsValue (m_lastEchoedTime);
2160
  nextRtt =  m_rtt->GetRttFor (tcpHeader);
2163
    }
2164
  else
2165
    {
2166
      // Use m_rtt for the estimation. Note, RTT of duplicated acknowledgement
2167
      // (which should be ignored) is handled by m_rtt.
2168
      nextRtt =  m_rtt->EstimateRttFromSeq (tcpHeader.GetAckNumber () );
2169
    }
2170
2161
2171
  //nextRtt will be zero for dup acks.  Don't want to update lastRtt in that case
2162
  //nextRtt will be zero for dup acks.  Don't want to update lastRtt in that case
2172
  //but still needed to do list clearing that is done in EstimateRttFromSeq.
2163
  //but still needed to do list clearing that is done in EstimateRttFromSeq.
 Lines 2526-2534    Link Here 
2526
    }
2517
    }
2527
2518
2528
  m_timestampEnabled = false;
2519
  m_timestampEnabled = false;
2520
  m_rtt->SetTimestampEnabled (false);
2521
2529
  if (header.HasOption (TcpOption::TS))
2522
  if (header.HasOption (TcpOption::TS))
2530
    {
2523
    {
2531
      m_timestampEnabled = true;
2524
      m_timestampEnabled = true;
2525
      m_rtt->SetTimestampEnabled (true);
2532
      ProcessOptionTimestamp (header.GetOption (TcpOption::TS));
2526
      ProcessOptionTimestamp (header.GetOption (TcpOption::TS));
2533
    }
2527
    }
2534
}
2528
}
 Lines 2622-2631    Link Here 
2622
2616
2623
  Ptr<const TcpOptionTS> ts = DynamicCast<const TcpOptionTS> (option);
2617
  Ptr<const TcpOptionTS> ts = DynamicCast<const TcpOptionTS> (option);
2624
  m_timestampToEcho = ts->GetTimestamp ();
2618
  m_timestampToEcho = ts->GetTimestamp ();
2625
  m_lastEchoedTime = ts->GetEcho ();
2626
2619
2627
  NS_LOG_INFO (m_node->GetId () << " Got timestamp=" <<
2620
  NS_LOG_INFO (m_node->GetId () << " Got timestamp=" <<
2628
               m_timestampToEcho << " and Echo="     << m_lastEchoedTime);
2621
               m_timestampToEcho << " and Echo="     << ts->GetEcho ());
2629
}
2622
}
2630
2623
2631
void
2624
void
(-)a/src/internet/model/tcp-socket-base.h (-1 lines)
 Lines 667-673    Link Here 
667
667
668
  bool     m_timestampEnabled;    //!< Timestamp option enabled
668
  bool     m_timestampEnabled;    //!< Timestamp option enabled
669
  uint32_t m_timestampToEcho;     //!< Timestamp to echo
669
  uint32_t m_timestampToEcho;     //!< Timestamp to echo
670
  uint32_t m_lastEchoedTime;      //!< Last echoed timestamp
671
};
670
};
672
671
673
} // namespace ns3
672
} // namespace ns3

Return to bug 2041