merge
This commit is contained in:
@@ -113,10 +113,10 @@ main (int argc, char *argv[])
|
||||
// The output files will be named
|
||||
// csma-broadcast.pcap-<nodeId>-<interfaceId>
|
||||
// and can be read by the "tcpdump -tt -r" command
|
||||
CsmaHelper::EnablePcap ("csma-broadcast");
|
||||
CsmaHelper::EnablePcapAll ("csma-broadcast");
|
||||
std::ofstream ascii;
|
||||
ascii.open ("csma-broadcast.tr");
|
||||
CsmaHelper::EnableAscii (ascii);
|
||||
CsmaHelper::EnableAsciiAll (ascii);
|
||||
|
||||
NS_LOG_INFO ("Run Simulation.");
|
||||
Simulator::Run ();
|
||||
|
||||
@@ -172,14 +172,14 @@ main (int argc, char *argv[])
|
||||
//
|
||||
std::ofstream ascii;
|
||||
ascii.open ("csma-multicast.tr");
|
||||
CsmaHelper::EnableAscii (ascii);
|
||||
CsmaHelper::EnableAsciiAll (ascii);
|
||||
|
||||
// Also configure some tcpdump traces; each interface will be traced.
|
||||
// The output files will be named:
|
||||
// csma-multicast.pcap-<nodeId>-<interfaceId>
|
||||
// and can be read by the "tcpdump -r" command (use "-tt" option to
|
||||
// display timestamps correctly)
|
||||
CsmaHelper::EnablePcap ("csma-multicast");
|
||||
CsmaHelper::EnablePcapAll ("csma-multicast");
|
||||
//
|
||||
// Now, do the actual simulation.
|
||||
//
|
||||
|
||||
@@ -128,7 +128,7 @@ main (int argc, char *argv[])
|
||||
NS_LOG_INFO ("Configure Tracing.");
|
||||
std::ofstream ascii;
|
||||
ascii.open ("csma-one-subnet.tr");
|
||||
CsmaHelper::EnableAscii (ascii);
|
||||
CsmaHelper::EnableAsciiAll (ascii);
|
||||
//
|
||||
// Also configure some tcpdump traces; each interface will be traced.
|
||||
// The output files will be named:
|
||||
@@ -136,7 +136,7 @@ main (int argc, char *argv[])
|
||||
// and can be read by the "tcpdump -r" command (use "-tt" option to
|
||||
// display timestamps correctly)
|
||||
//
|
||||
CsmaHelper::EnablePcap ("csma-one-subnet");
|
||||
CsmaHelper::EnablePcapAll ("csma-one-subnet");
|
||||
//
|
||||
// Now, do the actual simulation.
|
||||
//
|
||||
|
||||
@@ -125,10 +125,10 @@ main (int argc, char *argv[])
|
||||
|
||||
std::ofstream ascii;
|
||||
ascii.open ("mixed-global-routing.tr");
|
||||
PointToPointHelper::EnablePcap ("mixed-global-routing");
|
||||
PointToPointHelper::EnableAscii (ascii);
|
||||
CsmaHelper::EnablePcap ("mixed-global-routing");
|
||||
CsmaHelper::EnableAscii (ascii);
|
||||
PointToPointHelper::EnablePcapAll ("mixed-global-routing");
|
||||
PointToPointHelper::EnableAsciiAll (ascii);
|
||||
CsmaHelper::EnablePcapAll ("mixed-global-routing");
|
||||
CsmaHelper::EnableAsciiAll (ascii);
|
||||
|
||||
|
||||
NS_LOG_INFO ("Run Simulation.");
|
||||
|
||||
@@ -166,7 +166,7 @@ main (int argc, char *argv[])
|
||||
"Bounds", RectangleValue (Rectangle (0, 1000, 0, 1000)),
|
||||
"Speed", RandomVariableValue (ConstantVariable (2000)),
|
||||
"Pause", RandomVariableValue (ConstantVariable (0.2)));
|
||||
mobility.Layout (backbone);
|
||||
mobility.Install (backbone);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
@@ -178,17 +178,19 @@ main (int argc, char *argv[])
|
||||
// the "172.16 address space
|
||||
ipAddrs.SetBase ("172.16.0.0", "255.255.255.0");
|
||||
|
||||
|
||||
for (uint32_t i = 0; i < backboneNodes; ++i)
|
||||
{
|
||||
NS_LOG_INFO ("Configuring local area network for backbone node " << i);
|
||||
//
|
||||
// Create a container to manage the nodes of the LAN. Pick one of
|
||||
// the backbone nodes to be part of the LAN and first add it to
|
||||
// the container. Then create the rest of the nodes we'll need.
|
||||
// Create a container to manage the nodes of the LAN. We need
|
||||
// two containers here; one with all of the new nodes, and one
|
||||
// with all of the nodes including new and existing nodes
|
||||
//
|
||||
NodeContainer lan;
|
||||
lan.Add (backbone.Get (i));
|
||||
lan.Create (lanNodes - 1);
|
||||
NodeContainer newLanNodes;
|
||||
newLanNodes.Create (lanNodes - 1);
|
||||
// Now, create the container with all nodes on this link
|
||||
NodeContainer lan (backbone.Get (i), newLanNodes);
|
||||
//
|
||||
// Create the CSMA net devices and install them into the nodes in our
|
||||
// collection.
|
||||
@@ -198,9 +200,9 @@ main (int argc, char *argv[])
|
||||
csma.SetChannelParameter ("Delay", TimeValue (MilliSeconds (2)));
|
||||
NetDeviceContainer lanDevices = csma.Install (lan);
|
||||
//
|
||||
// Add the IPv4 protocol stack to the nodes in our container
|
||||
// Add the IPv4 protocol stack to the new LAN nodes
|
||||
//
|
||||
internet.Install (lan);
|
||||
internet.Install (newLanNodes);
|
||||
//
|
||||
// Assign IPv4 addresses to the device drivers (actually to the
|
||||
// associated IPv4 interfaces) we just created.
|
||||
@@ -227,13 +229,14 @@ main (int argc, char *argv[])
|
||||
{
|
||||
NS_LOG_INFO ("Configuring wireless network for backbone node " << i);
|
||||
//
|
||||
// Create a container to manage the nodes of the network. Pick one of
|
||||
// the backbone nodes to be part of the network and first add it to
|
||||
// the container. Then create the rest of the nodes we'll need.
|
||||
// Create a container to manage the nodes of the LAN. We need
|
||||
// two containers here; one with all of the new nodes, and one
|
||||
// with all of the nodes including new and existing nodes
|
||||
//
|
||||
NodeContainer infra;
|
||||
infra.Add (backbone.Get (i));
|
||||
infra.Create (infraNodes - 1);
|
||||
NodeContainer newInfraNodes;
|
||||
newInfraNodes.Create (infraNodes - 1);
|
||||
// Now, create the container with all nodes on this link
|
||||
NodeContainer infra (backbone.Get (i), newInfraNodes);
|
||||
//
|
||||
// Create another ad hoc network and devices
|
||||
//
|
||||
@@ -244,7 +247,7 @@ main (int argc, char *argv[])
|
||||
|
||||
// Add the IPv4 protocol stack to the nodes in our container
|
||||
//
|
||||
internet.Install (infra);
|
||||
internet.Install (newInfraNodes);
|
||||
//
|
||||
// Assign IPv4 addresses to the device drivers (actually to the associated
|
||||
// IPv4 interfaces) we just created.
|
||||
@@ -272,7 +275,7 @@ main (int argc, char *argv[])
|
||||
"Bounds", RectangleValue (Rectangle (-25, 25, -25, 25)),
|
||||
"Speed", RandomVariableValue (ConstantVariable (30)),
|
||||
"Pause", RandomVariableValue (ConstantVariable (0.4)));
|
||||
mobility.Layout (infra);
|
||||
mobility.Install (infra);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
@@ -282,7 +285,7 @@ main (int argc, char *argv[])
|
||||
|
||||
NS_LOG_INFO ("Enabling OLSR routing on all backbone nodes");
|
||||
OlsrHelper olsr;
|
||||
olsr.Enable (backbone);
|
||||
olsr.Install (backbone);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
@@ -332,8 +335,8 @@ main (int argc, char *argv[])
|
||||
// asciiTrace.TraceNetDeviceRx ("/NodeList/11|13/DeviceList/0");
|
||||
std::ofstream ascii;
|
||||
ascii.open ("mixed-wireless.tr");
|
||||
WifiHelper::EnableAscii (ascii);
|
||||
CsmaHelper::EnableAscii (ascii);
|
||||
WifiHelper::EnableAsciiAll (ascii);
|
||||
CsmaHelper::EnableAsciiAll (ascii);
|
||||
|
||||
// Let's do a pcap trace on the backbone devices
|
||||
WifiHelper::EnablePcap ("mixed-wireless.pcap", backboneDevices);
|
||||
|
||||
@@ -159,8 +159,8 @@ main (int argc, char *argv[])
|
||||
|
||||
std::ofstream ascii;
|
||||
ascii.open ("simple-alternate-routing.tr");
|
||||
PointToPointHelper::EnablePcap ("simple-alternate-routing");
|
||||
PointToPointHelper::EnableAscii (ascii);
|
||||
PointToPointHelper::EnablePcapAll ("simple-alternate-routing");
|
||||
PointToPointHelper::EnableAsciiAll (ascii);
|
||||
|
||||
NS_LOG_INFO ("Run Simulation.");
|
||||
Simulator::Run ();
|
||||
|
||||
@@ -173,8 +173,8 @@ main (int argc, char *argv[])
|
||||
|
||||
std::ofstream ascii;
|
||||
ascii.open ("simple-error-model.tr");
|
||||
PointToPointHelper::EnablePcap ("simple-error-model");
|
||||
PointToPointHelper::EnableAscii (ascii);
|
||||
PointToPointHelper::EnablePcapAll ("simple-error-model");
|
||||
PointToPointHelper::EnableAsciiAll (ascii);
|
||||
|
||||
NS_LOG_INFO ("Run Simulation.");
|
||||
Simulator::Run ();
|
||||
|
||||
@@ -151,8 +151,8 @@ main (int argc, char *argv[])
|
||||
|
||||
std::ofstream ascii;
|
||||
ascii.open ("simple-global-routing.tr");
|
||||
PointToPointHelper::EnablePcap ("simple-global-routing");
|
||||
PointToPointHelper::EnableAscii (ascii);
|
||||
PointToPointHelper::EnablePcapAll ("simple-global-routing");
|
||||
PointToPointHelper::EnableAsciiAll (ascii);
|
||||
|
||||
NS_LOG_INFO ("Run Simulation.");
|
||||
Simulator::Run ();
|
||||
|
||||
@@ -120,7 +120,7 @@ main (int argc, char *argv[])
|
||||
// Enable OLSR
|
||||
NS_LOG_INFO ("Enabling OLSR Routing.");
|
||||
OlsrHelper olsr;
|
||||
olsr.EnableAll ();
|
||||
olsr.InstallAll ();
|
||||
|
||||
// Create the OnOff application to send UDP datagrams of size
|
||||
// 210 bytes at a rate of 448 Kb/s
|
||||
@@ -158,8 +158,8 @@ main (int argc, char *argv[])
|
||||
|
||||
std::ofstream ascii;
|
||||
ascii.open ("simple-point-to-point-olsr.tr");
|
||||
PointToPointHelper::EnablePcap ("simple-point-to-point-olsr");
|
||||
PointToPointHelper::EnableAscii (ascii);
|
||||
PointToPointHelper::EnablePcapAll ("simple-point-to-point-olsr");
|
||||
PointToPointHelper::EnableAsciiAll (ascii);
|
||||
|
||||
Simulator::StopAt (Seconds (30));
|
||||
|
||||
|
||||
@@ -188,9 +188,9 @@ int main (int argc, char *argv[])
|
||||
|
||||
std::ofstream ascii;
|
||||
ascii.open ("tcp-large-transfer.tr");
|
||||
PointToPointHelper::EnableAscii (ascii);
|
||||
PointToPointHelper::EnableAsciiAll (ascii);
|
||||
|
||||
InternetStackHelper::EnablePcap ("tcp-large-transfer");
|
||||
InternetStackHelper::EnablePcapAll ("tcp-large-transfer");
|
||||
|
||||
Simulator::StopAt (Seconds(1000));
|
||||
Simulator::Run ();
|
||||
|
||||
@@ -128,8 +128,8 @@ main (int argc, char *argv[])
|
||||
|
||||
std::ofstream ascii;
|
||||
ascii.open ("udp-echo.tr");
|
||||
CsmaHelper::EnablePcap ("udp-echo");
|
||||
CsmaHelper::EnableAscii (ascii);
|
||||
CsmaHelper::EnablePcapAll ("udp-echo");
|
||||
CsmaHelper::EnableAsciiAll (ascii);
|
||||
|
||||
//
|
||||
// Now, do the actual simulation.
|
||||
|
||||
@@ -126,7 +126,7 @@ Experiment::Run (const WifiHelper &wifi)
|
||||
mobility.SetPositionAllocator (positionAlloc);
|
||||
mobility.SetMobilityModel ("ns3::StaticMobilityModel");
|
||||
|
||||
mobility.Layout (c);
|
||||
mobility.Install (c);
|
||||
|
||||
PacketSocketAddress socket;
|
||||
socket.SetSingleDevice(devices.Get (0)->GetIfIndex ());
|
||||
|
||||
@@ -152,8 +152,8 @@ int main (int argc, char *argv[])
|
||||
wifi.Install (ap, channel);
|
||||
|
||||
// mobility.
|
||||
mobility.Layout (stas);
|
||||
mobility.Layout (ap);
|
||||
mobility.Install (stas);
|
||||
mobility.Install (ap);
|
||||
|
||||
Simulator::Schedule (Seconds (1.0), &AdvancePosition, ap.Get (0));
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ int main (int argc, char *argv[])
|
||||
// finalize the setup by attaching to each object
|
||||
// in the input array a position and initializing
|
||||
// this position with the calculated coordinates.
|
||||
mobility.Layout (nodes);
|
||||
mobility.Install (nodes);
|
||||
|
||||
// iterate our nodes and print their position.
|
||||
for (NodeContainer::Iterator j = nodes.Begin ();
|
||||
|
||||
@@ -31,7 +31,7 @@ int main (int argc, char *argv[])
|
||||
"Y", StringValue ("100.0"),
|
||||
"Rho", StringValue ("Uniform:0:30"));
|
||||
mobility.SetMobilityModel ("ns3::StaticMobilityModel");
|
||||
mobility.Layout (c);
|
||||
mobility.Install (c);
|
||||
|
||||
Config::Connect ("/NodeList/*/$ns3::MobilityModelNotifier/CourseChange",
|
||||
MakeCallback (&CourseChange));
|
||||
|
||||
@@ -41,7 +41,7 @@ int main (int argc, char *argv[])
|
||||
"Time", StringValue ("2s"),
|
||||
"Speed", StringValue ("Constant:1.0"),
|
||||
"Bounds", StringValue ("0:200:0:100"));
|
||||
mobility.LayoutAll ();
|
||||
mobility.InstallAll ();
|
||||
Config::Connect ("/NodeList/*/$ns3::MobilityModelNotifier/CourseChange",
|
||||
MakeCallback (&CourseChange));
|
||||
|
||||
|
||||
@@ -461,6 +461,40 @@ Buffer::AddAtEnd (uint32_t end)
|
||||
NS_ASSERT (CheckInternalState ());
|
||||
}
|
||||
|
||||
void
|
||||
Buffer::AddAtEnd (const Buffer &o)
|
||||
{
|
||||
if (m_end == m_zeroAreaEnd &&
|
||||
o.m_start == o.m_zeroAreaStart &&
|
||||
o.m_zeroAreaEnd - o.m_zeroAreaStart > 0)
|
||||
{
|
||||
/**
|
||||
* This is an optimization which kicks in when
|
||||
* we attempt to aggregate two buffers which contain
|
||||
* adjacent zero areas.
|
||||
*/
|
||||
uint32_t zeroSize = o.m_zeroAreaEnd - o.m_zeroAreaStart;
|
||||
m_zeroAreaEnd += zeroSize;
|
||||
m_end = m_zeroAreaEnd;
|
||||
uint32_t endData = o.m_end - o.m_zeroAreaEnd;
|
||||
AddAtEnd (endData);
|
||||
Buffer::Iterator dst = End ();
|
||||
dst.Prev (endData);
|
||||
Buffer::Iterator src = o.End ();
|
||||
src.Prev (endData);
|
||||
dst.Write (src, o.End ());
|
||||
return;
|
||||
}
|
||||
Buffer dst = CreateFullCopy ();
|
||||
Buffer src = o.CreateFullCopy ();
|
||||
|
||||
dst.AddAtEnd (src.GetSize ());
|
||||
Buffer::Iterator destStart = dst.End ();
|
||||
destStart.Prev (src.GetSize ());
|
||||
destStart.Write (src.Begin (), src.End ());
|
||||
*this = dst;
|
||||
}
|
||||
|
||||
void
|
||||
Buffer::RemoveAtStart (uint32_t start)
|
||||
{
|
||||
@@ -544,14 +578,6 @@ Buffer
|
||||
Buffer::CreateFragment (uint32_t start, uint32_t length) const
|
||||
{
|
||||
NS_ASSERT (CheckInternalState ());
|
||||
uint32_t zeroStart = m_zeroAreaStart - m_start;
|
||||
uint32_t zeroEnd = zeroStart + m_zeroAreaEnd;
|
||||
if (m_zeroAreaEnd != 0 &&
|
||||
start + length > zeroStart &&
|
||||
start <= zeroEnd)
|
||||
{
|
||||
TransformIntoRealBuffer ();
|
||||
}
|
||||
Buffer tmp = *this;
|
||||
tmp.RemoveAtStart (start);
|
||||
tmp.RemoveAtEnd (GetSize () - (start + length));
|
||||
@@ -563,7 +589,7 @@ Buffer
|
||||
Buffer::CreateFullCopy (void) const
|
||||
{
|
||||
NS_ASSERT (CheckInternalState ());
|
||||
if (m_zeroAreaEnd != 0)
|
||||
if (m_zeroAreaEnd - m_zeroAreaStart != 0)
|
||||
{
|
||||
Buffer tmp;
|
||||
tmp.AddAtStart (m_zeroAreaEnd - m_zeroAreaStart);
|
||||
@@ -1331,6 +1357,21 @@ BufferTest::RunTests (void)
|
||||
NS_TEST_ASSERT (memcmp (inputBuffer.PeekData (), outputBuffer.PeekData (), chunkSize) == 0);
|
||||
}
|
||||
|
||||
buffer = Buffer (5);
|
||||
buffer.AddAtEnd (2);
|
||||
i = buffer.End ();
|
||||
i.Prev (2);
|
||||
i.WriteU8 (0);
|
||||
i.WriteU8 (0x66);
|
||||
ENSURE_WRITTEN_BYTES (buffer, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66);
|
||||
Buffer frag0 = buffer.CreateFragment (0, 2);
|
||||
ENSURE_WRITTEN_BYTES (frag0, 2, 0x00, 0x00);
|
||||
Buffer frag1 = buffer.CreateFragment (2, 5);
|
||||
ENSURE_WRITTEN_BYTES (frag1, 5, 0x00, 0x00, 0x00, 0x00, 0x66);
|
||||
frag0.AddAtEnd (frag1);
|
||||
ENSURE_WRITTEN_BYTES (buffer, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66);
|
||||
ENSURE_WRITTEN_BYTES (frag0, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -410,6 +410,8 @@ public:
|
||||
* pointing to this Buffer.
|
||||
*/
|
||||
void AddAtEnd (uint32_t end);
|
||||
|
||||
void AddAtEnd (const Buffer &o);
|
||||
/**
|
||||
* \param start size to remove
|
||||
*
|
||||
|
||||
@@ -159,14 +159,7 @@ Packet::RemoveTrailer (Trailer &trailer)
|
||||
void
|
||||
Packet::AddAtEnd (Ptr<const Packet> packet)
|
||||
{
|
||||
Buffer src = packet->m_buffer.CreateFullCopy ();
|
||||
Buffer dst = m_buffer.CreateFullCopy ();
|
||||
|
||||
dst.AddAtEnd (src.GetSize ());
|
||||
Buffer::Iterator destStart = dst.End ();
|
||||
destStart.Prev (src.GetSize ());
|
||||
destStart.Write (src.Begin (), src.End ());
|
||||
m_buffer = dst;
|
||||
m_buffer.AddAtEnd (packet->m_buffer);
|
||||
/**
|
||||
* XXX: we might need to merge the tag list of the
|
||||
* other packet into the current packet.
|
||||
|
||||
@@ -103,7 +103,7 @@ CsmaHelper::EnablePcap (std::string filename, NodeContainer n)
|
||||
}
|
||||
|
||||
void
|
||||
CsmaHelper::EnablePcap (std::string filename)
|
||||
CsmaHelper::EnablePcapAll (std::string filename)
|
||||
{
|
||||
EnablePcap (filename, NodeContainer::GetGlobal ());
|
||||
}
|
||||
@@ -150,7 +150,7 @@ CsmaHelper::EnableAscii (std::ostream &os, NodeContainer n)
|
||||
}
|
||||
|
||||
void
|
||||
CsmaHelper::EnableAscii (std::ostream &os)
|
||||
CsmaHelper::EnableAsciiAll (std::ostream &os)
|
||||
{
|
||||
EnableAscii (os, NodeContainer::GetGlobal ());
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
* Enable pcap output on each device which is of the
|
||||
* ns3::CsmaNetDevice type
|
||||
*/
|
||||
static void EnablePcap (std::string filename);
|
||||
static void EnablePcapAll (std::string filename);
|
||||
|
||||
/**
|
||||
* \param os output stream
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
* ns3::CsmaNetDevice type and dump that to the specified
|
||||
* stdc++ output stream.
|
||||
*/
|
||||
static void EnableAscii (std::ostream &os);
|
||||
static void EnableAsciiAll (std::ostream &os);
|
||||
|
||||
/**
|
||||
* \param c a set of nodes
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
#include "ns3/assert.h"
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/object.h"
|
||||
#include "ns3/ipv4.h"
|
||||
#include "internet-stack-helper.h"
|
||||
#include "ns3/internet-stack.h"
|
||||
#include "ns3/packet-socket-factory.h"
|
||||
@@ -33,6 +37,12 @@ InternetStackHelper::Install (NodeContainer c)
|
||||
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
if (node->GetObject<Ipv4> () != 0)
|
||||
{
|
||||
NS_FATAL_ERROR ("InternetStackHelper::Install(): Aggregating "
|
||||
"an InternetStack to a node with an existing Ipv4 object");
|
||||
return;
|
||||
}
|
||||
AddInternetStack (node);
|
||||
Ptr<PacketSocketFactory> factory = CreateObject<PacketSocketFactory> ();
|
||||
node->AggregateObject (factory);
|
||||
@@ -40,7 +50,7 @@ InternetStackHelper::Install (NodeContainer c)
|
||||
}
|
||||
|
||||
void
|
||||
InternetStackHelper::EnablePcap (std::string filename)
|
||||
InternetStackHelper::EnablePcapAll (std::string filename)
|
||||
{
|
||||
InternetStackHelper::m_pcapBaseFilename = filename;
|
||||
Config::Connect ("/NodeList/*/$ns3::Ipv4L3Protocol/Tx",
|
||||
|
||||
@@ -37,7 +37,10 @@ public:
|
||||
* \param c the set of nodes
|
||||
*
|
||||
* For each node in the input container, aggregate implementations
|
||||
* of the ns3::Ipv4, ns3::Udp, and, ns3::Tcp classes.
|
||||
* of the ns3::Ipv4, ns3::Udp, and, ns3::Tcp classes. The program
|
||||
* will assert if this method is called on a container with a node
|
||||
* that already has an Ipv4 object aggregated to it.
|
||||
*
|
||||
*/
|
||||
void Install (NodeContainer c);
|
||||
|
||||
@@ -47,7 +50,7 @@ public:
|
||||
* Enable pcap output on each protocol instance which is of the
|
||||
* ns3::Ipv4L3Protocol type. Both Tx and Rx events will be logged.
|
||||
*/
|
||||
static void EnablePcap (std::string filename);
|
||||
static void EnablePcapAll (std::string filename);
|
||||
|
||||
private:
|
||||
static void LogRxIp (std::string context, Ptr<const Packet> packet, uint32_t deviceId);
|
||||
|
||||
@@ -124,7 +124,7 @@ MobilityHelper::GetMobilityModelType (void) const
|
||||
}
|
||||
|
||||
void
|
||||
MobilityHelper::Layout (NodeContainer c)
|
||||
MobilityHelper::Install (NodeContainer c)
|
||||
{
|
||||
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
|
||||
{
|
||||
@@ -169,9 +169,9 @@ MobilityHelper::Layout (NodeContainer c)
|
||||
}
|
||||
|
||||
void
|
||||
MobilityHelper::LayoutAll (void)
|
||||
MobilityHelper::InstallAll (void)
|
||||
{
|
||||
Layout (NodeContainer::GetGlobal ());
|
||||
Install (NodeContainer::GetGlobal ());
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -34,7 +34,7 @@ class MobilityModel;
|
||||
/**
|
||||
* \brief assign positions and mobility models to nodes.
|
||||
*
|
||||
* MobilityHelper::Layout is the most important method here.
|
||||
* MobilityHelper::Install is the most important method here.
|
||||
*/
|
||||
class MobilityHelper
|
||||
{
|
||||
@@ -43,14 +43,14 @@ public:
|
||||
~MobilityHelper ();
|
||||
|
||||
/**
|
||||
* After this method is called, every call to MobilityHelper::Layout
|
||||
* After this method is called, every call to MobilityHelper::Install
|
||||
* will also attach to the new ns3::MobilityModel an ns3::MobilityModelNotifier
|
||||
* which can be used to listen to CourseChange events.
|
||||
*/
|
||||
void EnableNotifier (void);
|
||||
/**
|
||||
* After this method is called, no ns3::MobilityModelNotifier object will
|
||||
* be associated to any new ns3::MobilityModel created by MobilityHelper::Layout.
|
||||
* be associated to any new ns3::MobilityModel created by MobilityHelper::Install.
|
||||
* This will make it impossible to listen to "CourseChange" events from these
|
||||
* new ns3::MobilityModel instances.
|
||||
*/
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
* \param allocator allocate initial node positions
|
||||
*
|
||||
* Set the position allocator which will be used to allocate
|
||||
* the initial position of every node in MobilityModel::Layout.
|
||||
* the initial position of every node in MobilityModel::Install.
|
||||
*/
|
||||
void SetPositionAllocator (Ptr<PositionAllocator> allocator);
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
* \param n9 the name of the attribute to set in the mobility model.
|
||||
* \param v9 the value of the attribute to set in the mobility model.
|
||||
*
|
||||
* Calls to MobilityHelper::Layout will create an instance of a matching
|
||||
* Calls to MobilityHelper::Install will create an instance of a matching
|
||||
* mobility model for each node.
|
||||
*/
|
||||
void SetMobilityModel (std::string type,
|
||||
@@ -136,9 +136,9 @@ public:
|
||||
*
|
||||
* Push an item on the top of the stack of "reference mobility models".
|
||||
* The input item should be a node instance to which a mobility model
|
||||
* has already been aggregated (usually by a call to Layout).
|
||||
* has already been aggregated (usually by a call to Install).
|
||||
*
|
||||
* If this this stack is not empty when MobilityHelper::Layout
|
||||
* If this this stack is not empty when MobilityHelper::Install
|
||||
* is called, the model from the top of the stack is used
|
||||
* to create a ns3::HierarchicalMobilityModel to make the
|
||||
* newly-created models define their positions relative to that
|
||||
@@ -171,15 +171,15 @@ public:
|
||||
* position allocator (set through MobilityHelper::SetPositionAllocator).
|
||||
* Optionally, this method will also create and aggregate a
|
||||
* ns3::MobilityModelNotifier to generate 'CourseChange' events based on the
|
||||
* boolean flag set by MobilityHelper::EnableNotifier and MobilityHelper::DisableNotifier.
|
||||
* boolean flag set by MobilityHelper::EnableNotifierAll and MobilityHelper::DisableNotifier.
|
||||
*/
|
||||
void Layout (NodeContainer container);
|
||||
void Install (NodeContainer container);
|
||||
|
||||
/**
|
||||
* Perform the work of MobilityHelper::Layout on _all_ nodes which
|
||||
* Perform the work of MobilityHelper::Install on _all_ nodes which
|
||||
* exist in the simulation.
|
||||
*/
|
||||
void LayoutAll (void);
|
||||
void InstallAll (void);
|
||||
private:
|
||||
|
||||
std::vector<Ptr<MobilityModel> > m_mobilityStack;
|
||||
|
||||
@@ -154,9 +154,9 @@ Ns2MobilityHelper::LayoutObjectStore (const ObjectStore &store) const
|
||||
}
|
||||
|
||||
void
|
||||
Ns2MobilityHelper::Layout (void) const
|
||||
Ns2MobilityHelper::Install (void) const
|
||||
{
|
||||
Layout (NodeList::Begin (), NodeList::End ());
|
||||
Install (NodeList::Begin (), NodeList::End ());
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
* whose nodeId is matches the nodeId of the nodes in the trace
|
||||
* file.
|
||||
*/
|
||||
void Layout (void) const;
|
||||
void Install (void) const;
|
||||
|
||||
/**
|
||||
* \param begin an iterator which points to the start of the input
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
* the index of the object in the input array.
|
||||
*/
|
||||
template <typename T>
|
||||
void Layout (T begin, T end) const;
|
||||
void Install (T begin, T end) const;
|
||||
private:
|
||||
class ObjectStore
|
||||
{
|
||||
@@ -86,7 +86,7 @@ namespace ns3 {
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
Ns2MobilityHelper::Layout (T begin, T end) const
|
||||
Ns2MobilityHelper::Install (T begin, T end) const
|
||||
{
|
||||
class MyObjectStore : public ObjectStore
|
||||
{
|
||||
|
||||
@@ -51,26 +51,32 @@ OlsrHelper::SetAgent (std::string tid,
|
||||
}
|
||||
|
||||
void
|
||||
OlsrHelper::Enable (NodeContainer container)
|
||||
OlsrHelper::Install (NodeContainer container)
|
||||
{
|
||||
for (NodeContainer::Iterator i = container.Begin (); i != container.End (); ++i)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
Enable (node);
|
||||
Install (node);
|
||||
}
|
||||
}
|
||||
void
|
||||
OlsrHelper::Enable (Ptr<Node> node)
|
||||
OlsrHelper::Install (Ptr<Node> node)
|
||||
{
|
||||
if (node->GetObject<olsr::Agent> () != 0)
|
||||
{
|
||||
NS_FATAL_ERROR ("OlsrHelper::Install(): Aggregating "
|
||||
"an Olsr Agent to a node with an existing Olsr Agent");
|
||||
return;
|
||||
}
|
||||
Ptr<olsr::Agent> agent = m_agentFactory.Create<olsr::Agent> ();
|
||||
agent->SetNode (node);
|
||||
node->AggregateObject (agent);
|
||||
agent->Start ();
|
||||
}
|
||||
void
|
||||
OlsrHelper::EnableAll (void)
|
||||
OlsrHelper::InstallAll (void)
|
||||
{
|
||||
Enable (NodeContainer::GetGlobal ());
|
||||
Install (NodeContainer::GetGlobal ());
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -41,9 +41,9 @@ public:
|
||||
std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
|
||||
std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
|
||||
|
||||
void Enable (NodeContainer container);
|
||||
void Enable (Ptr<Node> node);
|
||||
void EnableAll (void);
|
||||
void Install (NodeContainer container);
|
||||
void Install (Ptr<Node> node);
|
||||
void InstallAll (void);
|
||||
private:
|
||||
ObjectFactory m_agentFactory;
|
||||
};
|
||||
|
||||
@@ -103,7 +103,7 @@ PointToPointHelper::EnablePcap (std::string filename, NodeContainer n)
|
||||
}
|
||||
|
||||
void
|
||||
PointToPointHelper::EnablePcap (std::string filename)
|
||||
PointToPointHelper::EnablePcapAll (std::string filename)
|
||||
{
|
||||
EnablePcap (filename, NodeContainer::GetGlobal ());
|
||||
}
|
||||
@@ -150,7 +150,7 @@ PointToPointHelper::EnableAscii (std::ostream &os, NodeContainer n)
|
||||
}
|
||||
|
||||
void
|
||||
PointToPointHelper::EnableAscii (std::ostream &os)
|
||||
PointToPointHelper::EnableAsciiAll (std::ostream &os)
|
||||
{
|
||||
EnableAscii (os, NodeContainer::GetGlobal ());
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
* Enable pcap output on each device which is of the
|
||||
* ns3::PointToPointNetDevice type
|
||||
*/
|
||||
static void EnablePcap (std::string filename);
|
||||
static void EnablePcapAll (std::string filename);
|
||||
|
||||
/**
|
||||
* \param os output stream
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
* ns3::PointToPointNetDevice type and dump that to the specified
|
||||
* stdc++ output stream.
|
||||
*/
|
||||
static void EnableAscii (std::ostream &os);
|
||||
static void EnableAsciiAll (std::ostream &os);
|
||||
|
||||
/**
|
||||
* \param c a set of nodes
|
||||
|
||||
@@ -184,7 +184,7 @@ WifiHelper::EnablePcap (std::string filename, NodeContainer n)
|
||||
}
|
||||
|
||||
void
|
||||
WifiHelper::EnablePcap (std::string filename)
|
||||
WifiHelper::EnablePcapAll (std::string filename)
|
||||
{
|
||||
EnablePcap (filename, NodeContainer::GetGlobal ());
|
||||
}
|
||||
@@ -225,7 +225,7 @@ WifiHelper::EnableAscii (std::ostream &os, NodeContainer n)
|
||||
}
|
||||
|
||||
void
|
||||
WifiHelper::EnableAscii (std::ostream &os)
|
||||
WifiHelper::EnableAsciiAll (std::ostream &os)
|
||||
{
|
||||
EnableAscii (os, NodeContainer::GetGlobal ());
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
* Enable pcap output on each device which is of the
|
||||
* ns3::WifiNetDevice type
|
||||
*/
|
||||
static void EnablePcap (std::string filename);
|
||||
static void EnablePcapAll (std::string filename);
|
||||
|
||||
/**
|
||||
* \param os output stream
|
||||
@@ -215,7 +215,7 @@ public:
|
||||
* ns3::WifiNetDevice type and dump that to the specified
|
||||
* stdc++ output stream.
|
||||
*/
|
||||
static void EnableAscii (std::ostream &os);
|
||||
static void EnableAsciiAll (std::ostream &os);
|
||||
|
||||
/**
|
||||
* \param c a set of nodes
|
||||
|
||||
@@ -36,11 +36,6 @@ namespace ns3 {
|
||||
void
|
||||
AddInternetStack (Ptr<Node> node)
|
||||
{
|
||||
// This may be called on a node with a previously added stack
|
||||
if (node->GetObject<Ipv4> ())
|
||||
{
|
||||
return;
|
||||
}
|
||||
Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
|
||||
Ptr<ArpL3Protocol> arp = CreateObject<ArpL3Protocol> ();
|
||||
ipv4->SetNode (node);
|
||||
|
||||
@@ -370,6 +370,9 @@ int TcpSocket::Send (const uint8_t* buf, uint32_t size)
|
||||
" state " << m_state);
|
||||
Actions_t action = ProcessEvent (APP_SEND);
|
||||
NS_LOG_DEBUG(" action " << action);
|
||||
// We do not model any limit to the buffer, so report that the
|
||||
// maximum is available
|
||||
NotifySend (std::numeric_limits<uint32_t>::max ());
|
||||
if (!ProcessAction (action))
|
||||
{
|
||||
return -1; // Failed, return zero
|
||||
@@ -689,6 +692,9 @@ bool TcpSocket::ProcessPacketAction (Actions_t a, Ptr<Packet> p,
|
||||
if (tcpHeader.GetAckNumber () > m_highestRxAck)
|
||||
{
|
||||
m_highestRxAck = tcpHeader.GetAckNumber ();
|
||||
// We do not model any limit to the buffer, so report that the
|
||||
// maximum is available
|
||||
NotifySend (std::numeric_limits<uint32_t>::max ());
|
||||
}
|
||||
SendPendingData ();
|
||||
break;
|
||||
@@ -1077,6 +1083,9 @@ void TcpSocket::CommonNewAck (SequenceNumber ack, bool skipTimer)
|
||||
NS_LOG_LOGIC ("TCP " << this << " NewAck " << ack
|
||||
<< " numberAck " << (ack - m_highestRxAck)); // Number bytes ack'ed
|
||||
m_highestRxAck = ack; // Note the highest recieved Ack
|
||||
// We do not model any limit to the buffer, so report that the
|
||||
// maximum is available
|
||||
NotifySend (std::numeric_limits<uint32_t>::max ());
|
||||
if (ack > m_nextTxSequence)
|
||||
{
|
||||
m_nextTxSequence = ack; // If advanced
|
||||
|
||||
@@ -64,11 +64,19 @@ Socket::SetAcceptCallback (
|
||||
m_closeRequested = closeRequested;
|
||||
}
|
||||
|
||||
void
|
||||
Socket::SetSendCallback (Callback<void, Ptr<Socket>, uint32_t> dataSent)
|
||||
bool
|
||||
Socket::SetDataSentCallback (Callback<void, Ptr<Socket>, uint32_t> dataSent)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
m_dataSent = dataSent;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
Socket::SetSendCallback (Callback<void, Ptr<Socket>, uint32_t> sendCb)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
m_sendCb = sendCb;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -78,6 +86,12 @@ Socket::SetRecvCallback (Callback<void, Ptr<Socket>, Ptr<Packet>,const Address&>
|
||||
m_receivedData = receivedData;
|
||||
}
|
||||
|
||||
int Socket::Listen (uint32_t queueLimit)
|
||||
{
|
||||
return 0; //XXX the base class version does nothing
|
||||
}
|
||||
|
||||
|
||||
int Socket::Send (const uint8_t* buf, uint32_t size)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
@@ -108,12 +122,6 @@ int Socket::SendTo (const Address &address, const uint8_t* buf, uint32_t size)
|
||||
return SendTo (address,p);
|
||||
}
|
||||
|
||||
int Socket::Listen(uint32_t queueLimit)
|
||||
{
|
||||
return 0; //XXX the base class version does nothing
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Socket::NotifyCloseCompleted (void)
|
||||
{
|
||||
@@ -202,6 +210,16 @@ Socket::NotifyDataSent (uint32_t size)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Socket::NotifySend (uint32_t spaceAvailable)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
if (!m_sendCb.IsNull ())
|
||||
{
|
||||
m_sendCb (this, spaceAvailable);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Socket::NotifyDataReceived (Ptr<Packet> p, const Address &from)
|
||||
{
|
||||
|
||||
@@ -38,9 +38,11 @@ class Packet;
|
||||
* \brief Define a Socket API based on the BSD Socket API.
|
||||
*
|
||||
* Contrary to the original BSD socket API, this API is asynchronous:
|
||||
* it does not contain blocking calls. Other than that, it tries to stick
|
||||
* to the BSD API to make it easier those who know the BSD API to use
|
||||
* this API.
|
||||
* it does not contain blocking calls. It also uses class ns3::Packet
|
||||
* as a fancy byte buffer, allowing data to be passed across the API
|
||||
* using an ns3::Packet instead of a raw data pointer. Other than that,
|
||||
* it tries to stick to the BSD API to make it easier for those who know
|
||||
* the BSD API to use this API.
|
||||
*/
|
||||
class Socket : public Object
|
||||
{
|
||||
@@ -94,8 +96,8 @@ public:
|
||||
* Or when I call Close ?
|
||||
*/
|
||||
void SetConnectCallback (Callback<void, Ptr<Socket> > connectionSucceeded,
|
||||
Callback<void, Ptr<Socket> > connectionFailed,
|
||||
Callback<void, Ptr<Socket> > halfClose);
|
||||
Callback<void, Ptr<Socket> > connectionFailed,
|
||||
Callback<void, Ptr<Socket> > halfClose);
|
||||
/**
|
||||
* \brief Accept connection requests from remote hosts
|
||||
* \param connectionRequest Callback for connection request from peer.
|
||||
@@ -120,7 +122,34 @@ public:
|
||||
Callback<void, Ptr<Socket>,
|
||||
const Address&> newConnectionCreated,
|
||||
Callback<void, Ptr<Socket> > closeRequested);
|
||||
void SetSendCallback (Callback<void, Ptr<Socket>, uint32_t> dataSent);
|
||||
/**
|
||||
* \brief Notify application when a packet has been sent from transport
|
||||
* protocol (non-standard socket call)
|
||||
* \param dataSent Callback for the event that data is sent from the
|
||||
* underlying transport protocol. This callback is passed a
|
||||
* pointer to the socket, and the number of bytes sent.
|
||||
* \returns whether or not this socket supports this callback. Note
|
||||
* that this is a non-standard socket call. Some socket
|
||||
* implementations in ns-3 may not support this call, so the
|
||||
* user should check this return value to confirm that the
|
||||
* callback is supported.
|
||||
*/
|
||||
virtual bool SetDataSentCallback (Callback<void, Ptr<Socket>, uint32_t> dataSent);
|
||||
/**
|
||||
* \brief Notify application when space in transmit buffer is added
|
||||
*
|
||||
* This callback is intended to notify a
|
||||
* socket that would have been blocked in a blocking socket model
|
||||
* that space is available in the transmit buffer and that it
|
||||
* can call Send() again.
|
||||
*
|
||||
* \param sendCb Callback for the event that the socket transmit buffer
|
||||
* fill level has decreased. This callback is passed a pointer to
|
||||
* the socket, and the number of bytes available for writing
|
||||
* into the buffer (an absolute value). If there is no transmit
|
||||
* buffer limit, a maximum-sized integer is always returned.
|
||||
*/
|
||||
void SetSendCallback (Callback<void, Ptr<Socket>, uint32_t> sendCb);
|
||||
/**
|
||||
* \brief Receive data
|
||||
* \param receivedData Invoked whenever new data is received.
|
||||
@@ -150,7 +179,7 @@ public:
|
||||
* After the Close call, the socket is no longer valid, and cannot
|
||||
* safely be used for subsequent operations.
|
||||
*/
|
||||
virtual int Close(void) = 0;
|
||||
virtual int Close (void) = 0;
|
||||
|
||||
/**
|
||||
* \returns zero on success, -1 on failure.
|
||||
@@ -172,8 +201,15 @@ public:
|
||||
* \brief Initiate a connection to a remote host
|
||||
* \param address Address of remote.
|
||||
*/
|
||||
virtual int Connect(const Address &address) = 0;
|
||||
virtual int Connect (const Address &address) = 0;
|
||||
|
||||
/**
|
||||
* \brief Listen for incoming connections.
|
||||
* \param queueLimit maximum number of incoming request to queue
|
||||
* \returns XXX an error code
|
||||
*/
|
||||
virtual int Listen (uint32_t queueLimit);
|
||||
|
||||
/**
|
||||
* \brief Send data (or dummy data) to the remote host
|
||||
* \param p packet to send
|
||||
@@ -200,14 +236,7 @@ public:
|
||||
* \returns -1 in case of error or the number of bytes copied in the
|
||||
* internal buffer and accepted for transmission.
|
||||
*/
|
||||
virtual int SendTo(const Address &address,Ptr<Packet> p) = 0;
|
||||
|
||||
/**
|
||||
* \brief Listen for incoming connections.
|
||||
* \param queueLimit maximum number of incoming request to queue
|
||||
* \returns XXX an error code
|
||||
*/
|
||||
virtual int Listen(uint32_t queueLimit);
|
||||
virtual int SendTo (const Address &address,Ptr<Packet> p) = 0;
|
||||
|
||||
/**
|
||||
* \brief Send data to a specified peer.
|
||||
@@ -221,7 +250,7 @@ public:
|
||||
* This is provided so as to have an API which is closer in appearance
|
||||
* to that of real network or BSD sockets.
|
||||
*/
|
||||
int SendTo(const Address &address, const uint8_t* buf, uint32_t size);
|
||||
int SendTo (const Address &address, const uint8_t* buf, uint32_t size);
|
||||
|
||||
protected:
|
||||
void NotifyCloseCompleted (void);
|
||||
@@ -232,6 +261,7 @@ protected:
|
||||
void NotifyNewConnectionCreated (Ptr<Socket> socket, const Address &from);
|
||||
void NotifyCloseRequested (void);
|
||||
void NotifyDataSent (uint32_t size);
|
||||
void NotifySend (uint32_t spaceAvailable);
|
||||
void NotifyDataReceived (Ptr<Packet> p, const Address &from);
|
||||
|
||||
Callback<void,Ptr<Socket> > m_closeCompleted;
|
||||
@@ -242,6 +272,7 @@ protected:
|
||||
Callback<bool, Ptr<Socket>, const Address &> m_connectionRequest;
|
||||
Callback<void, Ptr<Socket>, const Address&> m_newConnectionCreated;
|
||||
Callback<void, Ptr<Socket>, uint32_t> m_dataSent;
|
||||
Callback<void, Ptr<Socket>, uint32_t > m_sendCb;
|
||||
Callback<void, Ptr<Socket>, Ptr<Packet>,const Address&> m_receivedData;
|
||||
};
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ main (int argc, char *argv[])
|
||||
|
||||
std::ofstream ascii;
|
||||
ascii.open ("tutorial.tr");
|
||||
CsmaHelper::EnableAscii (ascii);
|
||||
CsmaHelper::EnableAsciiAll (ascii);
|
||||
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
@@ -65,7 +65,7 @@ main (int argc, char *argv[])
|
||||
|
||||
std::ofstream os;
|
||||
os.open ("tutorial.tr");
|
||||
CsmaHelper::EnableAscii (os);
|
||||
CsmaHelper::EnableAsciiAll (os);
|
||||
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
@@ -61,7 +61,7 @@ main (int argc, char *argv[])
|
||||
apps.Start (Seconds (1.0));
|
||||
apps.Stop (Seconds (10.0));
|
||||
|
||||
CsmaHelper::EnablePcap ("tutorial");
|
||||
CsmaHelper::EnablePcapAll ("tutorial");
|
||||
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
@@ -137,11 +137,11 @@ main (int argc, char *argv[])
|
||||
|
||||
std::ofstream os;
|
||||
os.open ("tutorial.tr");
|
||||
PointToPointHelper::EnableAscii (os);
|
||||
CsmaHelper::EnableAscii (os);
|
||||
PointToPointHelper::EnableAsciiAll (os);
|
||||
CsmaHelper::EnableAsciiAll (os);
|
||||
|
||||
PointToPointHelper::EnablePcap ("tutorial");
|
||||
CsmaHelper::EnablePcap ("tutorial");
|
||||
PointToPointHelper::EnablePcapAll ("tutorial");
|
||||
CsmaHelper::EnablePcapAll ("tutorial");
|
||||
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
@@ -71,7 +71,7 @@ main (int argc, char *argv[])
|
||||
|
||||
std::ofstream ascii;
|
||||
ascii.open ("tutorial.tr");
|
||||
PointToPointHelper::EnableAscii (ascii);
|
||||
PointToPointHelper::EnableAsciiAll (ascii);
|
||||
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
@@ -101,7 +101,7 @@ main (int argc, char *argv[])
|
||||
|
||||
std::ofstream ascii;
|
||||
ascii.open ("tutorial.tr");
|
||||
PointToPointHelper::EnableAscii (ascii);
|
||||
PointToPointHelper::EnableAsciiAll (ascii);
|
||||
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
@@ -98,7 +98,7 @@ main (int argc, char *argv[])
|
||||
|
||||
std::ofstream ascii;
|
||||
ascii.open ("tutorial.tr");
|
||||
PointToPointHelper::EnableAscii (ascii);
|
||||
PointToPointHelper::EnableAsciiAll (ascii);
|
||||
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
Reference in New Issue
Block a user