merge with HEAD
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Fri, 11 Apr 2008 11:20:05 -0700
changeset 2907 ebc23fe98852
parent 2906 5a7ae076410e (current diff)
parent 2904 413ef952ea19 (diff)
child 2909 30c9b48a3af3
merge with HEAD
--- a/examples/csma-broadcast.cc	Fri Apr 11 11:19:54 2008 -0700
+++ b/examples/csma-broadcast.cc	Fri Apr 11 11:20:05 2008 -0700
@@ -74,10 +74,8 @@
   NetDeviceContainer n0 = csma.Install (c0);
   NetDeviceContainer n1 = csma.Install (c1);
 
-
   InternetStackHelper internet;
-  internet.Install (c0);
-  internet.Install (c1);
+  internet.Install (c);
 
   NS_LOG_INFO ("Assign IP Addresses.");
   Ipv4AddressHelper ipv4;
--- a/examples/csma-multicast.cc	Fri Apr 11 11:19:54 2008 -0700
+++ b/examples/csma-multicast.cc	Fri Apr 11 11:20:05 2008 -0700
@@ -84,8 +84,7 @@
 
   NS_LOG_INFO ("Add IP Stack.");
   InternetStackHelper internet;
-  internet.Install (c0);
-  internet.Install (c1);
+  internet.Install (c);
 
   NS_LOG_INFO ("Assign IP Addresses.");
   Ipv4AddressHelper ipv4Addr;
--- a/src/core/config.cc	Fri Apr 11 11:19:54 2008 -0700
+++ b/src/core/config.cc	Fri Apr 11 11:20:05 2008 -0700
@@ -190,7 +190,7 @@
     {
       // This is a call to GetObject
       std::string tidString = item.substr (1, item.size () - 1);
-      NS_LOG_DEBUG ("GetObject="<<tidString<<"on path="<<GetResolvedPath (""));
+      NS_LOG_DEBUG ("GetObject="<<tidString<<" on path="<<GetResolvedPath (""));
       TypeId tid = TypeId::LookupByName (tidString);
       Ptr<Object> object = root->GetObject<Object> (tid);
       if (object == 0)
--- a/src/core/object.cc	Fri Apr 11 11:19:54 2008 -0700
+++ b/src/core/object.cc	Fri Apr 11 11:20:05 2008 -0700
@@ -114,6 +114,13 @@
   NS_ASSERT (!o->m_disposed);
   NS_ASSERT (CheckLoose ());
   NS_ASSERT (o->CheckLoose ());
+
+  if (DoGetObject (o->m_tid))
+    {
+      NS_FATAL_ERROR ("Object::AggregateObject(): "
+       "Multiple aggregation of objects of type " << o->m_tid.GetName ());
+    }
+
   Object *other = PeekPointer (o);
   Object *next = m_next;
   m_next = other->m_next;
--- a/src/core/traced-value.h	Fri Apr 11 11:19:54 2008 -0700
+++ b/src/core/traced-value.h	Fri Apr 11 11:20:05 2008 -0700
@@ -118,6 +118,12 @@
   TracedCallback<T,T> m_cb;
 };
 
