merge
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Sun May 04 22:46:31 2008 +0100 (21 months ago)
changeset 30047a63e3c78cd0
parent 3003 2438c0f2f9dd
parent 3000 bd2d3e32ef7b
child 3005 cc521f35f033
merge
     1.1 --- a/examples/csma-broadcast.cc	Sun May 04 22:43:18 2008 +0100
     1.2 +++ b/examples/csma-broadcast.cc	Sun May 04 22:46:31 2008 +0100
     1.3 @@ -113,10 +113,10 @@
     1.4    // The output files will be named 
     1.5    // csma-broadcast.pcap-<nodeId>-<interfaceId>
     1.6    // and can be read by the "tcpdump -tt -r" command 
     1.7 -  CsmaHelper::EnablePcap ("csma-broadcast");
     1.8 +  CsmaHelper::EnablePcapAll ("csma-broadcast");
     1.9    std::ofstream ascii;
    1.10    ascii.open ("csma-broadcast.tr");
    1.11 -  CsmaHelper::EnableAscii (ascii);
    1.12 +  CsmaHelper::EnableAsciiAll (ascii);
    1.13  
    1.14    NS_LOG_INFO ("Run Simulation.");
    1.15    Simulator::Run ();    
     2.1 --- a/examples/csma-multicast.cc	Sun May 04 22:43:18 2008 +0100
     2.2 +++ b/examples/csma-multicast.cc	Sun May 04 22:46:31 2008 +0100
     2.3 @@ -172,14 +172,14 @@
     2.4    //
     2.5    std::ofstream ascii;
     2.6    ascii.open ("csma-multicast.tr");
     2.7 -  CsmaHelper::EnableAscii (ascii);
     2.8 +  CsmaHelper::EnableAsciiAll (ascii);
     2.9  
    2.10    // Also configure some tcpdump traces; each interface will be traced.
    2.11    // The output files will be named:
    2.12    //     csma-multicast.pcap-<nodeId>-<interfaceId>
    2.13    // and can be read by the "tcpdump -r" command (use "-tt" option to
    2.14    // display timestamps correctly)
    2.15 -  CsmaHelper::EnablePcap ("csma-multicast");
    2.16 +  CsmaHelper::EnablePcapAll ("csma-multicast");
    2.17    //
    2.18    // Now, do the actual simulation.
    2.19    //
     3.1 --- a/examples/csma-one-subnet.cc	Sun May 04 22:43:18 2008 +0100
     3.2 +++ b/examples/csma-one-subnet.cc	Sun May 04 22:46:31 2008 +0100
     3.3 @@ -128,7 +128,7 @@
     3.4    NS_LOG_INFO ("Configure Tracing.");
     3.5    std::ofstream ascii;
     3.6    ascii.open ("csma-one-subnet.tr");
     3.7 -  CsmaHelper::EnableAscii (ascii);
     3.8 +  CsmaHelper::EnableAsciiAll (ascii);
     3.9  //
    3.10  // Also configure some tcpdump traces; each interface will be traced.
    3.11  // The output files will be named:
    3.12 @@ -136,7 +136,7 @@
    3.13  // and can be read by the "tcpdump -r" command (use "-tt" option to
    3.14  // display timestamps correctly)
    3.15  //
    3.16 -  CsmaHelper::EnablePcap ("csma-one-subnet");
    3.17 +  CsmaHelper::EnablePcapAll ("csma-one-subnet");
    3.18  //
    3.19  // Now, do the actual simulation.
    3.20  //
     4.1 --- a/examples/mixed-global-routing.cc	Sun May 04 22:43:18 2008 +0100
     4.2 +++ b/examples/mixed-global-routing.cc	Sun May 04 22:46:31 2008 +0100
     4.3 @@ -125,10 +125,10 @@
     4.4  
     4.5    std::ofstream ascii;
     4.6    ascii.open ("mixed-global-routing.tr");
     4.7 -  PointToPointHelper::EnablePcap ("mixed-global-routing");
     4.8 -  PointToPointHelper::EnableAscii (ascii);
     4.9 -  CsmaHelper::EnablePcap ("mixed-global-routing");
    4.10 -  CsmaHelper::EnableAscii (ascii);
    4.11 +  PointToPointHelper::EnablePcapAll ("mixed-global-routing");
    4.12 +  PointToPointHelper::EnableAsciiAll (ascii);
    4.13 +  CsmaHelper::EnablePcapAll ("mixed-global-routing");
    4.14 +  CsmaHelper::EnableAsciiAll (ascii);
    4.15  
    4.16  
    4.17    NS_LOG_INFO ("Run Simulation.");
     5.1 --- a/examples/mixed-wireless.cc	Sun May 04 22:43:18 2008 +0100
     5.2 +++ b/examples/mixed-wireless.cc	Sun May 04 22:46:31 2008 +0100
     5.3 @@ -166,7 +166,7 @@
     5.4                               "Bounds", RectangleValue (Rectangle (0, 1000, 0, 1000)),
     5.5                               "Speed", RandomVariableValue (ConstantVariable (2000)),
     5.6                               "Pause", RandomVariableValue (ConstantVariable (0.2)));
     5.7 -  mobility.Layout (backbone);
     5.8 +  mobility.Install (backbone);
     5.9  
    5.10    /////////////////////////////////////////////////////////////////////////// 
    5.11    //                                                                       //
    5.12 @@ -178,17 +178,19 @@
    5.13    // the "172.16 address space
    5.14    ipAddrs.SetBase ("172.16.0.0", "255.255.255.0");
    5.15  
    5.16 +
    5.17    for (uint32_t i = 0; i < backboneNodes; ++i)
    5.18      {
    5.19        NS_LOG_INFO ("Configuring local area network for backbone node " << i);
    5.20        //
    5.21 -      // Create a container to manage the nodes of the LAN.  Pick one of 
    5.22 -      // the backbone nodes to be part of the LAN and first add it to 
    5.23 -      // the container.  Then create the rest of the nodes we'll need.
    5.24 +      // Create a container to manage the nodes of the LAN.  We need
    5.25 +      // two containers here; one with all of the new nodes, and one
    5.26 +      // with all of the nodes including new and existing nodes
    5.27        //
    5.28 -      NodeContainer lan;
    5.29 -      lan.Add (backbone.Get (i));
    5.30 -      lan.Create (lanNodes - 1);
    5.31 +      NodeContainer newLanNodes;
    5.32 +      newLanNodes.Create (lanNodes - 1);
    5.33 +      // Now, create the container with all nodes on this link
    5.34 +      NodeContainer lan (backbone.Get (i), newLanNodes);
    5.35        //
    5.36        // Create the CSMA net devices and install them into the nodes in our 
    5.37        // collection.
    5.38 @@ -198,9 +200,9 @@
    5.39        csma.SetChannelParameter ("Delay", TimeValue (MilliSeconds (2)));
    5.40        NetDeviceContainer lanDevices = csma.Install (lan);
    5.41        //
    5.42 -      // Add the IPv4 protocol stack to the nodes in our container
    5.43 +      // Add the IPv4 protocol stack to the new LAN nodes
    5.44        //
    5.45 -      internet.Install (lan);
    5.46 +      internet.Install (newLanNodes);
    5.47        //
    5.48        // Assign IPv4 addresses to the device drivers (actually to the 
    5.49        // associated IPv4 interfaces) we just created.
    5.50 @@ -227,13 +229,14 @@
    5.51      {
    5.52        NS_LOG_INFO ("Configuring wireless network for backbone node " << i);
    5.53        //
    5.54 -      // Create a container to manage the nodes of the network.  Pick one of 
    5.55 -      // the backbone nodes to be part of the network and first add it to 
    5.56 -      // the container.  Then create the rest of the nodes we'll need.
    5.57 +      // Create a container to manage the nodes of the LAN.  We need
    5.58 +      // two containers here; one with all of the new nodes, and one
    5.59 +      // with all of the nodes including new and existing nodes
    5.60        //
    5.61 -      NodeContainer infra;
    5.62 -      infra.Add (backbone.Get (i));
    5.63 -      infra.Create (infraNodes - 1);
    5.64 +      NodeContainer newInfraNodes;
    5.65 +      newInfraNodes.Create (infraNodes - 1);
    5.66 +      // Now, create the container with all nodes on this link
    5.67 +      NodeContainer infra (backbone.Get (i), newInfraNodes);
    5.68        //
    5.69        // Create another ad hoc network and devices
    5.70        //
    5.71 @@ -244,7 +247,7 @@
    5.72  
    5.73        // Add the IPv4 protocol stack to the nodes in our container
    5.74        //
    5.75 -      internet.Install (infra);
    5.76 +      internet.Install (newInfraNodes);
    5.77        //
    5.78        // Assign IPv4 addresses to the device drivers (actually to the associated
    5.79        // IPv4 interfaces) we just created.
    5.80 @@ -272,7 +275,7 @@
    5.81                                   "Bounds", RectangleValue (Rectangle (-25, 25, -25, 25)),
    5.82                                   "Speed", RandomVariableValue (ConstantVariable (30)),
    5.83                                   "Pause", RandomVariableValue (ConstantVariable (0.4)));
    5.84 -      mobility.Layout (infra);
    5.85 +      mobility.Install (infra);
    5.86      }
    5.87    /////////////////////////////////////////////////////////////////////////// 
    5.88    //                                                                       //
    5.89 @@ -282,7 +285,7 @@
    5.90  
    5.91    NS_LOG_INFO ("Enabling OLSR routing on all backbone nodes");
    5.92    OlsrHelper olsr;
    5.93 -  olsr.Enable (backbone);
    5.94 +  olsr.Install (backbone);
    5.95  
    5.96    /////////////////////////////////////////////////////////////////////////// 
    5.97    //                                                                       //
    5.98 @@ -332,8 +335,8 @@
    5.99    // asciiTrace.TraceNetDeviceRx ("/NodeList/11|13/DeviceList/0");
   5.100    std::ofstream ascii;
   5.101    ascii.open ("mixed-wireless.tr");
   5.102 -  WifiHelper::EnableAscii (ascii);
   5.103 -  CsmaHelper::EnableAscii (ascii);
   5.104 +  WifiHelper::EnableAsciiAll (ascii);
   5.105 +  CsmaHelper::EnableAsciiAll (ascii);
   5.106  
   5.107    // Let's do a pcap trace on the backbone devices
   5.108    WifiHelper::EnablePcap ("mixed-wireless.pcap", backboneDevices); 
     6.1 --- a/examples/simple-alternate-routing.cc	Sun May 04 22:43:18 2008 +0100
     6.2 +++ b/examples/simple-alternate-routing.cc	Sun May 04 22:46:31 2008 +0100
     6.3 @@ -159,8 +159,8 @@
     6.4  
     6.5    std::ofstream ascii;
     6.6    ascii.open ("simple-alternate-routing.tr");
     6.7 -  PointToPointHelper::EnablePcap ("simple-alternate-routing");
     6.8 -  PointToPointHelper::EnableAscii (ascii);
     6.9 +  PointToPointHelper::EnablePcapAll ("simple-alternate-routing");
    6.10 +  PointToPointHelper::EnableAsciiAll (ascii);
    6.11  
    6.12    NS_LOG_INFO ("Run Simulation.");
    6.13    Simulator::Run ();
     7.1 --- a/examples/simple-error-model.cc	Sun May 04 22:43:18 2008 +0100
     7.2 +++ b/examples/simple-error-model.cc	Sun May 04 22:46:31 2008 +0100
     7.3 @@ -173,8 +173,8 @@
     7.4  
     7.5    std::ofstream ascii;
     7.6    ascii.open ("simple-error-model.tr");
     7.7 -  PointToPointHelper::EnablePcap ("simple-error-model");
     7.8 -  PointToPointHelper::EnableAscii (ascii);
     7.9 +  PointToPointHelper::EnablePcapAll ("simple-error-model");
    7.10 +  PointToPointHelper::EnableAsciiAll (ascii);
    7.11  
    7.12    NS_LOG_INFO ("Run Simulation.");
    7.13    Simulator::Run ();    
     8.1 --- a/examples/simple-global-routing.cc	Sun May 04 22:43:18 2008 +0100
     8.2 +++ b/examples/simple-global-routing.cc	Sun May 04 22:46:31 2008 +0100
     8.3 @@ -151,8 +151,8 @@
     8.4  
     8.5    std::ofstream ascii;
     8.6    ascii.open ("simple-global-routing.tr");
     8.7 -  PointToPointHelper::EnablePcap ("simple-global-routing");
     8.8 -  PointToPointHelper::EnableAscii (ascii);
     8.9 +  PointToPointHelper::EnablePcapAll ("simple-global-routing");
    8.10 +  PointToPointHelper::EnableAsciiAll (ascii);
    8.11  
    8.12    NS_LOG_INFO ("Run Simulation.");
    8.13    Simulator::Run ();
     9.1 --- a/examples/simple-point-to-point-olsr.cc	Sun May 04 22:43:18 2008 +0100
     9.2 +++ b/examples/simple-point-to-point-olsr.cc	Sun May 04 22:46:31 2008 +0100
     9.3 @@ -120,7 +120,7 @@
     9.4    // Enable OLSR
     9.5    NS_LOG_INFO ("Enabling OLSR Routing.");
     9.6    OlsrHelper olsr;
     9.7 -  olsr.EnableAll ();
     9.8 +  olsr.InstallAll ();
     9.9  
    9.10    // Create the OnOff application to send UDP datagrams of size
    9.11    // 210 bytes at a rate of 448 Kb/s
    9.12 @@ -158,8 +158,8 @@
    9.13  
    9.14    std::ofstream ascii;
    9.15    ascii.open ("simple-point-to-point-olsr.tr");
    9.16 -  PointToPointHelper::EnablePcap ("simple-point-to-point-olsr");
    9.17 -  PointToPointHelper::EnableAscii (ascii);
    9.18 +  PointToPointHelper::EnablePcapAll ("simple-point-to-point-olsr");
    9.19 +  PointToPointHelper::EnableAsciiAll (ascii);
    9.20  
    9.21    Simulator::StopAt (Seconds (30));
    9.22  
    10.1 --- a/examples/tcp-large-transfer.cc	Sun May 04 22:43:18 2008 +0100
    10.2 +++ b/examples/tcp-large-transfer.cc	Sun May 04 22:46:31 2008 +0100
    10.3 @@ -188,9 +188,9 @@
    10.4  
    10.5    std::ofstream ascii;
    10.6    ascii.open ("tcp-large-transfer.tr");
    10.7 -  PointToPointHelper::EnableAscii (ascii);
    10.8 +  PointToPointHelper::EnableAsciiAll (ascii);
    10.9  
   10.10 -  InternetStackHelper::EnablePcap ("tcp-large-transfer");
   10.11 +  InternetStackHelper::EnablePcapAll ("tcp-large-transfer");
   10.12  
   10.13    Simulator::StopAt (Seconds(1000));
   10.14    Simulator::Run ();
    11.1 --- a/examples/udp-echo.cc	Sun May 04 22:43:18 2008 +0100
    11.2 +++ b/examples/udp-echo.cc	Sun May 04 22:46:31 2008 +0100
    11.3 @@ -128,8 +128,8 @@
    11.4  
    11.5    std::ofstream ascii;
    11.6    ascii.open ("udp-echo.tr");
    11.7 -  CsmaHelper::EnablePcap ("udp-echo");
    11.8 -  CsmaHelper::EnableAscii (ascii);
    11.9 +  CsmaHelper::EnablePcapAll ("udp-echo");
   11.10 +  CsmaHelper::EnableAsciiAll (ascii);
   11.11  
   11.12  //
   11.13  // Now, do the actual simulation.
    12.1 --- a/examples/wifi-adhoc.cc	Sun May 04 22:43:18 2008 +0100
    12.2 +++ b/examples/wifi-adhoc.cc	Sun May 04 22:46:31 2008 +0100
    12.3 @@ -126,7 +126,7 @@
    12.4    mobility.SetPositionAllocator (positionAlloc);
    12.5    mobility.SetMobilityModel ("ns3::StaticMobilityModel");
    12.6  
    12.7 -  mobility.Layout (c);
    12.8 +  mobility.Install (c);
    12.9  
   12.10    PacketSocketAddress socket;
   12.11    socket.SetSingleDevice(devices.Get (0)->GetIfIndex ());
    13.1 --- a/examples/wifi-ap.cc	Sun May 04 22:43:18 2008 +0100
    13.2 +++ b/examples/wifi-ap.cc	Sun May 04 22:46:31 2008 +0100
    13.3 @@ -152,8 +152,8 @@
    13.4    wifi.Install (ap, channel);
    13.5  
    13.6    // mobility.
    13.7 -  mobility.Layout (stas);
    13.8 -  mobility.Layout (ap);
    13.9 +  mobility.Install (stas);
   13.10 +  mobility.Install (ap);
   13.11  
   13.12    Simulator::Schedule (Seconds (1.0), &AdvancePosition, ap.Get (0));
   13.13  
    14.1 --- a/samples/main-grid-topology.cc	Sun May 04 22:43:18 2008 +0100
    14.2 +++ b/samples/main-grid-topology.cc	Sun May 04 22:46:31 2008 +0100
    14.3 @@ -37,7 +37,7 @@
    14.4    // finalize the setup by attaching to each object
    14.5    // in the input array a position and initializing
    14.6    // this position with the calculated coordinates.
    14.7 -  mobility.Layout (nodes);
    14.8 +  mobility.Install (nodes);
    14.9  
   14.10    // iterate our nodes and print their position.
   14.11    for (NodeContainer::Iterator j = nodes.Begin ();
    15.1 --- a/samples/main-random-topology.cc	Sun May 04 22:43:18 2008 +0100
    15.2 +++ b/samples/main-random-topology.cc	Sun May 04 22:46:31 2008 +0100
    15.3 @@ -31,7 +31,7 @@
    15.4                                   "Y", StringValue ("100.0"),
    15.5                                   "Rho", StringValue ("Uniform:0:30"));
    15.6    mobility.SetMobilityModel ("ns3::StaticMobilityModel");
    15.7 -  mobility.Layout (c);
    15.8 +  mobility.Install (c);
    15.9  
   15.10    Config::Connect ("/NodeList/*/$ns3::MobilityModelNotifier/CourseChange",
   15.11                                MakeCallback (&CourseChange));
    16.1 --- a/samples/main-random-walk.cc	Sun May 04 22:43:18 2008 +0100
    16.2 +++ b/samples/main-random-walk.cc	Sun May 04 22:46:31 2008 +0100
    16.3 @@ -41,7 +41,7 @@
    16.4                               "Time", StringValue ("2s"),
    16.5                               "Speed", StringValue ("Constant:1.0"),
    16.6                               "Bounds", StringValue ("0:200:0:100"));
    16.7 -  mobility.LayoutAll ();
    16.8 +  mobility.InstallAll ();
    16.9    Config::Connect ("/NodeList/*/$ns3::MobilityModelNotifier/CourseChange",
   16.10                     MakeCallback (&CourseChange));
   16.11  
    17.1 --- a/src/common/buffer.cc	Sun May 04 22:43:18 2008 +0100
    17.2 +++ b/src/common/buffer.cc	Sun May 04 22:46:31 2008 +0100
    17.3 @@ -462,6 +462,40 @@
    17.4  }
    17.5  
    17.6  void 
    17.7 +Buffer::AddAtEnd (const Buffer &o)
    17.8 +{
    17.9 +  if (m_end == m_zeroAreaEnd &&
   17.10 +      o.m_start == o.m_zeroAreaStart &&
   17.11 +      o.m_zeroAreaEnd - o.m_zeroAreaStart > 0)
   17.12 +    {
   17.13 +      /**
   17.14 +       * This is an optimization which kicks in when
   17.15 +       * we attempt to aggregate two buffers which contain
   17.16 +       * adjacent zero areas.
   17.17 +       */
   17.18 +      uint32_t zeroSize = o.m_zeroAreaEnd - o.m_zeroAreaStart;
   17.19 +      m_zeroAreaEnd += zeroSize;
   17.20 +      m_end = m_zeroAreaEnd;
   17.21 +      uint32_t endData = o.m_end - o.m_zeroAreaEnd;
   17.22 +      AddAtEnd (endData);
   17.23 +      Buffer::Iterator dst = End ();
   17.24 +      dst.Prev (endData);
   17.25 +      Buffer::Iterator src = o.End ();
   17.26 +      src.Prev (endData);
   17.27 +      dst.Write (src, o.End ());
   17.28 +      return;
   17.29 +    }
   17.30 +  Buffer dst = CreateFullCopy ();
   17.31 +  Buffer src = o.CreateFullCopy ();
   17.32 +
   17.33 +  dst.AddAtEnd (src.GetSize ());
   17.34 +  Buffer::Iterator destStart = dst.End ();
   17.35 +  destStart.Prev (src.GetSize ());
   17.36 +  destStart.Write (src.Begin (), src.End ());
   17.37 +  *this = dst;
   17.38 +}
   17.39 +
   17.40 +void 
   17.41  Buffer::RemoveAtStart (uint32_t start)
   17.42  {
   17.43    NS_ASSERT (CheckInternalState ());
   17.44 @@ -544,14 +578,6 @@
   17.45  Buffer::CreateFragment (uint32_t start, uint32_t length) const
   17.46  {
   17.47    NS_ASSERT (CheckInternalState ());
   17.48 -  uint32_t zeroStart = m_zeroAreaStart - m_start;
   17.49 -  uint32_t zeroEnd = zeroStart + m_zeroAreaEnd;
   17.50 -  if (m_zeroAreaEnd != 0 &&
   17.51 -      start + length > zeroStart &&
   17.52 -      start <= zeroEnd) 
   17.53 -    {
   17.54 -      TransformIntoRealBuffer ();
   17.55 -    }
   17.56    Buffer tmp = *this;
   17.57    tmp.RemoveAtStart (start);
   17.58    tmp.RemoveAtEnd (GetSize () - (start + length));
   17.59 @@ -563,7 +589,7 @@
   17.60  Buffer::CreateFullCopy (void) const
   17.61  {
   17.62    NS_ASSERT (CheckInternalState ());
   17.63 -  if (m_zeroAreaEnd != 0) 
   17.64 +  if (m_zeroAreaEnd - m_zeroAreaStart != 0) 
   17.65      {
   17.66        Buffer tmp;
   17.67        tmp.AddAtStart (m_zeroAreaEnd - m_zeroAreaStart);
   17.68 @@ -1331,6 +1357,21 @@
   17.69      NS_TEST_ASSERT (memcmp (inputBuffer.PeekData (), outputBuffer.PeekData (), chunkSize) == 0);
   17.70    }
   17.71  
   17.72 +  buffer = Buffer (5);
   17.73 +  buffer.AddAtEnd (2);
   17.74 +  i = buffer.End ();
   17.75 +  i.Prev (2);
   17.76 +  i.WriteU8 (0);
   17.77 +  i.WriteU8 (0x66);
   17.78 +  ENSURE_WRITTEN_BYTES (buffer, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66);
   17.79 +  Buffer frag0 = buffer.CreateFragment (0, 2);
   17.80 +  ENSURE_WRITTEN_BYTES (frag0, 2, 0x00, 0x00);
   17.81 +  Buffer frag1 = buffer.CreateFragment (2, 5);
   17.82 +  ENSURE_WRITTEN_BYTES (frag1, 5, 0x00, 0x00, 0x00, 0x00, 0x66);
   17.83 +  frag0.AddAtEnd (frag1);
   17.84 +  ENSURE_WRITTEN_BYTES (buffer, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66);
   17.85 +  ENSURE_WRITTEN_BYTES (frag0, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66);
   17.86 +
   17.87    return result;
   17.88  }
   17.89  
    18.1 --- a/src/common/buffer.h	Sun May 04 22:43:18 2008 +0100
    18.2 +++ b/src/common/buffer.h	Sun May 04 22:46:31 2008 +0100
    18.3 @@ -410,6 +410,8 @@
    18.4     * pointing to this Buffer.
    18.5     */
    18.6    void AddAtEnd (uint32_t end);
    18.7 +
    18.8 +  void AddAtEnd (const Buffer &o);
    18.9    /**
   18.10     * \param start size to remove
   18.11     *
    19.1 --- a/src/common/packet.cc	Sun May 04 22:43:18 2008 +0100
    19.2 +++ b/src/common/packet.cc	Sun May 04 22:46:31 2008 +0100
    19.3 @@ -159,14 +159,7 @@
    19.4  void 
    19.5  Packet::AddAtEnd (Ptr<const Packet> packet)
    19.6  {
    19.7 -  Buffer src = packet->m_buffer.CreateFullCopy ();
    19.8 -  Buffer dst = m_buffer.CreateFullCopy ();
    19.9 -
   19.10 -  dst.AddAtEnd (src.GetSize ());
   19.11 -  Buffer::Iterator destStart = dst.End ();
   19.12 -  destStart.Prev (src.GetSize ());
   19.13 -  destStart.Write (src.Begin (), src.End ());
   19.14 -  m_buffer = dst;
   19.15 +  m_buffer.AddAtEnd (packet->m_buffer);
   19.16    /**
   19.17     * XXX: we might need to merge the tag list of the
   19.18     * other packet into the current packet.
    20.1 --- a/src/helper/csma-helper.cc	Sun May 04 22:43:18 2008 +0100
    20.2 +++ b/src/helper/csma-helper.cc	Sun May 04 22:46:31 2008 +0100
    20.3 @@ -103,7 +103,7 @@
    20.4  }
    20.5  
    20.6  void
    20.7 -CsmaHelper::EnablePcap (std::string filename)
    20.8 +CsmaHelper::EnablePcapAll (std::string filename)
    20.9  {
   20.10    EnablePcap (filename, NodeContainer::GetGlobal ());
   20.11  }
   20.12 @@ -150,7 +150,7 @@
   20.13  }
   20.14  
   20.15  void
   20.16 -CsmaHelper::EnableAscii (std::ostream &os)
   20.17 +CsmaHelper::EnableAsciiAll (std::ostream &os)
   20.18  {
   20.19    EnableAscii (os, NodeContainer::GetGlobal ());
   20.20  }
    21.1 --- a/src/helper/csma-helper.h	Sun May 04 22:43:18 2008 +0100
    21.2 +++ b/src/helper/csma-helper.h	Sun May 04 22:46:31 2008 +0100
    21.3 @@ -115,7 +115,7 @@
    21.4     * Enable pcap output on each device which is of the
    21.5     * ns3::CsmaNetDevice type
    21.6     */
    21.7 -  static void EnablePcap (std::string filename);
    21.8 +  static void EnablePcapAll (std::string filename);
    21.9  
   21.10    /**
   21.11     * \param os output stream
   21.12 @@ -154,7 +154,7 @@
   21.13     * ns3::CsmaNetDevice type and dump that to the specified
   21.14     * stdc++ output stream.
   21.15     */
   21.16 -  static void EnableAscii (std::ostream &os);
   21.17 +  static void EnableAsciiAll (std::ostream &os);
   21.18  
   21.19    /**
   21.20     * \param c a set of nodes
    22.1 --- a/src/helper/internet-stack-helper.cc	Sun May 04 22:43:18 2008 +0100
    22.2 +++ b/src/helper/internet-stack-helper.cc	Sun May 04 22:46:31 2008 +0100
    22.3 @@ -17,6 +17,10 @@
    22.4   *
    22.5   * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    22.6   */
    22.7 +#include "ns3/assert.h"
    22.8 +#include "ns3/log.h"
    22.9 +#include "ns3/object.h"
   22.10 +#include "ns3/ipv4.h"
   22.11  #include "internet-stack-helper.h"
   22.12  #include "ns3/internet-stack.h"
   22.13  #include "ns3/packet-socket-factory.h"
   22.14 @@ -33,6 +37,12 @@
   22.15    for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
   22.16      {
   22.17        Ptr<Node> node = *i;
   22.18 +      if (node->GetObject<Ipv4> () != 0)
   22.19 +        {
   22.20 +          NS_FATAL_ERROR ("InternetStackHelper::Install(): Aggregating " 
   22.21 +             "an InternetStack to a node with an existing Ipv4 object");
   22.22 +          return;
   22.23 +        } 
   22.24        AddInternetStack (node);
   22.25        Ptr<PacketSocketFactory> factory = CreateObject<PacketSocketFactory> ();
   22.26        node->AggregateObject (factory);
   22.27 @@ -40,7 +50,7 @@
   22.28  }
   22.29  
   22.30  void
   22.31 -InternetStackHelper::EnablePcap (std::string filename)
   22.32 +InternetStackHelper::EnablePcapAll (std::string filename)
   22.33  {
   22.34    InternetStackHelper::m_pcapBaseFilename = filename;
   22.35    Config::Connect ("/NodeList/*/$ns3::Ipv4L3Protocol/Tx",
    23.1 --- a/src/helper/internet-stack-helper.h	Sun May 04 22:43:18 2008 +0100
    23.2 +++ b/src/helper/internet-stack-helper.h	Sun May 04 22:46:31 2008 +0100
    23.3 @@ -37,7 +37,10 @@
    23.4     * \param c the set of nodes
    23.5     *
    23.6     * For each node in the input container, aggregate implementations
    23.7 -   * of the ns3::Ipv4, ns3::Udp, and, ns3::Tcp classes.
    23.8 +   * of the ns3::Ipv4, ns3::Udp, and, ns3::Tcp classes.  The program
    23.9 +   * will assert if this method is called on a container with a node
   23.10 +   * that already has an Ipv4 object aggregated to it.
   23.11 +   * 
   23.12     */
   23.13    void Install (NodeContainer c);
   23.14  
   23.15 @@ -47,7 +50,7 @@
   23.16     * Enable pcap output on each protocol instance which is of the
   23.17     * ns3::Ipv4L3Protocol type.  Both Tx and Rx events will be logged.
   23.18     */
   23.19 -  static void EnablePcap (std::string filename);
   23.20 +  static void EnablePcapAll (std::string filename);
   23.21  
   23.22  private:
   23.23    static void LogRxIp (std::string context, Ptr<const Packet> packet, uint32_t deviceId);
    24.1 --- a/src/helper/mobility-helper.cc	Sun May 04 22:43:18 2008 +0100
    24.2 +++ b/src/helper/mobility-helper.cc	Sun May 04 22:46:31 2008 +0100
    24.3 @@ -124,7 +124,7 @@
    24.4  }
    24.5  
    24.6  void 
    24.7 -MobilityHelper::Layout (NodeContainer c)
    24.8 +MobilityHelper::Install (NodeContainer c)
    24.9  {
   24.10    for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
   24.11      {
   24.12 @@ -169,9 +169,9 @@
   24.13  }
   24.14  
   24.15  void 
   24.16 -MobilityHelper::LayoutAll (void)
   24.17 +MobilityHelper::InstallAll (void)
   24.18  {
   24.19 -  Layout (NodeContainer::GetGlobal ());
   24.20 +  Install (NodeContainer::GetGlobal ());
   24.21  }
   24.22  
   24.23  } // namespace ns3
    25.1 --- a/src/helper/mobility-helper.h	Sun May 04 22:43:18 2008 +0100
    25.2 +++ b/src/helper/mobility-helper.h	Sun May 04 22:46:31 2008 +0100
    25.3 @@ -34,7 +34,7 @@
    25.4  /**
    25.5   * \brief assign positions and mobility models to nodes.
    25.6   *
    25.7 - * MobilityHelper::Layout is the most important method here.
    25.8 + * MobilityHelper::Install is the most important method here.
    25.9   */
   25.10  class MobilityHelper
   25.11  {
   25.12 @@ -43,14 +43,14 @@
   25.13    ~MobilityHelper ();
   25.14  
   25.15    /**
   25.16 -   * After this method is called, every call to MobilityHelper::Layout
   25.17 +   * After this method is called, every call to MobilityHelper::Install
   25.18     * will also attach to the new ns3::MobilityModel an ns3::MobilityModelNotifier
   25.19     * which can be used to listen to CourseChange events.
   25.20     */
   25.21    void EnableNotifier (void);
   25.22    /**
   25.23     * After this method is called, no ns3::MobilityModelNotifier object will
   25.24 -   * be associated to any new ns3::MobilityModel created by MobilityHelper::Layout.
   25.25 +   * be associated to any new ns3::MobilityModel created by MobilityHelper::Install.
   25.26     * This will make it impossible to listen to "CourseChange" events from these
   25.27     * new ns3::MobilityModel instances.
   25.28     */
   25.29 @@ -60,7 +60,7 @@
   25.30     * \param allocator allocate initial node positions
   25.31     *
   25.32     * Set the position allocator which will be used to allocate
   25.33 -   * the initial position of every node in MobilityModel::Layout.
   25.34 +   * the initial position of every node in MobilityModel::Install.
   25.35     */
   25.36    void SetPositionAllocator (Ptr<PositionAllocator> allocator);
   25.37  
   25.38 @@ -117,7 +117,7 @@
   25.39     * \param n9 the name of the attribute to set in the mobility model.
   25.40     * \param v9 the value of the attribute to set in the mobility model.
   25.41     *
   25.42 -   * Calls to MobilityHelper::Layout will create an instance of a matching 
   25.43 +   * Calls to MobilityHelper::Install will create an instance of a matching 
   25.44     * mobility model for each node.
   25.45     */
   25.46    void SetMobilityModel (std::string type,
   25.47 @@ -136,9 +136,9 @@
   25.48     *
   25.49     * Push an item on the top of the stack of "reference mobility models".
   25.50     * The input item should be a node instance to which a mobility model
   25.51 -   * has already been aggregated (usually by a call to Layout).
   25.52 +   * has already been aggregated (usually by a call to Install).
   25.53     *
   25.54 -   * If this this stack is not empty when MobilityHelper::Layout
   25.55 +   * If this this stack is not empty when MobilityHelper::Install
   25.56     * is called, the model from the top of the stack is used
   25.57     * to create a ns3::HierarchicalMobilityModel to make the
   25.58     * newly-created models define their positions relative to that
   25.59 @@ -171,15 +171,15 @@
   25.60     * position allocator (set through MobilityHelper::SetPositionAllocator). 
   25.61     * Optionally, this method will also create and aggregate a
   25.62     * ns3::MobilityModelNotifier to generate 'CourseChange' events based on the 
   25.63 -   * boolean flag set by MobilityHelper::EnableNotifier and MobilityHelper::DisableNotifier.
   25.64 +   * boolean flag set by MobilityHelper::EnableNotifierAll and MobilityHelper::DisableNotifier.
   25.65     */
   25.66 -  void Layout (NodeContainer container);
   25.67 +  void Install (NodeContainer container);
   25.68  
   25.69    /**
   25.70 -   * Perform the work of MobilityHelper::Layout on _all_ nodes which
   25.71 +   * Perform the work of MobilityHelper::Install on _all_ nodes which
   25.72     * exist in the simulation.
   25.73     */
   25.74 -  void LayoutAll (void);
   25.75 +  void InstallAll (void);
   25.76  private:
   25.77  
   25.78    std::vector<Ptr<MobilityModel> > m_mobilityStack;
    26.1 --- a/src/helper/ns2-mobility-helper.cc	Sun May 04 22:43:18 2008 +0100
    26.2 +++ b/src/helper/ns2-mobility-helper.cc	Sun May 04 22:46:31 2008 +0100
    26.3 @@ -154,9 +154,9 @@
    26.4  }
    26.5  
    26.6  void 
    26.7 -Ns2MobilityHelper::Layout (void) const
    26.8 +Ns2MobilityHelper::Install (void) const
    26.9  {
   26.10 -  Layout (NodeList::Begin (), NodeList::End ());
   26.11 +  Install (NodeList::Begin (), NodeList::End ());
   26.12  }
   26.13  
   26.14  } // namespace ns3
    27.1 --- a/src/helper/ns2-mobility-helper.h	Sun May 04 22:43:18 2008 +0100
    27.2 +++ b/src/helper/ns2-mobility-helper.h	Sun May 04 22:46:31 2008 +0100
    27.3 @@ -51,7 +51,7 @@
    27.4     * whose nodeId is matches the nodeId of the nodes in the trace
    27.5     * file.
    27.6     */
    27.7 -  void Layout (void) const;
    27.8 +  void Install (void) const;
    27.9  
   27.10    /**
   27.11     * \param begin an iterator which points to the start of the input
   27.12 @@ -65,7 +65,7 @@
   27.13     * the index of the object in the input array.
   27.14     */
   27.15    template <typename T>
   27.16 -  void Layout (T begin, T end) const;
   27.17 +  void Install (T begin, T end) const;
   27.18  private:
   27.19    class ObjectStore
   27.20    {
   27.21 @@ -86,7 +86,7 @@
   27.22  
   27.23  template <typename T>
   27.24  void 
   27.25 -Ns2MobilityHelper::Layout (T begin, T end) const
   27.26 +Ns2MobilityHelper::Install (T begin, T end) const
   27.27  {
   27.28    class MyObjectStore : public ObjectStore
   27.29    {
    28.1 --- a/src/helper/olsr-helper.cc	Sun May 04 22:43:18 2008 +0100
    28.2 +++ b/src/helper/olsr-helper.cc	Sun May 04 22:46:31 2008 +0100
    28.3 @@ -51,26 +51,32 @@
    28.4  }
    28.5  
    28.6  void 
    28.7 -OlsrHelper::Enable (NodeContainer container)
    28.8 +OlsrHelper::Install (NodeContainer container)
    28.9  {
   28.10    for (NodeContainer::Iterator i = container.Begin (); i != container.End (); ++i)
   28.11      {
   28.12        Ptr<Node> node = *i;
   28.13 -      Enable (node);
   28.14 +      Install (node);
   28.15      }
   28.16  }
   28.17  void 
   28.18 -OlsrHelper::Enable (Ptr<Node> node)
   28.19 +OlsrHelper::Install (Ptr<Node> node)
   28.20  {
   28.21 +  if (node->GetObject<olsr::Agent> () != 0)
   28.22 +    {
   28.23 +      NS_FATAL_ERROR ("OlsrHelper::Install(): Aggregating "
   28.24 +         "an Olsr Agent to a node with an existing Olsr Agent");
   28.25 +      return;
   28.26 +    }
   28.27    Ptr<olsr::Agent> agent = m_agentFactory.Create<olsr::Agent> ();
   28.28    agent->SetNode (node);
   28.29    node->AggregateObject (agent);
   28.30    agent->Start ();
   28.31  }
   28.32  void 
   28.33 -OlsrHelper::EnableAll (void)
   28.34 +OlsrHelper::InstallAll (void)
   28.35  {
   28.36 -  Enable (NodeContainer::GetGlobal ());
   28.37 +  Install (NodeContainer::GetGlobal ());
   28.38  }
   28.39  
   28.40  } // namespace ns3
    29.1 --- a/src/helper/olsr-helper.h	Sun May 04 22:43:18 2008 +0100
    29.2 +++ b/src/helper/olsr-helper.h	Sun May 04 22:46:31 2008 +0100
    29.3 @@ -41,9 +41,9 @@
    29.4  		 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
    29.5  		 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
    29.6  
    29.7 -  void Enable (NodeContainer container);
    29.8 -  void Enable (Ptr<Node> node);
    29.9 -  void EnableAll (void);
   29.10 +  void Install (NodeContainer container);
   29.11 +  void Install (Ptr<Node> node);
   29.12 +  void InstallAll (void);
   29.13  private:
   29.14    ObjectFactory m_agentFactory;
   29.15  };
    30.1 --- a/src/helper/point-to-point-helper.cc	Sun May 04 22:43:18 2008 +0100
    30.2 +++ b/src/helper/point-to-point-helper.cc	Sun May 04 22:46:31 2008 +0100
    30.3 @@ -103,7 +103,7 @@
    30.4  }
    30.5  
    30.6  void
    30.7 -PointToPointHelper::EnablePcap (std::string filename)
    30.8 +PointToPointHelper::EnablePcapAll (std::string filename)
    30.9  {
   30.10    EnablePcap (filename, NodeContainer::GetGlobal ());
   30.11  }
   30.12 @@ -150,7 +150,7 @@
   30.13  }
   30.14  
   30.15  void
   30.16 -PointToPointHelper::EnableAscii (std::ostream &os)
   30.17 +PointToPointHelper::EnableAsciiAll (std::ostream &os)
   30.18  {
   30.19    EnableAscii (os, NodeContainer::GetGlobal ());
   30.20  }
    31.1 --- a/src/helper/point-to-point-helper.h	Sun May 04 22:43:18 2008 +0100
    31.2 +++ b/src/helper/point-to-point-helper.h	Sun May 04 22:46:31 2008 +0100
    31.3 @@ -114,7 +114,7 @@
    31.4     * Enable pcap output on each device which is of the
    31.5     * ns3::PointToPointNetDevice type
    31.6     */
    31.7 -  static void EnablePcap (std::string filename);
    31.8 +  static void EnablePcapAll (std::string filename);
    31.9  
   31.10    /**
   31.11     * \param os output stream
   31.12 @@ -153,7 +153,7 @@
   31.13     * ns3::PointToPointNetDevice type and dump that to the specified
   31.14     * stdc++ output stream.
   31.15     */
   31.16 -  static void EnableAscii (std::ostream &os);
   31.17 +  static void EnableAsciiAll (std::ostream &os);
   31.18  
   31.19    /**
   31.20     * \param c a set of nodes
    32.1 --- a/src/helper/wifi-helper.cc	Sun May 04 22:43:18 2008 +0100
    32.2 +++ b/src/helper/wifi-helper.cc	Sun May 04 22:46:31 2008 +0100
    32.3 @@ -184,7 +184,7 @@
    32.4  }
    32.5  
    32.6  void
    32.7 -WifiHelper::EnablePcap (std::string filename)
    32.8 +WifiHelper::EnablePcapAll (std::string filename)
    32.9  {
   32.10    EnablePcap (filename, NodeContainer::GetGlobal ());
   32.11  }
   32.12 @@ -225,7 +225,7 @@
   32.13  }
   32.14  
   32.15  void
   32.16 -WifiHelper::EnableAscii (std::ostream &os)
   32.17 +WifiHelper::EnableAsciiAll (std::ostream &os)
   32.18  {
   32.19    EnableAscii (os, NodeContainer::GetGlobal ());
   32.20  }
    33.1 --- a/src/helper/wifi-helper.h	Sun May 04 22:43:18 2008 +0100
    33.2 +++ b/src/helper/wifi-helper.h	Sun May 04 22:46:31 2008 +0100
    33.3 @@ -176,7 +176,7 @@
    33.4     * Enable pcap output on each device which is of the
    33.5     * ns3::WifiNetDevice type
    33.6     */
    33.7 -  static void EnablePcap (std::string filename);
    33.8 +  static void EnablePcapAll (std::string filename);
    33.9  
   33.10    /**
   33.11     * \param os output stream
   33.12 @@ -215,7 +215,7 @@
   33.13     * ns3::WifiNetDevice type and dump that to the specified
   33.14     * stdc++ output stream.
   33.15     */
   33.16 -  static void EnableAscii (std::ostream &os);
   33.17 +  static void EnableAsciiAll (std::ostream &os);
   33.18  
   33.19    /**
   33.20     * \param c a set of nodes
    34.1 --- a/src/internet-node/internet-stack.cc	Sun May 04 22:43:18 2008 +0100
    34.2 +++ b/src/internet-node/internet-stack.cc	Sun May 04 22:46:31 2008 +0100
    34.3 @@ -36,11 +36,6 @@
    34.4  void 
    34.5  AddInternetStack (Ptr<Node> node)
    34.6  {
    34.7 -  // This may be called on a node with a previously added stack
    34.8 -  if (node->GetObject<Ipv4> ())
    34.9 -    {
   34.10 -      return;
   34.11 -    }
   34.12    Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
   34.13    Ptr<ArpL3Protocol> arp = CreateObject<ArpL3Protocol> ();
   34.14    ipv4->SetNode (node);
    35.1 --- a/src/internet-node/tcp-socket.cc	Sun May 04 22:43:18 2008 +0100
    35.2 +++ b/src/internet-node/tcp-socket.cc	Sun May 04 22:46:31 2008 +0100
    35.3 @@ -370,6 +370,9 @@
    35.4                     " state " << m_state);
    35.5        Actions_t action = ProcessEvent (APP_SEND);
    35.6        NS_LOG_DEBUG(" action " << action);
    35.7 +      // We do not model any limit to the buffer, so report that the
    35.8 +      // maximum is available
    35.9 +      NotifySend (std::numeric_limits<uint32_t>::max ());
   35.10        if (!ProcessAction (action)) 
   35.11          {
   35.12            return -1; // Failed, return zero
   35.13 @@ -689,6 +692,9 @@
   35.14        if (tcpHeader.GetAckNumber () > m_highestRxAck)
   35.15        {
   35.16          m_highestRxAck = tcpHeader.GetAckNumber ();
   35.17 +        // We do not model any limit to the buffer, so report that the
   35.18 +        // maximum is available
   35.19 +        NotifySend (std::numeric_limits<uint32_t>::max ());
   35.20        }
   35.21        SendPendingData ();
   35.22        break;
   35.23 @@ -1077,6 +1083,9 @@
   35.24    NS_LOG_LOGIC ("TCP " << this << " NewAck " << ack 
   35.25             << " numberAck " << (ack - m_highestRxAck)); // Number bytes ack'ed
   35.26    m_highestRxAck = ack;         // Note the highest recieved Ack
   35.27 +  // We do not model any limit to the buffer, so report that the
   35.28 +  // maximum is available
   35.29 +  NotifySend (std::numeric_limits<uint32_t>::max ());
   35.30    if (ack > m_nextTxSequence) 
   35.31      {
   35.32        m_nextTxSequence = ack; // If advanced
    36.1 --- a/src/node/socket.cc	Sun May 04 22:43:18 2008 +0100
    36.2 +++ b/src/node/socket.cc	Sun May 04 22:46:31 2008 +0100
    36.3 @@ -64,11 +64,19 @@
    36.4    m_closeRequested = closeRequested;
    36.5  }
    36.6  
    36.7 -void 
    36.8 -Socket::SetSendCallback (Callback<void, Ptr<Socket>, uint32_t> dataSent)
    36.9 +bool 
   36.10 +Socket::SetDataSentCallback (Callback<void, Ptr<Socket>, uint32_t> dataSent)
   36.11  {
   36.12    NS_LOG_FUNCTION_NOARGS ();
   36.13    m_dataSent = dataSent;
   36.14 +  return true;
   36.15 +}
   36.16 +
   36.17 +void
   36.18 +Socket::SetSendCallback (Callback<void, Ptr<Socket>, uint32_t> sendCb)
   36.19 +{
   36.20 +  NS_LOG_FUNCTION_NOARGS ();
   36.21 +  m_sendCb = sendCb;
   36.22  }
   36.23  
   36.24  void 
   36.25 @@ -78,6 +86,12 @@
   36.26    m_receivedData = receivedData;
   36.27  }
   36.28  
   36.29 +int Socket::Listen (uint32_t queueLimit)
   36.30 +{
   36.31 +  return 0; //XXX the base class version does nothing
   36.32 +}
   36.33 +
   36.34 +
   36.35  int Socket::Send (const uint8_t* buf, uint32_t size)
   36.36  {
   36.37    NS_LOG_FUNCTION_NOARGS ();
   36.38 @@ -108,12 +122,6 @@
   36.39    return SendTo (address,p);
   36.40  }
   36.41  
   36.42 -int Socket::Listen(uint32_t queueLimit)
   36.43 -{
   36.44 -  return 0; //XXX the base class version does nothing
   36.45 -}
   36.46 -
   36.47 -
   36.48  void 
   36.49  Socket::NotifyCloseCompleted (void)
   36.50  {
   36.51 @@ -203,6 +211,16 @@
   36.52  }
   36.53  
   36.54  void 
   36.55 +Socket::NotifySend (uint32_t spaceAvailable)
   36.56 +{
   36.57 +  NS_LOG_FUNCTION_NOARGS ();
   36.58 +  if (!m_sendCb.IsNull ())
   36.59 +    {
   36.60 +      m_sendCb (this, spaceAvailable);
   36.61 +    }
   36.62 +}
   36.63 +
   36.64 +void 
   36.65  Socket::NotifyDataReceived (Ptr<Packet> p, const Address &from)
   36.66  {
   36.67    NS_LOG_FUNCTION_NOARGS ();
    37.1 --- a/src/node/socket.h	Sun May 04 22:43:18 2008 +0100
    37.2 +++ b/src/node/socket.h	Sun May 04 22:46:31 2008 +0100
    37.3 @@ -38,9 +38,11 @@
    37.4   * \brief Define a Socket API based on the BSD Socket API.
    37.5   *
    37.6   * Contrary to the original BSD socket API, this API is asynchronous:
    37.7 - * it does not contain blocking calls. Other than that, it tries to stick
    37.8 - * to the BSD API to make it easier those who know the BSD API to use
    37.9 - * this API.
   37.10 + * it does not contain blocking calls. It also uses class ns3::Packet
   37.11 + * as a fancy byte buffer, allowing data to be passed across the API
   37.12 + * using an ns3::Packet instead of a raw data pointer.  Other than that, 
   37.13 + * it tries to stick to the BSD API to make it easier for those who know 
   37.14 + * the BSD API to use this API.
   37.15   */
   37.16  class Socket : public Object
   37.17  {
   37.18 @@ -94,8 +96,8 @@
   37.19     *        Or when I call Close ?
   37.20     */
   37.21    void SetConnectCallback (Callback<void, Ptr<Socket> > connectionSucceeded,
   37.22 -                          Callback<void,  Ptr<Socket> > connectionFailed,
   37.23 -                          Callback<void,  Ptr<Socket> > halfClose);
   37.24 +                           Callback<void,  Ptr<Socket> > connectionFailed,
   37.25 +                           Callback<void,  Ptr<Socket> > halfClose);
   37.26    /**
   37.27     * \brief Accept connection requests from remote hosts
   37.28     * \param connectionRequest Callback for connection request from peer. 
   37.29 @@ -120,7 +122,34 @@
   37.30                            Callback<void, Ptr<Socket>, 
   37.31                              const Address&> newConnectionCreated,
   37.32                            Callback<void, Ptr<Socket> > closeRequested);
   37.33 -  void SetSendCallback (Callback<void, Ptr<Socket>, uint32_t> dataSent);
   37.34 +  /**
   37.35 +   * \brief Notify application when a packet has been sent from transport 
   37.36 +   *        protocol (non-standard socket call)
   37.37 +   * \param dataSent Callback for the event that data is sent from the
   37.38 +   *        underlying transport protocol.  This callback is passed a
   37.39 +   *        pointer to the socket, and the number of bytes sent.
   37.40 +   * \returns whether or not this socket supports this callback.  Note 
   37.41 +   *        that this is a non-standard socket call.  Some socket 
   37.42 +   *        implementations in ns-3 may not support this call, so the
   37.43 +   *        user should check this return value to confirm that the
   37.44 +   *        callback is supported.
   37.45 +   */
   37.46 +  virtual bool SetDataSentCallback (Callback<void, Ptr<Socket>, uint32_t> dataSent);
   37.47 +  /**
   37.48 +   * \brief Notify application when space in transmit buffer is added
   37.49 +   *
   37.50 +   *        This callback is intended to notify a 
   37.51 +   *        socket that would have been blocked in a blocking socket model
   37.52 +   *        that space is available in the transmit buffer and that it
   37.53 +   *        can call Send() again.  
   37.54 +   *
   37.55 +   * \param sendCb Callback for the event that the socket transmit buffer
   37.56 +   *        fill level has decreased.  This callback is passed a pointer to
   37.57 +   *        the socket, and the number of bytes available for writing
   37.58 +   *        into the buffer (an absolute value).  If there is no transmit
   37.59 +   *        buffer limit, a maximum-sized integer is always returned.
   37.60 +   */
   37.61 +  void SetSendCallback (Callback<void, Ptr<Socket>, uint32_t> sendCb);
   37.62    /**
   37.63     * \brief Receive data
   37.64     * \param receivedData Invoked whenever new data is received.
   37.65 @@ -150,7 +179,7 @@
   37.66     * After the Close call, the socket is no longer valid, and cannot
   37.67     * safely be used for subsequent operations.
   37.68     */
   37.69 -  virtual int Close(void) = 0;
   37.70 +  virtual int Close (void) = 0;
   37.71  
   37.72    /**
   37.73     * \returns zero on success, -1 on failure.
   37.74 @@ -172,9 +201,16 @@
   37.75     * \brief Initiate a connection to a remote host
   37.76     * \param address Address of remote.
   37.77     */
   37.78 -  virtual int Connect(const Address &address) = 0;
   37.79 +  virtual int Connect (const Address &address) = 0;
   37.80      
   37.81    /**
   37.82 +   * \brief Listen for incoming connections.
   37.83 +   * \param queueLimit maximum number of incoming request to queue
   37.84 +   * \returns XXX an error code
   37.85 +   */
   37.86 +  virtual int Listen (uint32_t queueLimit);
   37.87 +
   37.88 +  /**
   37.89     * \brief Send data (or dummy data) to the remote host
   37.90     * \param p packet to send
   37.91     * \returns -1 in case of error or the number of bytes copied in the 
   37.92 @@ -200,14 +236,7 @@
   37.93     * \returns -1 in case of error or the number of bytes copied in the 
   37.94     *          internal buffer and accepted for transmission.
   37.95     */
   37.96 -  virtual int SendTo(const Address &address,Ptr<Packet> p) = 0;
   37.97 -
   37.98 -  /**
   37.99 -   * \brief Listen for incoming connections.
  37.100 -   * \param queueLimit maximum number of incoming request to queue
  37.101 -   * \returns XXX an error code
  37.102 -   */
  37.103 -  virtual int Listen(uint32_t queueLimit);
  37.104 +  virtual int SendTo (const Address &address,Ptr<Packet> p) = 0;
  37.105  
  37.106    /**
  37.107     * \brief Send data to a specified peer.
  37.108 @@ -221,7 +250,7 @@
  37.109     * This is provided so as to have an API which is closer in appearance 
  37.110     * to that of real network or BSD sockets.
  37.111     */
  37.112 -  int SendTo(const Address &address, const uint8_t* buf, uint32_t size);
  37.113 +  int SendTo (const Address &address, const uint8_t* buf, uint32_t size);
  37.114  
  37.115  protected:
  37.116    void NotifyCloseCompleted (void);
  37.117 @@ -232,6 +261,7 @@
  37.118    void NotifyNewConnectionCreated (Ptr<Socket> socket, const Address &from);
  37.119    void NotifyCloseRequested (void);
  37.120    void NotifyDataSent (uint32_t size);
  37.121 +  void NotifySend (uint32_t spaceAvailable);
  37.122    void NotifyDataReceived (Ptr<Packet> p, const Address &from);
  37.123  
  37.124    Callback<void,Ptr<Socket> >    m_closeCompleted;
  37.125 @@ -242,6 +272,7 @@
  37.126    Callback<bool, Ptr<Socket>, const Address &>   m_connectionRequest;
  37.127    Callback<void, Ptr<Socket>, const Address&>    m_newConnectionCreated;
  37.128    Callback<void, Ptr<Socket>, uint32_t>          m_dataSent;
  37.129 +  Callback<void, Ptr<Socket>, uint32_t >         m_sendCb;
  37.130    Callback<void, Ptr<Socket>, Ptr<Packet>,const Address&> m_receivedData;
  37.131  };
  37.132  
    38.1 --- a/tutorial/tutorial-bus-network.cc	Sun May 04 22:43:18 2008 +0100
    38.2 +++ b/tutorial/tutorial-bus-network.cc	Sun May 04 22:46:31 2008 +0100
    38.3 @@ -68,7 +68,7 @@
    38.4  
    38.5    std::ofstream ascii;
    38.6    ascii.open ("tutorial.tr");
    38.7 -  CsmaHelper::EnableAscii (ascii);
    38.8 +  CsmaHelper::EnableAsciiAll (ascii);
    38.9  
   38.10    Simulator::Run ();
   38.11    Simulator::Destroy ();
    39.1 --- a/tutorial/tutorial-csma-echo-ascii-trace.cc	Sun May 04 22:43:18 2008 +0100
    39.2 +++ b/tutorial/tutorial-csma-echo-ascii-trace.cc	Sun May 04 22:46:31 2008 +0100
    39.3 @@ -65,7 +65,7 @@
    39.4  
    39.5    std::ofstream os;
    39.6    os.open ("tutorial.tr");
    39.7 -  CsmaHelper::EnableAscii (os);
    39.8 +  CsmaHelper::EnableAsciiAll (os);
    39.9    
   39.10    Simulator::Run ();
   39.11    Simulator::Destroy ();
    40.1 --- a/tutorial/tutorial-csma-echo-pcap-trace.cc	Sun May 04 22:43:18 2008 +0100
    40.2 +++ b/tutorial/tutorial-csma-echo-pcap-trace.cc	Sun May 04 22:46:31 2008 +0100
    40.3 @@ -61,7 +61,7 @@
    40.4    apps.Start (Seconds (1.0));
    40.5    apps.Stop (Seconds (10.0));
    40.6  
    40.7 -  CsmaHelper::EnablePcap ("tutorial");
    40.8 +  CsmaHelper::EnablePcapAll ("tutorial");
    40.9    
   40.10    Simulator::Run ();
   40.11    Simulator::Destroy ();
    41.1 --- a/tutorial/tutorial-linear-dumbbell.cc	Sun May 04 22:43:18 2008 +0100
    41.2 +++ b/tutorial/tutorial-linear-dumbbell.cc	Sun May 04 22:46:31 2008 +0100
    41.3 @@ -137,11 +137,11 @@
    41.4  
    41.5    std::ofstream os;
    41.6    os.open ("tutorial.tr");
    41.7 -  PointToPointHelper::EnableAscii (os);
    41.8 -  CsmaHelper::EnableAscii (os);
    41.9 +  PointToPointHelper::EnableAsciiAll (os);
   41.10 +  CsmaHelper::EnableAsciiAll (os);
   41.11  
   41.12 -  PointToPointHelper::EnablePcap ("tutorial");
   41.13 -  CsmaHelper::EnablePcap ("tutorial");
   41.14 +  PointToPointHelper::EnablePcapAll ("tutorial");
   41.15 +  CsmaHelper::EnablePcapAll ("tutorial");
   41.16  
   41.17    Simulator::Run ();
   41.18    Simulator::Destroy ();
    42.1 --- a/tutorial/tutorial-point-to-point.cc	Sun May 04 22:43:18 2008 +0100
    42.2 +++ b/tutorial/tutorial-point-to-point.cc	Sun May 04 22:46:31 2008 +0100
    42.3 @@ -71,7 +71,7 @@
    42.4  
    42.5    std::ofstream ascii;
    42.6    ascii.open ("tutorial.tr");
    42.7 -  PointToPointHelper::EnableAscii (ascii);
    42.8 +  PointToPointHelper::EnableAsciiAll (ascii);
    42.9  
   42.10    Simulator::Run ();
   42.11    Simulator::Destroy ();
    43.1 --- a/tutorial/tutorial-star-routing.cc	Sun May 04 22:43:18 2008 +0100
    43.2 +++ b/tutorial/tutorial-star-routing.cc	Sun May 04 22:46:31 2008 +0100
    43.3 @@ -101,7 +101,7 @@
    43.4  
    43.5    std::ofstream ascii;
    43.6    ascii.open ("tutorial.tr");
    43.7 -  PointToPointHelper::EnableAscii (ascii);
    43.8 +  PointToPointHelper::EnableAsciiAll (ascii);
    43.9  
   43.10    Simulator::Run ();
   43.11    Simulator::Destroy ();
    44.1 --- a/tutorial/tutorial-star.cc	Sun May 04 22:43:18 2008 +0100
    44.2 +++ b/tutorial/tutorial-star.cc	Sun May 04 22:46:31 2008 +0100
    44.3 @@ -98,7 +98,7 @@
    44.4  
    44.5    std::ofstream ascii;
    44.6    ascii.open ("tutorial.tr");
    44.7 -  PointToPointHelper::EnableAscii (ascii);
    44.8 +  PointToPointHelper::EnableAsciiAll (ascii);
    44.9  
   44.10    Simulator::Run ();
   44.11    Simulator::Destroy ();