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

(-)a/src/aodv/test/bug-772.cc (+3 lines)
 Lines 81-86    Link Here 
81
  RngSeedManager::SetSeed (12345);
81
  RngSeedManager::SetSeed (12345);
82
  RngSeedManager::SetRun (7);
82
  RngSeedManager::SetRun (7);
83
83
84
  // Traces are based on initial sequence number of zero
85
  Config::SetDefault ("ns3::TcpL4Protocol::IsnRandomVariable", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
86
84
  CreateNodes ();
87
  CreateNodes ();
85
  CreateDevices ();
88
  CreateDevices ();
86
89
(-)a/src/internet/model/tcp-l4-protocol.cc (+18 lines)
 Lines 29-34    Link Here 
29
#include "ns3/simulator.h"
29
#include "ns3/simulator.h"
30
#include "ns3/ipv4-route.h"
30
#include "ns3/ipv4-route.h"
31
#include "ns3/ipv6-route.h"
31
#include "ns3/ipv6-route.h"
32
#include "ns3/random-variable-stream.h"
33
#include "ns3/string.h"
34
#include "ns3/pointer.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 83-88    Link Here 
83
                   ObjectVectorValue (),
86
                   ObjectVectorValue (),
84
                   MakeObjectVectorAccessor (&TcpL4Protocol::m_sockets),
87
                   MakeObjectVectorAccessor (&TcpL4Protocol::m_sockets),
85
                   MakeObjectVectorChecker<TcpSocketBase> ())
88
                   MakeObjectVectorChecker<TcpSocketBase> ())
89
   .AddAttribute ("IsnRandomVariable",
90
                   "Random variable used to generate an initial sequence number.",
91
                   StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=4294967295.0]"),
92
                   MakePointerAccessor (&TcpL4Protocol::m_isnGenerator),
93
                   MakePointerChecker<RandomVariableStream> ())
86
  ;
94
  ;
87
  return tid;
95
  return tid;
88
}
96
}
 Lines 99-104    Link Here 
99
  NS_LOG_FUNCTION (this);
107
  NS_LOG_FUNCTION (this);
100
}
108
}
101
109
110
int64_t
111
TcpL4Protocol::AssignStreams (int64_t stream)
112
{
113
  NS_LOG_FUNCTION (this << stream);
114
  m_isnGenerator->SetStream (stream);
115
  return 1;
116
}
117
102
void
118
void
103
TcpL4Protocol::SetNode (Ptr<Node> node)
119
TcpL4Protocol::SetNode (Ptr<Node> node)
104
{
120
{
 Lines 190-195    Link Here 
190
  socket->SetTcp (this);
206
  socket->SetTcp (this);
191
  socket->SetRtt (rtt);
207
  socket->SetRtt (rtt);
192
  socket->SetCongestionControlAlgorithm (algo);
208
  socket->SetCongestionControlAlgorithm (algo);
209
  socket->SetInitialSequence (m_isnGenerator->GetInteger ());
193
210
194
  m_sockets.push_back (socket);
211
  m_sockets.push_back (socket);
195
  return socket;
212
  return socket;
 Lines 697-702    Link Here 
697
      ++it;
714
      ++it;
698
    }
715
    }
699
716
717
  socket->SetInitialSequence (m_isnGenerator->GetInteger ());
700
  m_sockets.push_back (socket);
718
  m_sockets.push_back (socket);
701
}
719
}
702
720
(-)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 RandomVariableStream;
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<RandomVariableStream> 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 (-3 / +13 lines)
 Lines 269-276    Link Here 
269
    m_node (0),
269
    m_node (0),
270
    m_tcp (0),
270
    m_tcp (0),
271
    m_rtt (0),
271
    m_rtt (0),
272
    m_nextTxSequence (0), // Change this for non-zero initial sequence number
272
    m_nextTxSequence (0), // Can be changed with SetInitialSequence ()
273
    m_highTxMark (0),
273
    m_highTxMark (0), // Should track the m_nextTxSequence initialization
274
    m_state (CLOSED),
274
    m_state (CLOSED),
275
    m_errno (ERROR_NOTERROR),
275
    m_errno (ERROR_NOTERROR),
276
    m_closeNotified (false),
276
    m_closeNotified (false),
 Lines 291-297    Link Here 
291
    m_timestampEnabled (true),
291
    m_timestampEnabled (true),
292
    m_timestampToEcho (0),
292
    m_timestampToEcho (0),
293
    m_sendPendingDataEvent (),
293
    m_sendPendingDataEvent (),
294
    m_recover (0), // Set to the initial sequence number
294
    m_recover (0), // Should track the m_nextTxSequence initialization
295
    m_retxThresh (3),
295
    m_retxThresh (3),
296
    m_limitedTx (false),
296
    m_limitedTx (false),
297
    m_congestionControl (0),
297
    m_congestionControl (0),
 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
  m_recover = initialSequence;
457
  m_highTxMark = initialSequence;
