--- a/src/applications/helper/ping6-helper.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/helper/ping6-helper.cc Fri May 13 14:51:11 2011 -0400
@@ -61,7 +61,7 @@
node->AddApplication (client);
apps.Add (client);
}
- return apps;
+ return apps;
}
void Ping6Helper::SetIfIndex (uint32_t ifIndex)
--- a/src/applications/helper/ping6-helper.h Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/helper/ping6-helper.h Fri May 13 14:51:11 2011 -0400
@@ -101,7 +101,7 @@
Ipv6Address m_remoteIp;
/**
- * \brief Out interface index.
+ * \brief Out interface index.
*/
uint32_t m_ifIndex;
--- a/src/applications/helper/udp-client-server-helper.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/helper/udp-client-server-helper.cc Fri May 13 14:51:11 2011 -0400
@@ -27,7 +27,8 @@
namespace ns3 {
UdpServerHelper::UdpServerHelper ()
-{}
+{
+}
UdpServerHelper::UdpServerHelper (uint16_t port)
{
@@ -64,7 +65,8 @@
}
UdpClientHelper::UdpClientHelper ()
-{}
+{
+}
UdpClientHelper::UdpClientHelper (Ipv4Address address, uint16_t port)
{
@@ -94,7 +96,8 @@
}
UdpTraceClientHelper::UdpTraceClientHelper ()
-{}
+{
+}
UdpTraceClientHelper::UdpTraceClientHelper (Ipv4Address address, uint16_t port, std::string filename)
{
--- a/src/applications/helper/udp-client-server-helper.h Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/helper/udp-client-server-helper.h Fri May 13 14:51:11 2011 -0400
@@ -28,35 +28,35 @@
#include "ns3/udp-server.h"
#include "ns3/udp-client.h"
namespace ns3 {
- /**
- * \brief Create a server application which waits for input udp packets
- * and uses the information carried into their payload to compute
- * delay and to determine if some packets are lost.
- */
+/**
+ * \brief Create a server application which waits for input udp packets
+ * and uses the information carried into their payload to compute
+ * delay and to determine if some packets are lost.
+ */
class UdpServerHelper
{
public:
- /**
- * Create UdpServerHelper which will make life easier for people trying
- * to set up simulations with udp-client-server application.
- *
- */
+ /**
+ * Create UdpServerHelper which will make life easier for people trying
+ * to set up simulations with udp-client-server application.
+ *
+ */
UdpServerHelper ();
- /**
- * Create UdpServerHelper which will make life easier for people trying
- * to set up simulations with udp-client-server application.
- *
- * \param port The port the server will wait on for incoming packets
- */
+ /**
+ * Create UdpServerHelper which will make life easier for people trying
+ * to set up simulations with udp-client-server application.
+ *
+ * \param port The port the server will wait on for incoming packets
+ */
UdpServerHelper (uint16_t port);
- /**
- * Record an attribute to be set in each Application after it is is created.
- *
- * \param name the name of the attribute to set
- * \param value the value of the attribute to set
- */
+ /**
+ * Record an attribute to be set in each Application after it is is created.
+ *
+ * \param name the name of the attribute to set
+ * \param value the value of the attribute to set
+ */
void SetAttribute (std::string name, const AttributeValue &value);
/**
@@ -91,13 +91,13 @@
*/
UdpClientHelper ();
- /**
- * Create UdpClientHelper which will make life easier for people trying
- * to set up simulations with udp-client-server.
- *
- * \param ip The IP address of the remote udp server
- * \param port The port number of the remote udp server
- */
+ /**
+ * Create UdpClientHelper which will make life easier for people trying
+ * to set up simulations with udp-client-server.
+ *
+ * \param ip The IP address of the remote udp server
+ * \param port The port number of the remote udp server
+ */
UdpClientHelper (Ipv4Address ip, uint16_t port);
@@ -121,16 +121,16 @@
private:
ObjectFactory m_factory;
};
- /**
- * Create udpTraceClient application which sends udp packets based on a trace
- * file of an MPEG4 stream. Trace files could be downloaded form :
- * http://www.tkn.tu-berlin.de/research/trace/ltvt.html (the 2 first lines of
- * the file should be removed)
- * A valid trace file is a file with 4 columns:
- * -1- the first one represents the frame index
- * -2- the second one indicates the type of the frame: I, P or B
- * -3- the third one indicates the time on which the frame was generated by the encoder
- * -4- the fourth one indicates the frame size in byte
+/**
+ * Create udpTraceClient application which sends udp packets based on a trace
+ * file of an MPEG4 stream. Trace files could be downloaded form :
+ * http://www.tkn.tu-berlin.de/research/trace/ltvt.html (the 2 first lines of
+ * the file should be removed)
+ * A valid trace file is a file with 4 columns:
+ * -1- the first one represents the frame index
+ * -2- the second one indicates the type of the frame: I, P or B
+ * -3- the third one indicates the time on which the frame was generated by the encoder
+ * -4- the fourth one indicates the frame size in byte
*/
class UdpTraceClientHelper
{
--- a/src/applications/helper/udp-echo-helper.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/helper/udp-echo-helper.cc Fri May 13 14:51:11 2011 -0400
@@ -69,7 +69,7 @@
{
Ptr<Application> app = m_factory.Create<UdpEchoServer> ();
node->AddApplication (app);
-
+
return app;
}
@@ -136,7 +136,7 @@
{
Ptr<Application> app = m_factory.Create<UdpEchoClient> ();
node->AddApplication (app);
-
+
return app;
}
--- a/src/applications/model/onoff-application.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/onoff-application.cc Fri May 13 14:51:11 2011 -0400
@@ -84,7 +84,7 @@
MakeTypeIdChecker ())
.AddTraceSource ("Tx", "A new packet is created and is sent",
MakeTraceSourceAccessor (&OnOffApplication::m_txTrace))
- ;
+ ;
return tid;
}
@@ -207,7 +207,7 @@
uint32_t bits = m_pktSize * 8 - m_residualBits;
NS_LOG_LOGIC ("bits = " << bits);
Time nextTime(Seconds (bits /
- static_cast<double>(m_cbrRate.GetBitRate()))); // Time till next packet
+ static_cast<double>(m_cbrRate.GetBitRate()))); // Time till next packet
NS_LOG_LOGIC ("nextTime = " << nextTime);
m_sendEvent = Simulator::Schedule(nextTime,
&OnOffApplication::SendPacket, this);
@@ -236,7 +236,7 @@
m_startStopEvent = Simulator::Schedule(onInterval, &OnOffApplication::StopSending, this);
}
-
+
void OnOffApplication::SendPacket()
{
NS_LOG_FUNCTION_NOARGS ();
@@ -258,7 +258,7 @@
m_connected = true;
ScheduleStartEvent();
}
-
+
void OnOffApplication::ConnectionFailed(Ptr<Socket>)
{
NS_LOG_FUNCTION_NOARGS ();
--- a/src/applications/model/onoff-application.h Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/onoff-application.h Fri May 13 14:51:11 2011 -0400
@@ -51,39 +51,39 @@
* During the "On" state, cbr traffic is generated. This cbr traffic is
* characterized by the specified "data rate" and "packet size".
*/
- /**
- * \ingroup onoff
- *
- * \brief Generate traffic to a single destination according to an
- * OnOff pattern.
- *
- * This traffic generator follows an On/Off pattern: after
- * Application::StartApplication
- * is called, "On" and "Off" states alternate. The duration of each of
- * these states is determined with the onTime and the offTime random
- * variables. During the "Off" state, no traffic is generated.
- * During the "On" state, cbr traffic is generated. This cbr traffic is
- * characterized by the specified "data rate" and "packet size".
- *
- * Note: When an application is started, the first packet transmission
- * occurs _after_ a delay equal to (packet size/bit rate). Note also,
- * when an application transitions into an off state in between packet
- * transmissions, the remaining time until when the next transmission
- * would have occurred is cached and is used when the application starts
- * up again. Example: packet size = 1000 bits, bit rate = 500 bits/sec.
- * If the application is started at time 3 seconds, the first packet
- * transmission will be scheduled for time 5 seconds (3 + 1000/500)
- * and subsequent transmissions at 2 second intervals. If the above
- * application were instead stopped at time 4 seconds, and restarted at
- * time 5.5 seconds, then the first packet would be sent at time 6.5 seconds,
- * because when it was stopped at 4 seconds, there was only 1 second remaining
- * until the originally scheduled transmission, and this time remaining
- * information is cached and used to schedule the next transmission
- * upon restarting.
- *
- * If the underlying socket type supports broadcast, this application
- * will automatically enable the SetAllowBroadcast(true) socket option.
- */
+/**
+* \ingroup onoff
+*
+* \brief Generate traffic to a single destination according to an
+* OnOff pattern.
+*
+* This traffic generator follows an On/Off pattern: after
+* Application::StartApplication
+* is called, "On" and "Off" states alternate. The duration of each of
+* these states is determined with the onTime and the offTime random
+* variables. During the "Off" state, no traffic is generated.
+* During the "On" state, cbr traffic is generated. This cbr traffic is
+* characterized by the specified "data rate" and "packet size".
+*
+* Note: When an application is started, the first packet transmission
+* occurs _after_ a delay equal to (packet size/bit rate). Note also,
+* when an application transitions into an off state in between packet
+* transmissions, the remaining time until when the next transmission
+* would have occurred is cached and is used when the application starts
+* up again. Example: packet size = 1000 bits, bit rate = 500 bits/sec.
+* If the application is started at time 3 seconds, the first packet
+* transmission will be scheduled for time 5 seconds (3 + 1000/500)
+* and subsequent transmissions at 2 second intervals. If the above
+* application were instead stopped at time 4 seconds, and restarted at
+* time 5.5 seconds, then the first packet would be sent at time 6.5 seconds,
+* because when it was stopped at 4 seconds, there was only 1 second remaining
+* until the originally scheduled transmission, and this time remaining
+* information is cached and used to schedule the next transmission
+* upon restarting.
+*
+* If the underlying socket type supports broadcast, this application
+* will automatically enable the SetAllowBroadcast(true) socket option.
+*/
class OnOffApplication : public Application
{
public:
@@ -138,7 +138,7 @@
DataRate m_cbrRate; // Rate that data is generated
uint32_t m_pktSize; // Size of packets
uint32_t m_residualBits; // Number of generated, but not sent, bits
- Time m_lastStartTime;// Time last packet sent
+ Time m_lastStartTime; // Time last packet sent
uint32_t m_maxBytes; // Limit total number of bytes sent
uint32_t m_totBytes; // Total bytes sent so far
EventId m_startStopEvent; // Event id for next start or stop event
@@ -146,7 +146,7 @@
bool m_sending; // True if currently in sending state
TypeId m_tid;
TracedCallback<Ptr<const Packet> > m_txTrace;
-
+
private:
void ScheduleNextTx();
void ScheduleStartEvent();
--- a/src/applications/model/packet-loss-counter.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/packet-loss-counter.cc Fri May 13 14:51:11 2011 -0400
@@ -103,7 +103,7 @@
void
PacketLossCounter::NotifyReceived (uint32_t seqNum)
{
- for (uint32_t i=m_lastMaxSeqNum+1; i<=seqNum;i++)
+ for (uint32_t i=m_lastMaxSeqNum+1; i<=seqNum; i++)
{
if (GetBit(i)!=1)
{
--- a/src/applications/model/packet-sink.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/packet-sink.cc Fri May 13 14:51:11 2011 -0400
@@ -54,7 +54,7 @@
MakeTypeIdChecker ())
.AddTraceSource ("Rx", "A packet has been received",
MakeTraceSourceAccessor (&PacketSink::m_rxTrace))
- ;
+ ;
return tid;
}
@@ -74,7 +74,7 @@
{
return m_totalRx;
}
-
+
Ptr<Socket>
PacketSink::GetListeningSocket (void) const
{
@@ -128,22 +128,22 @@
m_socket->SetRecvCallback (MakeCallback(&PacketSink::HandleRead, this));
m_socket->SetAcceptCallback (
- MakeNullCallback<bool, Ptr<Socket>, const Address &> (),
- MakeCallback(&PacketSink::HandleAccept, this));
+ MakeNullCallback<bool, Ptr<Socket>, const Address &> (),
+ MakeCallback(&PacketSink::HandleAccept, this));
m_socket->SetCloseCallbacks (
- MakeCallback(&PacketSink::HandlePeerClose, this),
- MakeCallback(&PacketSink::HandlePeerError, this));
+ MakeCallback(&PacketSink::HandlePeerClose, this),
+ MakeCallback(&PacketSink::HandlePeerError, this));
}
void PacketSink::StopApplication() // Called at time specified by Stop
{
NS_LOG_FUNCTION (this);
while(!m_socketList.empty()) //these are accepted sockets, close them
- {
- Ptr<Socket> acceptedSocket = m_socketList.front();
- m_socketList.pop_front();
- acceptedSocket->Close();
- }
+ {
+ Ptr<Socket> acceptedSocket = m_socketList.front();
+ m_socketList.pop_front();
+ acceptedSocket->Close();
+ }
if (m_socket)
{
m_socket->Close ();
@@ -160,7 +160,7 @@
{
if (packet->GetSize() == 0)
{ //EOF
- break;
+ break;
}
if (InetSocketAddress::IsMatchingType (from))
{
@@ -168,8 +168,8 @@
m_totalRx += packet->GetSize();
NS_LOG_INFO ("Received " << packet->GetSize() << " bytes from " <<
address.GetIpv4() << " [" << address << "]"
- << " total Rx " << m_totalRx);
- }
+ << " total Rx " << m_totalRx);
+ }
m_rxTrace (packet, from);
}
}
--- a/src/applications/model/packet-sink.h Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/packet-sink.h Fri May 13 14:51:11 2011 -0400
@@ -99,7 +99,7 @@
void HandleAccept (Ptr<Socket>, const Address& from);
void HandlePeerClose(Ptr<Socket>);
void HandlePeerError(Ptr<Socket>);
-
+
// In the case of TCP, each socket accept returns a new socket, so the
// listening socket is stored seperately from the accepted sockets
Ptr<Socket> m_socket; // Listening socket
@@ -109,7 +109,7 @@
uint32_t m_totalRx; // Total bytes received
TypeId m_tid; // Protocol TypeId
TracedCallback<Ptr<const Packet>, const Address &> m_rxTrace;
-
+
};
} // namespace ns3
--- a/src/applications/model/ping6.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/ping6.cc Fri May 13 14:51:11 2011 -0400
@@ -72,7 +72,7 @@
UintegerValue (100),
MakeUintegerAccessor (&Ping6::m_size),
MakeUintegerChecker<uint32_t>())
- ;
+ ;
return tid;
}
--- a/src/applications/model/radvd-interface.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/radvd-interface.cc Fri May 13 14:51:11 2011 -0400
@@ -29,7 +29,7 @@
/* initialize default value as specified in radvd.conf manpage */
m_sendAdvert = true;
m_maxRtrAdvInterval = 600000;
- m_minRtrAdvInterval = (uint32_t)(double)(0.33 * m_maxRtrAdvInterval);
+ m_minRtrAdvInterval = (uint32_t)(double) (0.33 * m_maxRtrAdvInterval);
m_minDelayBetweenRAs = 3000;
m_managedFlag = false;
m_otherConfigFlag = false;
@@ -77,9 +77,9 @@
{
/* clear prefixes */
for (RadvdPrefixListI it = m_prefixes.begin () ; it != m_prefixes.end () ; ++it)
- {
- (*it) = 0;
- }
+ {
+ (*it) = 0;
+ }
m_prefixes.clear ();
}
--- a/src/applications/model/radvd-interface.h Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/radvd-interface.h Fri May 13 14:51:11 2011 -0400
@@ -62,7 +62,7 @@
uint32_t GetInterface () const;
/**
- * \brief Get list of prefixes advertised for this interface.
+ * \brief Get list of prefixes advertised for this interface.
* \return list of IPv6 prefixes
*/
std::list <Ptr<RadvdPrefix> > GetPrefixes () const;
--- a/src/applications/model/radvd-prefix.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/radvd-prefix.cc Fri May 13 14:51:11 2011 -0400
@@ -25,12 +25,12 @@
RadvdPrefix::RadvdPrefix (Ipv6Address network, uint8_t prefixLength, uint32_t preferredLifeTime, uint32_t validLifeTime, bool onLinkFlag, bool autonomousFlag, bool routerAddrFlag)
: m_network (network),
- m_prefixLength (prefixLength),
- m_preferredLifeTime (preferredLifeTime),
- m_validLifeTime (validLifeTime),
- m_onLinkFlag (onLinkFlag),
- m_autonomousFlag (autonomousFlag),
- m_routerAddrFlag (routerAddrFlag)
+ m_prefixLength (prefixLength),
+ m_preferredLifeTime (preferredLifeTime),
+ m_validLifeTime (validLifeTime),
+ m_onLinkFlag (onLinkFlag),
+ m_autonomousFlag (autonomousFlag),
+ m_routerAddrFlag (routerAddrFlag)
{
}
--- a/src/applications/model/radvd.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/radvd.cc Fri May 13 14:51:11 2011 -0400
@@ -48,7 +48,7 @@
static TypeId tid = TypeId ("ns3::Radvd")
.SetParent<Application> ()
.AddConstructor<Radvd> ()
- ;
+ ;
return tid;
}
--- a/src/applications/model/seq-ts-header.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/seq-ts-header.cc Fri May 13 14:51:11 2011 -0400
@@ -33,45 +33,46 @@
SeqTsHeader::SeqTsHeader ()
: m_seq (0),
m_ts (Simulator::Now ().GetTimeStep ())
-{}
+{
+}
-void
+void
SeqTsHeader::SetSeq (uint32_t seq)
{
m_seq = seq;
}
-uint32_t
+uint32_t
SeqTsHeader::GetSeq (void) const
{
return m_seq;
}
-Time
+Time
SeqTsHeader::GetTs (void) const
{
return TimeStep (m_ts);
}
-TypeId
+TypeId
SeqTsHeader::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::SeqTsHeader")
.SetParent<Header> ()
.AddConstructor<SeqTsHeader> ()
- ;
+ ;
return tid;
}
-TypeId
+TypeId
SeqTsHeader::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
-void
+void
SeqTsHeader::Print (std::ostream &os) const
{
os << "(seq=" << m_seq << " time=" << TimeStep (m_ts).GetSeconds () << ")";
}
-uint32_t
+uint32_t
SeqTsHeader::GetSerializedSize (void) const
{
return 4+8;
--- a/src/applications/model/seq-ts-header.h Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/seq-ts-header.h Fri May 13 14:51:11 2011 -0400
@@ -51,7 +51,7 @@
Time GetTs (void) const;
static TypeId GetTypeId (void);
- private:
+private:
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
--- a/src/applications/model/udp-client.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/udp-client.cc Fri May 13 14:51:11 2011 -0400
@@ -53,11 +53,11 @@
MakeTimeAccessor (&UdpClient::m_interval),
MakeTimeChecker ())
.AddAttribute (
- "RemoteAddress",
- "The destination Ipv4Address of the outbound packets",
- Ipv4AddressValue (),
- MakeIpv4AddressAccessor (&UdpClient::m_peerAddress),
- MakeIpv4AddressChecker ())
+ "RemoteAddress",
+ "The destination Ipv4Address of the outbound packets",
+ Ipv4AddressValue (),
+ MakeIpv4AddressAccessor (&UdpClient::m_peerAddress),
+ MakeIpv4AddressChecker ())
.AddAttribute ("RemotePort", "The destination port of the outbound packets",
UintegerValue (100),
MakeUintegerAccessor (&UdpClient::m_peerPort),
@@ -67,7 +67,7 @@
UintegerValue (1024),
MakeUintegerAccessor (&UdpClient::m_size),
MakeUintegerChecker<uint32_t> (12,1500))
- ;
+ ;
return tid;
}
@@ -135,15 +135,15 @@
if ((m_socket->Send (p)) >= 0)
{
++m_sent;
- NS_LOG_INFO ("TraceDelay TX " << m_size << " bytes to "
- << m_peerAddress << " Uid: " << p->GetUid ()
- << " Time: " << (Simulator::Now ()).GetSeconds ());
+ NS_LOG_INFO ("TraceDelay TX " << m_size << " bytes to "
+ << m_peerAddress << " Uid: " << p->GetUid ()
+ << " Time: " << (Simulator::Now ()).GetSeconds ());
}
else
{
NS_LOG_INFO ("Error while sending " << m_size << " bytes to "
- << m_peerAddress);
+ << m_peerAddress);
}
if (m_sent < m_count)
--- a/src/applications/model/udp-echo-client.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/udp-echo-client.cc Fri May 13 14:51:11 2011 -0400
@@ -65,7 +65,7 @@
MakeUintegerChecker<uint32_t> ())
.AddTraceSource ("Tx", "A new packet is created and is sent",
MakeTraceSourceAccessor (&UdpEchoClient::m_txTrace))
- ;
+ ;
return tid;
}
@@ -301,7 +301,7 @@
{
InetSocketAddress address = InetSocketAddress::ConvertFrom (from);
NS_LOG_INFO ("Received " << packet->GetSize() << " bytes from " <<
- address.GetIpv4());
+ address.GetIpv4());
}
}
}
--- a/src/applications/model/udp-echo-server.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/udp-echo-server.cc Fri May 13 14:51:11 2011 -0400
@@ -45,7 +45,7 @@
UintegerValue (9),
MakeUintegerAccessor (&UdpEchoServer::m_port),
MakeUintegerChecker<uint16_t> ())
- ;
+ ;
return tid;
}
@@ -119,7 +119,7 @@
{
InetSocketAddress address = InetSocketAddress::ConvertFrom (from);
NS_LOG_INFO ("Received " << packet->GetSize() << " bytes from " <<
- address.GetIpv4());
+ address.GetIpv4());
packet->RemoveAllPacketTags ();
packet->RemoveAllByteTags ();
--- a/src/applications/model/udp-server.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/udp-server.cc Fri May 13 14:51:11 2011 -0400
@@ -56,12 +56,12 @@
MakeUintegerAccessor (&UdpServer::GetPacketWindowSize,
&UdpServer::SetPacketWindowSize),
MakeUintegerChecker<uint16_t> (8,256))
- ;
+ ;
return tid;
}
UdpServer::UdpServer ()
- : m_lossCounter (0)
+ : m_lossCounter (0)
{
NS_LOG_FUNCTION (this);
m_received=0;
--- a/src/applications/model/udp-trace-client.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/udp-trace-client.cc Fri May 13 14:51:11 2011 -0400
@@ -40,16 +40,16 @@
NS_OBJECT_ENSURE_REGISTERED (UdpTraceClient);
struct UdpTraceClient::TraceEntry UdpTraceClient::g_defaultEntries[] = {
- {0, 534, 'I'},
- {40, 1542, 'P'},
- {120, 134, 'B'},
- {80, 390, 'B'},
- {240, 765, 'P'},
- {160, 407, 'B'},
- {200, 504, 'B'},
- {360, 903, 'P'},
- {280, 421, 'B'},
- {320, 587, 'B'}
+ { 0, 534, 'I'},
+ { 40, 1542, 'P'},
+ { 120, 134, 'B'},
+ { 80, 390, 'B'},
+ { 240, 765, 'P'},
+ { 160, 407, 'B'},
+ { 200, 504, 'B'},
+ { 360, 903, 'P'},
+ { 280, 421, 'B'},
+ { 320, 587, 'B'}
};
TypeId
@@ -79,7 +79,7 @@
MakeStringAccessor (&UdpTraceClient::SetTraceFile),
MakeStringChecker ())
- ;
+ ;
return tid;
}
@@ -93,7 +93,7 @@
}
UdpTraceClient::UdpTraceClient (Ipv4Address ip, uint16_t port,
- char *traceFile)
+ char *traceFile)
{
NS_LOG_FUNCTION (this);
m_sent = 0;
@@ -259,12 +259,12 @@
{
++m_sent;
NS_LOG_INFO ("Sent " << size << " bytes to "
- << m_peerAddress);
+ << m_peerAddress);
}
else
{
NS_LOG_INFO ("Error while sending " << size << " bytes to "
- << m_peerAddress);
+ << m_peerAddress);
}
}
--- a/src/applications/model/v4ping.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/model/v4ping.cc Fri May 13 14:51:11 2011 -0400
@@ -37,10 +37,10 @@
.SetParent<Application> ()
.AddConstructor<V4Ping> ()
.AddAttribute ("Remote",
- "The address of the machine we want to ping.",
- Ipv4AddressValue (),
- MakeIpv4AddressAccessor (&V4Ping::m_remote),
- MakeIpv4AddressChecker ())
+ "The address of the machine we want to ping.",
+ Ipv4AddressValue (),
+ MakeIpv4AddressAccessor (&V4Ping::m_remote),
+ MakeIpv4AddressChecker ())
.AddAttribute ("Verbose",
"Produce usual output.",
BooleanValue (false),
@@ -55,9 +55,9 @@
MakeUintegerAccessor (&V4Ping::m_size),
MakeUintegerChecker<uint32_t> (16))
.AddTraceSource ("Rtt",
- "The rtt calculated by the ping.",
- MakeTraceSourceAccessor (&V4Ping::m_traceRtt));
- ;
+ "The rtt calculated by the ping.",
+ MakeTraceSourceAccessor (&V4Ping::m_traceRtt));
+ ;
return tid;
}
@@ -71,7 +71,8 @@
{
}
V4Ping::~V4Ping ()
-{}
+{
+}
void
V4Ping::DoDispose (void)
@@ -88,9 +89,9 @@
for (uint32_t i = 0; i < node->GetNApplications (); ++i)
{
if (node->GetApplication (i) == this)
- {
- return i;
- }
+ {
+ return i;
+ }
}
NS_ASSERT_MSG (false, "forgot to add application to node");
return 0; // quiet compiler
@@ -115,46 +116,46 @@
Icmpv4Header icmp;
p->RemoveHeader (icmp);
if (icmp.GetType () == Icmpv4Header::ECHO_REPLY)
- {
- Icmpv4Echo echo;
- p->RemoveHeader (echo);
- std::map<uint16_t, Time>::iterator i = m_sent.find(echo.GetSequenceNumber());
+ {
+ Icmpv4Echo echo;
+ p->RemoveHeader (echo);
+ std::map<uint16_t, Time>::iterator i = m_sent.find(echo.GetSequenceNumber());
- if (i != m_sent.end () && echo.GetIdentifier () == 0)
- {
+ if (i != m_sent.end () && echo.GetIdentifier () == 0)
+ {
uint32_t buf[m_size / 4];
- uint32_t dataSize = echo.GetDataSize ();
+ uint32_t dataSize = echo.GetDataSize ();
uint32_t nodeId;
uint32_t appId;
- if (dataSize == sizeof(buf))
- {
+ if (dataSize == sizeof(buf))
+ {
echo.GetData ((uint8_t *)buf);
Read32 ((const uint8_t *) &buf[0], nodeId);
Read32 ((const uint8_t *) &buf[1], appId);
- if (nodeId == GetNode ()->GetId () &&
- appId == GetApplicationId ())
- {
- Time sendTime = i->second;
- NS_ASSERT (Simulator::Now () >= sendTime);
- Time delta = Simulator::Now () - sendTime;
-
- m_sent.erase (i);
- m_avgRtt.Update (delta.GetMilliSeconds());
- m_recv++;
- m_traceRtt (delta);
-
- if (m_verbose)
- {
- std::cout << recvSize << " bytes from " << realFrom.GetIpv4() << ":"
+ if (nodeId == GetNode ()->GetId () &&
+ appId == GetApplicationId ())
+ {
+ Time sendTime = i->second;
+ NS_ASSERT (Simulator::Now () >= sendTime);
+ Time delta = Simulator::Now () - sendTime;
+
+ m_sent.erase (i);
+ m_avgRtt.Update (delta.GetMilliSeconds());
+ m_recv++;
+ m_traceRtt (delta);
+
+ if (m_verbose)
+ {
+ std::cout << recvSize << " bytes from " << realFrom.GetIpv4() << ":"
<< " icmp_seq=" << echo.GetSequenceNumber ()
<< " ttl=" << (unsigned)ipv4.GetTtl ()
<< " time=" << delta.GetMilliSeconds() << " ms\n";
- }
- }
- }
- }
- }
+ }
+ }
+ }
+ }
+ }
}
}
@@ -195,7 +196,7 @@
uint8_t data[m_size];
for (uint32_t i = 0; i < m_size; ++i) data[i] = 0;
NS_ASSERT (m_size >= 16);
-
+
uint32_t tmp = GetNode ()->GetId ();
Write32 (&data[0 * sizeof(uint32_t)], tmp);
@@ -215,20 +216,20 @@
p->AddHeader (header);
m_sent.insert (std::make_pair (m_seq - 1, Simulator::Now()));
m_socket->Send (p, 0);
- m_next = Simulator::Schedule (m_interval, & V4Ping::Send, this);
+ m_next = Simulator::Schedule (m_interval, &V4Ping::Send, this);
}
void
V4Ping::StartApplication (void)
{
NS_LOG_FUNCTION (this);
-
+
m_started = Simulator::Now ();
if (m_verbose)
{
std::cout << "PING " << m_remote << " 56(84) bytes of data.\n";
}
-
+
m_socket = Socket::CreateSocket (GetNode (), TypeId::LookupByName ("ns3::Ipv4RawSocketFactory"));
NS_ASSERT (m_socket != 0);
m_socket->SetAttribute ("Protocol", UintegerValue (1)); // icmp
@@ -240,7 +241,7 @@
InetSocketAddress dst = InetSocketAddress (m_remote, 0);
status = m_socket->Connect (dst);
NS_ASSERT (status != -1);
-
+
Send ();
}
void
@@ -249,20 +250,20 @@
NS_LOG_FUNCTION (this);
m_next.Cancel();
m_socket->Close ();
-
+
if (m_verbose)
{
std::ostringstream os;
os.precision (4);
os << "--- " << m_remote << " ping statistics ---\n"
- << m_seq << " packets transmitted, " << m_recv << " received, "
- << ((m_seq - m_recv) * 100 / m_seq) << "% packet loss, "
- << "time " << (Simulator::Now () - m_started).GetMilliSeconds () << "ms\n";
-
+ << m_seq << " packets transmitted, " << m_recv << " received, "
+ << ((m_seq - m_recv) * 100 / m_seq) << "% packet loss, "
+ << "time " << (Simulator::Now () - m_started).GetMilliSeconds () << "ms\n";
+
if (m_avgRtt.Count () > 0)
os << "rtt min/avg/max/mdev = " << m_avgRtt.Min() << "/" << m_avgRtt.Avg() << "/"
- << m_avgRtt.Max() << "/" << m_avgRtt.Stddev()
- << " ms\n";
+ << m_avgRtt.Max() << "/" << m_avgRtt.Stddev()
+ << " ms\n";
std::cout << os.str();
}
}
--- a/src/applications/test/udp-client-server-test.cc Fri May 13 14:50:47 2011 -0400
+++ b/src/applications/test/udp-client-server-test.cc Fri May 13 14:51:11 2011 -0400
@@ -41,7 +41,7 @@
* correctly received by an udpServer application
*/
-class UdpClientServerTestCase: public TestCase
+class UdpClientServerTestCase : public TestCase
{
public:
UdpClientServerTestCase ();
@@ -115,7 +115,7 @@
* correctly received by an udpServer application
*/
-class UdpTraceClientServerTestCase: public TestCase
+class UdpTraceClientServerTestCase : public TestCase
{
public:
UdpTraceClientServerTestCase ();
@@ -184,7 +184,7 @@
* Test that all the PacketLossCounter class checks loss correctly in different cases
*/
-class PacketLossCounterTestCase: public TestCase
+class PacketLossCounterTestCase : public TestCase
{
public:
PacketLossCounterTestCase ();
@@ -208,20 +208,20 @@
{
PacketLossCounter lossCounter(32);
lossCounter.NotifyReceived(32); //out of order
- for (uint32_t i=0;i<64;i++)
+ for (uint32_t i=0; i<64; i++)
{
lossCounter.NotifyReceived(i);
}
NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost(), 0, "Check that 0 packets are lost");
- for (uint32_t i=65;i<128;i++) // drop (1) seqNum 64
+ for (uint32_t i=65; i<128; i++) // drop (1) seqNum 64
{
lossCounter.NotifyReceived(i);
}
NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost(), 1, "Check that 1 packet is lost");
- for (uint32_t i=134;i<200;i++) // drop seqNum 128,129,130,131,132,133
+ for (uint32_t i=134; i<200; i++) // drop seqNum 128,129,130,131,132,133
{
lossCounter.NotifyReceived(i);
}
@@ -236,7 +236,7 @@
lossCounter.NotifyReceived(202);
lossCounter.NotifyReceived(203);
lossCounter.NotifyReceived(204);
- for (uint32_t i=205;i<250;i++)
+ for (uint32_t i=205; i<250; i++)
{
lossCounter.NotifyReceived(i);
}
@@ -248,13 +248,13 @@
lossCounter.NotifyReceived(252);
lossCounter.NotifyReceived(253);
lossCounter.NotifyReceived(254);
- for (uint32_t i=256;i<300;i++)
+ for (uint32_t i=256; i<300; i++)
{
lossCounter.NotifyReceived(i);
}
NS_TEST_ASSERT_MSG_EQ (lossCounter.GetLost(), 9, "Check that 9 (6+1+2) packet are lost");
}
-class UdpClientServerTestSuite: public TestSuite
+class UdpClientServerTestSuite : public TestSuite
{
public:
UdpClientServerTestSuite ();