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

(-)a/src/internet/model/tcp-l4-protocol.cc (+14 lines)
 Lines 18-23    Link Here 
18
 * Author: Raj Bhattacharjea <raj.b@gatech.edu>
18
 * Author: Raj Bhattacharjea <raj.b@gatech.edu>
19
 */
19
 */
20
20
21
#define __STDC_LIMIT_MACROS
22
#include <stdint.h>
21
#include "ns3/assert.h"
23
#include "ns3/assert.h"
22
#include "ns3/log.h"
24
#include "ns3/log.h"
23
#include "ns3/nstime.h"
25
#include "ns3/nstime.h"
 Lines 29-34    Link Here 
29
#include "ns3/simulator.h"
31
#include "ns3/simulator.h"
30
#include "ns3/ipv4-route.h"
32
#include "ns3/ipv4-route.h"
31
#include "ns3/ipv6-route.h"
33
#include "ns3/ipv6-route.h"
34
#include "ns3/random-variable-stream.h"
32
35
33
#include "tcp-l4-protocol.h"
36
#include "tcp-l4-protocol.h"
34
#include "tcp-header.h"
37
#include "tcp-header.h"
 Lines 92-97    Link Here 
92
{
95
{
93
  NS_LOG_FUNCTION_NOARGS ();
96
  NS_LOG_FUNCTION_NOARGS ();
94
  NS_LOG_LOGIC ("Made a TcpL4Protocol " << this);
97
  NS_LOG_LOGIC ("Made a TcpL4Protocol " << this);
98
  m_isnGenerator = CreateObject<UniformRandomVariable> ();
95
}
99
}
96
100
97
TcpL4Protocol::~TcpL4Protocol ()
101
TcpL4Protocol::~TcpL4Protocol ()
 Lines 99-104    Link Here 
99
  NS_LOG_FUNCTION (this);
103
  NS_LOG_FUNCTION (this);
100
}
104
}
101
105
106
int64_t
107
TcpL4Protocol::AssignStreams (int64_t stream)
108
{
109
  NS_LOG_FUNCTION (this << stream);
110
  m_isnGenerator->SetStream (stream);
111
  return 1;
112
}
113
102
void
114
void
103
TcpL4Protocol::SetNode (Ptr<Node> node)
115
TcpL4Protocol::SetNode (Ptr<Node> node)
104
{
116
{
 Lines 190-195    Link Here 
190
  socket->SetTcp (this);
202
  socket->SetTcp (this);
191
  socket->SetRtt (rtt);
203
  socket->SetRtt (rtt);
192
  socket->SetCongestionControlAlgorithm (algo);
204
  socket->SetCongestionControlAlgorithm (algo);
205
  socket->SetInitialSequence (m_isnGenerator->GetInteger (0, UINT32_MAX));
193
206
194
  m_sockets.push_back (socket);
207
  m_sockets.push_back (socket);
195
  return socket;
208
  return socket;
 Lines 697-702    Link Here 
697
      ++it;
710
      ++it;
698
    }
711
    }
699
712
713
  socket->SetInitialSequence (m_isnGenerator->GetInteger (0, UINT32_MAX));
700
  m_sockets.push_back (socket);
714
  m_sockets.push_back (socket);
701
}
715
}
702
716
(-)a/src/internet/model/tcp-l4-protocol.h (+12 lines)
 Lines 40-45    Link Here 
40
class TcpSocketBase;
40
class TcpSocketBase;
41
class Ipv4EndPoint;
41
class Ipv4EndPoint;
42
class Ipv6EndPoint;
42
class Ipv6EndPoint;
43
class UniformRandomVariable;
43
44
44
/**
45
/**
45
 * \ingroup tcp
46
 * \ingroup tcp
 Lines 210-215    Link Here 
210
   */
211
   */
211
  void DeAllocate (Ipv6EndPoint *endPoint);
212
  void DeAllocate (Ipv6EndPoint *endPoint);
212
213
214
  /**
215
   * Assign a fixed random variable stream number to the random variables
216
   * used by this model.  Return the number of streams (possibly zero) that
217
   * have been assigned.
218
   *
219
   * \param stream first stream index to use
220
   * \return the number of stream indices assigned by this model
221
   */
222
  int64_t AssignStreams (int64_t stream);
223
213
  // From IpL4Protocol
224
  // From IpL4Protocol
214
  virtual enum IpL4Protocol::RxStatus Receive (Ptr<Packet> p,
225
  virtual enum IpL4Protocol::RxStatus Receive (Ptr<Packet> p,
215
                                               Ipv4Header const &incomingIpHeader,
226
                                               Ipv4Header const &incomingIpHeader,
 Lines 281-286    Link Here 
281
  Ptr<Node> m_node;                //!< the node this stack is associated with
292
  Ptr<Node> m_node;                //!< the node this stack is associated with
282
  Ipv4EndPointDemux *m_endPoints;  //!< A list of IPv4 end points.
293
  Ipv4EndPointDemux *m_endPoints;  //!< A list of IPv4 end points.
283
  Ipv6EndPointDemux *m_endPoints6; //!< A list of IPv6 end points.
294
  Ipv6EndPointDemux *m_endPoints6; //!< A list of IPv6 end points.
295
  Ptr<UniformRandomVariable> m_isnGenerator; //! Generate TCP initial seq no
284
  TypeId m_rttTypeId;              //!< The RTT Estimator TypeId
296
  TypeId m_rttTypeId;              //!< The RTT Estimator TypeId
285
  TypeId m_congestionTypeId;       //!< The socket TypeId
297
  TypeId m_congestionTypeId;       //!< The socket TypeId
286
  std::vector<Ptr<TcpSocketBase> > m_sockets;      //!< list of sockets
298
  std::vector<Ptr<TcpSocketBase> > m_sockets;      //!< list of sockets
(-)a/src/internet/model/tcp-socket-base.cc (+8 lines)
 Lines 447-452    Link Here 
447
  m_tcp = tcp;
447
  m_tcp = tcp;
448
}
448
}
449
449
450
void
451
TcpSocketBase::SetInitialSequence (uint32_t initialSequence)
452
{
453
  NS_LOG_FUNCTION (this << initialSequence);
454
  NS_ABORT_MSG_IF (m_state > LISTEN, "cannot set initial sequence number on socket with state " << m_state);
455
  m_nextTxSequence = initialSequence;
456
}
457
450
/* Set an RTT estimator with this socket */
458
/* Set an RTT estimator with this socket */
451
void
459
void
452
TcpSocketBase::SetRtt (Ptr<RttEstimator> rtt)
460
TcpSocketBase::SetRtt (Ptr<RttEstimator> rtt)
(-)a/src/internet/model/tcp-socket-base.h (+9 lines)
 Lines 285-290    Link Here 
285
  virtual void SetTcp (Ptr<TcpL4Protocol> tcp);
285
  virtual void SetTcp (Ptr<TcpL4Protocol> tcp);
286
286
287
  /**
287
  /**
288
   * \brief Set TCP initial sequence number
289
   * \param initialSequence the value to set
290
   *
291
   * This method will error exit the simulation if the socket state is
292
   * not equal to CLOSED or LISTEN
293
   */
294
  virtual void SetInitialSequence (uint32_t initialSequence);
295
296
  /**
288
   * \brief Set the associated RTT estimator.
297
   * \brief Set the associated RTT estimator.
289
   * \param rtt the RTT estimator
298
   * \param rtt the RTT estimator
290
   */
299
   */

Return to bug 2264