458
}
459
450
/* Set an RTT estimator with this socket */
460
/* Set an RTT estimator with this socket */
451
void
461
void
452
TcpSocketBase::SetRtt (Ptr<RttEstimator> rtt)
462
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
   */
(-)a/src/internet/test/tcp-fast-retr-test.cc (+8 lines)
 Lines 20-25    Link Here 
20
#include "tcp-fast-retr-test.h"
20
#include "tcp-fast-retr-test.h"
21
#include "ns3/tcp-westwood.h"
21
#include "ns3/tcp-westwood.h"
22
#include "ns3/node.h"
22
#include "ns3/node.h"
23
#include "ns3/config.h"
24
#include "ns3/string.h"
23
25
24
namespace ns3 {
26
namespace ns3 {
25
27
 Lines 40-45    Link Here 
40
{
42
{
41
}
43
}
42
44
45
void
46
TcpFastRetrTest::DoSetup (void)
47
{
48
  Config::SetDefault ("ns3::TcpL4Protocol::IsnRandomVariable", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
49
}
50
43
Ptr<ErrorModel>
51
Ptr<ErrorModel>
44
TcpFastRetrTest::CreateSenderErrorModel ()
52
TcpFastRetrTest::CreateSenderErrorModel ()
45
{
53
{
(-)a/src/internet/test/tcp-fast-retr-test.h (+4 lines)
 Lines 60-65    Link Here 
60
  void PktDropped (const Ipv4Header &ipH, const TcpHeader& tcpH);
60
  void PktDropped (const Ipv4Header &ipH, const TcpHeader& tcpH);
61
  void FinalChecks ();
61
  void FinalChecks ();
62
62
63
private:
64
  virtual void DoSetup (void);
65
66
protected:
63
  bool m_pktDropped;
67
  bool m_pktDropped;
64
  bool m_pktWasDropped;
68
  bool m_pktWasDropped;
65
  uint32_t m_seqToKill;
69
  uint32_t m_seqToKill;
(-)a/src/internet/test/tcp-rto-test.cc (+8 lines)
 Lines 21-26    Link Here 
21
21
22
#include "ns3/node.h"
22
#include "ns3/node.h"
23
#include "ns3/log.h"
23
#include "ns3/log.h"
24
#include "ns3/config.h"
25
#include "ns3/string.h"
24
#include "ns3/tcp-westwood.h"
26
#include "ns3/tcp-westwood.h"
25
27
26
namespace ns3 {
28
namespace ns3 {
 Lines 35-40    Link Here 
35
{
37
{
36
}
38
}
37
39
40
void
41
TcpRtoTest::DoSetup (void)
42
{
43
  Config::SetDefault ("ns3::TcpL4Protocol::IsnRandomVariable", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
44
}
45
38
Ptr<TcpSocketMsgBase>
46
Ptr<TcpSocketMsgBase>
39
TcpRtoTest::CreateSenderSocket (Ptr<Node> node)
47
TcpRtoTest::CreateSenderSocket (Ptr<Node> node)
40
{
48
{
(-)a/src/internet/test/tcp-rto-test.h (+2 lines)
 Lines 49-54    Link Here 
49
  virtual void FinalChecks ();
49
  virtual void FinalChecks ();
50
50
51
private:
51
private:
52
  virtual void DoSetup (void);
53
52
  bool m_rtoExpired;
54
  bool m_rtoExpired;
53
  bool m_segmentReceived;
55
  bool m_segmentReceived;
54
};
56
};
(-)a/src/internet/test/tcp-zero-window-test.cc (+10 lines)
 Lines 20-26    Link Here 
20
#include "tcp-general-test.h"
20
#include "tcp-general-test.h"
21
#include "tcp-error-model.h"
21
#include "tcp-error-model.h"
22
#include "ns3/node.h"
22
#include "ns3/node.h"
23
#include "ns3/config.h"
23
#include "ns3/log.h"
24
#include "ns3/log.h"
25
#include "ns3/string.h"
24
26
25
namespace ns3 {
27
namespace ns3 {
26
28
 Lines 43-48    Link Here 
43
  void FinalChecks ();
45
  void FinalChecks ();
44
46
45
  void IncreaseBufSize ();
47
  void IncreaseBufSize ();
48
private:
49
  virtual void DoSetup (void);
46
50
47
protected:
51
protected:
48
  EventId m_receivePktEvent;
52
  EventId m_receivePktEvent;
 Lines 63-68    Link Here 
63
}
67
}
64
68
65
void
69
void
70
TcpZeroWindowTest::DoSetup (void)
71
{
72
  Config::SetDefault ("ns3::TcpL4Protocol::IsnRandomVariable", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
73
}
74
75
void
66
TcpZeroWindowTest::IncreaseBufSize ()
76
TcpZeroWindowTest::IncreaseBufSize ()
67
{
77
{
68
  SetRcvBufSize (RECEIVER, 2500);
78
  SetRcvBufSize (RECEIVER, 2500);

Return to bug 2264