+template <typename T>
+std::ostream& operator << (std::ostream& os, const TracedValue<T>& rhs)
+{
+  return os<<rhs.Get();
+}
+
 template <typename T, typename U>
 bool operator == (const TracedValue<T> &lhs, const TracedValue<U> &rhs)
 {
--- a/src/internet-node/tcp-socket.cc	Fri Apr 11 11:19:54 2008 -0700
+++ b/src/internet-node/tcp-socket.cc	Fri Apr 11 11:20:05 2008 -0700
@@ -31,6 +31,7 @@
 #include "tcp-typedefs.h"
 #include "ns3/simulator.h"
 #include "ns3/packet.h"
+#include "ns3/trace-source-accessor.h"
 
 #include <algorithm>
 
@@ -40,6 +41,20 @@
 
 namespace ns3 {
 
+NS_OBJECT_ENSURE_REGISTERED (TcpSocket);
+
+TypeId
+TcpSocket::GetTypeId ()
+{
+  static TypeId tid = TypeId("ns3::TcpSocket")
+    .SetParent<Socket> ()
+    .AddTraceSource ("CongestionWindow",
+                     "The TCP connection's congestion window",
+                     MakeTraceSourceAccessor (&TcpSocket::m_cWnd))
+    ;
+  return tid;
+}
+
   TcpSocket::TcpSocket ()
   : m_skipRetxResched (false),
     m_dupAckCount (0),
@@ -899,7 +914,7 @@
 {
   NS_LOG_FUNCTION;
   NS_LOG_LOGIC ("TcpSocket::Window() "<<this);
-  return std::min (m_rxWindowSize, m_cWnd);
+  return std::min (m_rxWindowSize, m_cWnd.Get());
 }
 
 uint32_t  TcpSocket::AvailableWindow ()
@@ -1120,7 +1135,7 @@
     }
   else
     { // Congestion avoidance mode, adjust by (ackBytes*segSize) / cWnd
-      double adder =  ((double) m_segmentSize * m_segmentSize) / m_cWnd;
+      double adder =  ((double) m_segmentSize * m_segmentSize) / m_cWnd.Get();
       if (adder < 1.0) 
         {
           adder = 1.0;
--- a/src/internet-node/tcp-socket.h	Fri Apr 11 11:19:54 2008 -0700
+++ b/src/internet-node/tcp-socket.h	Fri Apr 11 11:20:05 2008 -0700
@@ -22,6 +22,7 @@
 
 #include <stdint.h>
 #include "ns3/callback.h"
+#include "ns3/traced-value.h"
 #include "ns3/socket.h"
 #include "ns3/ptr.h"
 #include "ns3/ipv4-address.h"
@@ -31,6 +32,7 @@
 #include "sequence-number.h"
 #include "rtt-estimator.h"
 
+
 namespace ns3 {
 
 class Ipv4EndPoint;
@@ -42,6 +44,7 @@
 class TcpSocket : public Socket
 {
 public:
+  static TypeId GetTypeId (void);
   /**
    * Create an unbound tcp socket.
    */
@@ -152,12 +155,12 @@
   SequenceNumber m_firstPendingSequence;
 
   // Window management
-  uint32_t          m_segmentSize;                     // SegmentSize
-  uint32_t          m_rxWindowSize;
-  uint32_t          m_advertisedWindowSize;            // Window to advertise to peer
-  uint32_t          m_cWnd;            // Congestion window
-  uint32_t          m_ssThresh;                     // Slow Start Threshold
-  uint32_t          m_initialCWnd;     // Initial (and reset) value for cWnd
+  uint32_t                       m_segmentSize;          //SegmentSize
+  uint32_t                       m_rxWindowSize;
+  uint32_t                       m_advertisedWindowSize; //Window to advertise
+  TracedValue<uint32_t>          m_cWnd;                 //Congestion window
+  uint32_t                       m_ssThresh;             //Slow Start Threshold
+  uint32_t                       m_initialCWnd;          //Initial cWnd value
 
   // Round trip time estimation
   Ptr<RttEstimator> m_rtt;
--- a/src/node/tcp.cc	Fri Apr 11 11:19:54 2008 -0700
+++ b/src/node/tcp.cc	Fri Apr 11 11:20:05 2008 -0700
@@ -30,52 +30,52 @@
 {
   static TypeId tid = TypeId ("ns3::Tcp")
     .SetParent<SocketFactory> ()
-   .AddAttribute ("TcpDefaultSegmentSize",
-                  "Default TCP maximum segment size in bytes (may be adjusted based on MTU discovery)",
-                  Uinteger (536),
-                  MakeUintegerAccessor (&Tcp::m_defaultSegSize),
-                  MakeUintegerChecker<uint32_t> ())
-    .AddAttribute ("TcpDefaultAdvertisedWindowSize",
+    .AddAttribute ("DefaultSegmentSize",
+                   "Default TCP maximum segment size in bytes (may be adjusted based on MTU discovery)",
+                   Uinteger (536),
+                   MakeUintegerAccessor (&Tcp::m_defaultSegSize),
+                   MakeUintegerChecker<uint32_t> ())
+    .AddAttribute ("DefaultAdvertisedWindowSize",
                    "Default TCP advertised window size (bytes)",
                    Uinteger (0xffff),
                    MakeUintegerAccessor (&Tcp::m_defaultAdvWin),
                    MakeUintegerChecker<uint32_t> ())
-    .AddAttribute ("TcpDefaultSlowStartThreshold",
+    .AddAttribute ("DefaultSlowStartThreshold",
                    "Default TCP slow start threshold (bytes)",
                    Uinteger (0xffff),
                    MakeUintegerAccessor (&Tcp::m_defaultSsThresh),
                    MakeUintegerChecker<uint32_t> ())
-    .AddAttribute ("TcpDefaultTxBufferSize",
+    .AddAttribute ("DefaultTxBufferSize",
                    "Default TCP maximum transmit buffer size (bytes)",
                    Uinteger (0xffffffffl),
                    MakeUintegerAccessor (&Tcp::m_defaultTxBuffer),
                    MakeUintegerChecker<uint32_t> ())
-    .AddAttribute ("TcpDefaultRxBufferSize",
+    .AddAttribute ("DefaultRxBufferSize",
                    "Default TCP maximum receive buffer size (bytes)",
                    Uinteger (0xffffffffl),
                    MakeUintegerAccessor (&Tcp::m_defaultRxBuffer),
                    MakeUintegerChecker<uint32_t> ())
-    .AddAttribute ("TcpDefaultInitialCongestionWindowSize",
+    .AddAttribute ("DefaultInitialCongestionWindowSize",
                    "Default TCP initial congestion window size (segments)",
                    Uinteger (1),
                    MakeUintegerAccessor (&Tcp::m_defaultInitialCwnd),
                    MakeUintegerChecker<uint32_t> ())
-    .AddAttribute ("TcpDefaultConnTimeout",
+    .AddAttribute ("DefaultConnTimeout",
                    "Default TCP retransmission timeout when opening connection (seconds)",
                    Uinteger (3),
                    MakeUintegerAccessor (&Tcp::m_defaultConnTimeout),
                    MakeUintegerChecker<uint32_t> ())
-    .AddAttribute ("TcpDefaultConnCount",
+    .AddAttribute ("DefaultConnCount",
                    "Default number of connection attempts (SYN retransmissions) before returning failure",
                    Uinteger (6),
                    MakeUintegerAccessor (&Tcp::m_defaultConnCount),
                    MakeUintegerChecker<uint32_t> ())
-    .AddAttribute ("TcpDefaultDelAckTimeout",
+    .AddAttribute ("DefaultDelAckTimeout",
                    "Default timeout value for TCP delayed acks, in seconds",
                    Double (0.2),
                    MakeDoubleAccessor (&Tcp::m_defaultDelAckTimeout),
                    MakeDoubleChecker<double> ())
-    .AddAttribute ("TcpDefaultDelAckCount",
+    .AddAttribute ("DefaultDelAckCount",
                    "Default number of packets to wait before sending a TCP ack",
                    Uinteger (2),
                    MakeUintegerAccessor (&Tcp::m_defaultDelAckCount),