Clean up function logging of applications module.

This commit is contained in:
Vedran Miletić
2012-11-10 18:45:37 +01:00
parent a476a9085f
commit e640ed81af
12 changed files with 144 additions and 34 deletions

View File

@@ -35,23 +35,27 @@ PacketLossCounter::PacketLossCounter (uint8_t bitmapSize)
m_lastMaxSeqNum (0),
m_receiveBitMap (0)
{
NS_LOG_FUNCTION (this << bitmapSize);
SetBitMapSize (bitmapSize);
}
PacketLossCounter::~PacketLossCounter ()
{
NS_LOG_FUNCTION (this);
delete [] m_receiveBitMap;
}
uint16_t
PacketLossCounter::GetBitMapSize () const
{
NS_LOG_FUNCTION (this);
return m_bitMapSize * 8;
}
void
PacketLossCounter::SetBitMapSize (uint16_t winSize)
{
NS_LOG_FUNCTION (this << winSize);
NS_ASSERT_MSG (winSize%8==0,"The packet window size should be a multiple of 8");
m_bitMapSize = winSize/8;
@@ -66,18 +70,21 @@ PacketLossCounter::SetBitMapSize (uint16_t winSize)
uint32_t
PacketLossCounter::GetLost () const
{
NS_LOG_FUNCTION (this);
return m_lost;
}
bool
PacketLossCounter::GetBit (uint32_t seqNum)
{
NS_LOG_FUNCTION (this << seqNum);
return ((m_receiveBitMap[(seqNum%(m_bitMapSize*8))/8] >> (7-(seqNum%8)))&0x01);
}
void
PacketLossCounter::SetBit (uint32_t seqNum, bool val)
{
NS_LOG_FUNCTION (this << seqNum << val);
if (val)
{
m_receiveBitMap[(seqNum%(m_bitMapSize*8))/8] |= 0x80 >> (seqNum%8);
@@ -103,6 +110,7 @@ PacketLossCounter::SetBit (uint32_t seqNum, bool val)
void
PacketLossCounter::NotifyReceived (uint32_t seqNum)
{
NS_LOG_FUNCTION (this << seqNum);
for (uint32_t i=m_lastMaxSeqNum+1; i<=seqNum; i++)
{
if (GetBit (i)!=1)
@@ -118,4 +126,5 @@ PacketLossCounter::NotifyReceived (uint32_t seqNum)
m_lastMaxSeqNum = seqNum;
}
}
}
} // namespace ns3

View File

@@ -71,6 +71,7 @@ PacketSink::~PacketSink()
uint32_t PacketSink::GetTotalRx () const
{
NS_LOG_FUNCTION (this);
return m_totalRx;
}

View File

@@ -19,13 +19,17 @@
*/
#include "radvd-interface.h"
#include <ns3/log.h>
namespace ns3
{
NS_LOG_COMPONENT_DEFINE ("RadvdInterface");
RadvdInterface::RadvdInterface (uint32_t interface)
: m_interface (interface)
{
NS_LOG_FUNCTION (this << interface);
/* initialize default value as specified in radvd.conf manpage */
m_sendAdvert = true;
m_maxRtrAdvInterval = 600000;
@@ -51,6 +55,7 @@ RadvdInterface::RadvdInterface (uint32_t interface)
RadvdInterface::RadvdInterface (uint32_t interface, uint32_t maxRtrAdvInterval, uint32_t minRtrAdvInterval)
: m_interface (interface)
{
NS_LOG_FUNCTION (this << interface << maxRtrAdvInterval << minRtrAdvInterval);
NS_ASSERT (maxRtrAdvInterval > minRtrAdvInterval);
m_sendAdvert = true;
m_maxRtrAdvInterval = maxRtrAdvInterval;
@@ -75,6 +80,7 @@ RadvdInterface::RadvdInterface (uint32_t interface, uint32_t maxRtrAdvInterval,
RadvdInterface::~RadvdInterface ()
{
NS_LOG_FUNCTION (this);
/* clear prefixes */
for (RadvdPrefixListI it = m_prefixes.begin (); it != m_prefixes.end (); ++it)
{
@@ -85,207 +91,248 @@ RadvdInterface::~RadvdInterface ()
void RadvdInterface::AddPrefix (Ptr<RadvdPrefix> routerPrefix)
{
NS_LOG_FUNCTION (this << routerPrefix);
m_prefixes.push_back (routerPrefix);
}
uint32_t RadvdInterface::GetInterface () const
{
NS_LOG_FUNCTION (this);
return m_interface;
}
std::list<Ptr<RadvdPrefix> > RadvdInterface::GetPrefixes () const
{
NS_LOG_FUNCTION (this);
return m_prefixes;
}
bool RadvdInterface::IsSendAdvert () const
{
NS_LOG_FUNCTION (this);
return m_sendAdvert;
}
void RadvdInterface::SetSendAdvert (bool sendAdvert)
{
NS_LOG_FUNCTION (this << sendAdvert);
m_sendAdvert = sendAdvert;
}
uint32_t RadvdInterface::GetMaxRtrAdvInterval () const
{
NS_LOG_FUNCTION (this);
return m_maxRtrAdvInterval;
}
void RadvdInterface::SetMaxRtrAdvInterval (uint32_t maxRtrAdvInterval)
{
NS_LOG_FUNCTION (this << maxRtrAdvInterval);
m_maxRtrAdvInterval = maxRtrAdvInterval;
}
uint32_t RadvdInterface::GetMinRtrAdvInterval () const
{
NS_LOG_FUNCTION (this);
return m_minRtrAdvInterval;
}
void RadvdInterface::SetMinRtrAdvInterval (uint32_t minRtrAdvInterval)
{
NS_LOG_FUNCTION (this << minRtrAdvInterval);
m_minRtrAdvInterval = minRtrAdvInterval;
}
uint32_t RadvdInterface::GetMinDelayBetweenRAs () const
{
NS_LOG_FUNCTION (this);
return m_minDelayBetweenRAs;
}
void RadvdInterface::SetMinDelayBetweenRAs (uint32_t minDelayBetweenRAs)
{
NS_LOG_FUNCTION (this << minDelayBetweenRAs);
m_minDelayBetweenRAs = minDelayBetweenRAs;
}
bool RadvdInterface::IsManagedFlag () const
{
NS_LOG_FUNCTION (this);
return m_managedFlag;
}
void RadvdInterface::SetManagedFlag (bool managedFlag)
{
NS_LOG_FUNCTION (this << managedFlag);
m_managedFlag = managedFlag;
}
bool RadvdInterface::IsOtherConfigFlag () const
{
NS_LOG_FUNCTION (this);
return m_otherConfigFlag;
}
void RadvdInterface::SetOtherConfigFlag (bool otherConfigFlag)
{
NS_LOG_FUNCTION (this << otherConfigFlag);
m_otherConfigFlag = otherConfigFlag;
}
uint32_t RadvdInterface::GetLinkMtu () const
{
NS_LOG_FUNCTION (this);
return m_linkMtu;
}
void RadvdInterface::SetLinkMtu (uint32_t linkMtu)
{
NS_LOG_FUNCTION (this << linkMtu);
m_linkMtu = linkMtu;
}
uint32_t RadvdInterface::GetReachableTime () const
{
NS_LOG_FUNCTION (this);
return m_reachableTime;
}
void RadvdInterface::SetReachableTime (uint32_t reachableTime)
{
NS_LOG_FUNCTION (this << reachableTime);
m_reachableTime = reachableTime;
}
uint32_t RadvdInterface::GetDefaultLifeTime () const
{
NS_LOG_FUNCTION (this);
return m_defaultLifeTime;
}
void RadvdInterface::SetDefaultLifeTime (uint32_t defaultLifeTime)
{
NS_LOG_FUNCTION (this << defaultLifeTime);
m_defaultLifeTime = defaultLifeTime;
}
uint32_t RadvdInterface::GetRetransTimer () const
{
NS_LOG_FUNCTION (this);
return m_retransTimer;
}
void RadvdInterface::SetRetransTimer (uint32_t retransTimer)
{
NS_LOG_FUNCTION (this << retransTimer);
m_retransTimer = retransTimer;
}
uint8_t RadvdInterface::GetCurHopLimit () const
{
NS_LOG_FUNCTION (this);
return m_curHopLimit;
}
void RadvdInterface::SetCurHopLimit (uint8_t curHopLimit)
{
NS_LOG_FUNCTION (this << curHopLimit);
m_curHopLimit = curHopLimit;
}
uint8_t RadvdInterface::GetDefaultPreference () const
{
NS_LOG_FUNCTION (this);
return m_defaultPreference;
}
void RadvdInterface::SetDefaultPreference (uint8_t defaultPreference)
{
NS_LOG_FUNCTION (this << defaultPreference);
m_defaultPreference = defaultPreference;
}
bool RadvdInterface::IsSourceLLAddress () const
{
NS_LOG_FUNCTION (this);
return m_sourceLLAddress;
}
void RadvdInterface::SetSourceLLAddress (bool sourceLLAddress)
{
NS_LOG_FUNCTION (this << sourceLLAddress);
m_sourceLLAddress = sourceLLAddress;
}
bool RadvdInterface::IsHomeAgentFlag () const
{
NS_LOG_FUNCTION (this);
return m_homeAgentFlag;
}
void RadvdInterface::SetHomeAgentFlag (bool homeAgentFlag)
{
NS_LOG_FUNCTION (this << homeAgentFlag);
m_homeAgentFlag = homeAgentFlag;
}
bool RadvdInterface::IsHomeAgentInfo () const
{
NS_LOG_FUNCTION (this);
return m_homeAgentInfo;
}
void RadvdInterface::SetHomeAgentInfo (bool homeAgentInfo)
{
NS_LOG_FUNCTION (this << homeAgentInfo);
m_homeAgentInfo = homeAgentInfo;
}
uint32_t RadvdInterface::GetHomeAgentLifeTime () const
{
NS_LOG_FUNCTION (this);
return m_homeAgentLifeTime;
}
void RadvdInterface::SetHomeAgentLifeTime (uint32_t homeAgentLifeTime)
{
NS_LOG_FUNCTION (this << homeAgentLifeTime);
m_homeAgentLifeTime = homeAgentLifeTime;
}
uint32_t RadvdInterface::GetHomeAgentPreference () const
{
NS_LOG_FUNCTION (this);
return m_homeAgentPreference;
}
void RadvdInterface::SetHomeAgentPreference (uint32_t homeAgentPreference)
{
NS_LOG_FUNCTION (this << homeAgentPreference);
m_homeAgentPreference = homeAgentPreference;
}
bool RadvdInterface::IsMobRtrSupportFlag () const
{
NS_LOG_FUNCTION (this);
return m_mobRtrSupportFlag;
}
void RadvdInterface::SetMobRtrSupportFlag (bool mobRtrSupportFlag)
{
NS_LOG_FUNCTION (this << mobRtrSupportFlag);
m_mobRtrSupportFlag = mobRtrSupportFlag;
}
bool RadvdInterface::IsIntervalOpt () const
{
NS_LOG_FUNCTION (this);
return m_intervalOpt;
}
void RadvdInterface::SetIntervalOpt (bool intervalOpt)
{
NS_LOG_FUNCTION (this << intervalOpt);
m_intervalOpt = intervalOpt;
}
} /* namespace ns3 */

View File

@@ -19,10 +19,13 @@
*/
#include "radvd-prefix.h"
#include <ns3/log.h>
namespace ns3
{
NS_LOG_COMPONENT_DEFINE ("RadvdPrefix");
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),
@@ -32,79 +35,95 @@ RadvdPrefix::RadvdPrefix (Ipv6Address network, uint8_t prefixLength, uint32_t pr
m_autonomousFlag (autonomousFlag),
m_routerAddrFlag (routerAddrFlag)
{
NS_LOG_FUNCTION (this << network << prefixLength << preferredLifeTime << validLifeTime << onLinkFlag << autonomousFlag << routerAddrFlag);
}
RadvdPrefix::~RadvdPrefix ()
{
NS_LOG_FUNCTION (this);
}
Ipv6Address RadvdPrefix::GetNetwork () const
{
NS_LOG_FUNCTION (this);
return m_network;
}
void RadvdPrefix::SetNetwork (Ipv6Address network)
{
NS_LOG_FUNCTION (this << network);
m_network = network;
}
uint8_t RadvdPrefix::GetPrefixLength () const
{
NS_LOG_FUNCTION (this);
return m_prefixLength;
}
void RadvdPrefix::SetPrefixLength (uint8_t prefixLength)
{
NS_LOG_FUNCTION (this << prefixLength);
m_prefixLength = prefixLength;
}
uint32_t RadvdPrefix::GetValidLifeTime () const
{
NS_LOG_FUNCTION (this);
return m_validLifeTime;
}
void RadvdPrefix::SetValidLifeTime (uint32_t validLifeTime)
{
NS_LOG_FUNCTION (this << validLifeTime);
m_validLifeTime = validLifeTime;
}
uint32_t RadvdPrefix::GetPreferredLifeTime () const
{
NS_LOG_FUNCTION (this);
return m_preferredLifeTime;
}
void RadvdPrefix::SetPreferredLifeTime (uint32_t preferredLifeTime)
{
NS_LOG_FUNCTION (this << preferredLifeTime);
m_preferredLifeTime = preferredLifeTime;
}
bool RadvdPrefix::IsOnLinkFlag () const
{
NS_LOG_FUNCTION (this);
return m_onLinkFlag;
}
void RadvdPrefix::SetOnLinkFlag (bool onLinkFlag)
{
NS_LOG_FUNCTION (this << onLinkFlag);
m_onLinkFlag = onLinkFlag;
}
bool RadvdPrefix::IsAutonomousFlag () const
{
NS_LOG_FUNCTION (this);
return m_autonomousFlag;
}
void RadvdPrefix::SetAutonomousFlag (bool autonomousFlag)
{
NS_LOG_FUNCTION (this << autonomousFlag);
m_autonomousFlag = autonomousFlag;
}
bool RadvdPrefix::IsRouterAddrFlag () const
{
NS_LOG_FUNCTION (this);
return m_routerAddrFlag;
}
void RadvdPrefix::SetRouterAddrFlag (bool routerAddrFlag)
{
NS_LOG_FUNCTION (this << routerAddrFlag);
m_routerAddrFlag = routerAddrFlag;
}

View File

@@ -60,12 +60,12 @@ TypeId Radvd::GetTypeId ()
Radvd::Radvd ()
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
}
Radvd::~Radvd ()
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
for (RadvdInterfaceListI it = m_configurations.begin (); it != m_configurations.end (); ++it)
{
*it = 0;
@@ -76,13 +76,13 @@ Radvd::~Radvd ()
void Radvd::DoDispose ()
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
Application::DoDispose ();
}
void Radvd::StartApplication ()
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
if (!m_socket)
{
@@ -106,7 +106,7 @@ void Radvd::StartApplication ()
void Radvd::StopApplication ()
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
if (m_socket)
{
@@ -122,6 +122,7 @@ void Radvd::StopApplication ()
void Radvd::AddConfiguration (Ptr<RadvdInterface> routerInterface)
{
NS_LOG_FUNCTION (this << routerInterface);
m_configurations.push_back (routerInterface);
}
@@ -135,13 +136,13 @@ Radvd:: AssignStreams (int64_t stream)
void Radvd::ScheduleTransmit (Time dt, Ptr<RadvdInterface> config, EventId& eventId, Ipv6Address dst, bool reschedule)
{
NS_LOG_FUNCTION (this << dt);
NS_LOG_FUNCTION (this << dt << config << &eventId << dst << reschedule);
eventId = Simulator::Schedule (dt, &Radvd::Send, this, config, dst, reschedule);
}
void Radvd::Send (Ptr<RadvdInterface> config, Ipv6Address dst, bool reschedule)
{
NS_LOG_FUNCTION (this << dst);
NS_LOG_FUNCTION (this << dst << reschedule);
NS_ASSERT (m_eventIds[config->GetInterface ()].IsExpired ());
Icmpv6RA raHdr;
Icmpv6OptionLinkLayerAddress llaHdr;

View File

@@ -34,22 +34,26 @@ SeqTsHeader::SeqTsHeader ()
: m_seq (0),
m_ts (Simulator::Now ().GetTimeStep ())
{
NS_LOG_FUNCTION (this);
}
void
SeqTsHeader::SetSeq (uint32_t seq)
{
NS_LOG_FUNCTION (this << seq);
m_seq = seq;
}
uint32_t
SeqTsHeader::GetSeq (void) const
{
NS_LOG_FUNCTION (this);
return m_seq;
}
Time
SeqTsHeader::GetTs (void) const
{
NS_LOG_FUNCTION (this);
return TimeStep (m_ts);
}
@@ -70,17 +74,20 @@ SeqTsHeader::GetInstanceTypeId (void) const
void
SeqTsHeader::Print (std::ostream &os) const
{
NS_LOG_FUNCTION (this << &os);
os << "(seq=" << m_seq << " time=" << TimeStep (m_ts).GetSeconds () << ")";
}
uint32_t
SeqTsHeader::GetSerializedSize (void) const
{
NS_LOG_FUNCTION (this);
return 4+8;
}
void
SeqTsHeader::Serialize (Buffer::Iterator start) const
{
NS_LOG_FUNCTION (this << &start);
Buffer::Iterator i = start;
i.WriteHtonU32 (m_seq);
i.WriteHtonU64 (m_ts);
@@ -88,6 +95,7 @@ SeqTsHeader::Serialize (Buffer::Iterator start) const
uint32_t
SeqTsHeader::Deserialize (Buffer::Iterator start)
{
NS_LOG_FUNCTION (this << &start);
Buffer::Iterator i = start;
m_seq = i.ReadNtohU32 ();
m_ts = i.ReadNtohU64 ();

View File

@@ -74,7 +74,7 @@ UdpClient::GetTypeId (void)
UdpClient::UdpClient ()
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
m_sent = 0;
m_socket = 0;
m_sendEvent = EventId ();
@@ -82,12 +82,13 @@ UdpClient::UdpClient ()
UdpClient::~UdpClient ()
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
}
void
UdpClient::SetRemote (Ipv4Address ip, uint16_t port)
{
NS_LOG_FUNCTION (this << ip << port);
m_peerAddress = Address(ip);
m_peerPort = port;
}
@@ -95,6 +96,7 @@ UdpClient::SetRemote (Ipv4Address ip, uint16_t port)
void
UdpClient::SetRemote (Ipv6Address ip, uint16_t port)
{
NS_LOG_FUNCTION (this << ip << port);
m_peerAddress = Address(ip);
m_peerPort = port;
}
@@ -102,6 +104,7 @@ UdpClient::SetRemote (Ipv6Address ip, uint16_t port)
void
UdpClient::SetRemote (Address ip, uint16_t port)
{
NS_LOG_FUNCTION (this << ip << port);
m_peerAddress = ip;
m_peerPort = port;
}
@@ -109,14 +112,14 @@ UdpClient::SetRemote (Address ip, uint16_t port)
void
UdpClient::DoDispose (void)
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
Application::DoDispose ();
}
void
UdpClient::StartApplication (void)
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
if (m_socket == 0)
{
@@ -139,16 +142,16 @@ UdpClient::StartApplication (void)
}
void
UdpClient::StopApplication ()
UdpClient::StopApplication (void)
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
Simulator::Cancel (m_sendEvent);
}
void
UdpClient::Send (void)
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
NS_ASSERT (m_sendEvent.IsExpired ());
SeqTsHeader seqTs;
seqTs.SetSeq (m_sent);

View File

@@ -73,7 +73,7 @@ UdpEchoClient::GetTypeId (void)
UdpEchoClient::UdpEchoClient ()
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
m_sent = 0;
m_socket = 0;
m_sendEvent = EventId ();
@@ -83,7 +83,7 @@ UdpEchoClient::UdpEchoClient ()
UdpEchoClient::~UdpEchoClient()
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
m_socket = 0;
delete [] m_data;
@@ -94,6 +94,7 @@ UdpEchoClient::~UdpEchoClient()
void
UdpEchoClient::SetRemote (Address ip, uint16_t port)
{
NS_LOG_FUNCTION (this << ip << port);
m_peerAddress = ip;
m_peerPort = port;
}
@@ -101,6 +102,7 @@ UdpEchoClient::SetRemote (Address ip, uint16_t port)
void
UdpEchoClient::SetRemote (Ipv4Address ip, uint16_t port)
{
NS_LOG_FUNCTION (this << ip << port);
m_peerAddress = Address (ip);
m_peerPort = port;
}
@@ -108,6 +110,7 @@ UdpEchoClient::SetRemote (Ipv4Address ip, uint16_t port)
void
UdpEchoClient::SetRemote (Ipv6Address ip, uint16_t port)
{
NS_LOG_FUNCTION (this << ip << port);
m_peerAddress = Address (ip);
m_peerPort = port;
}
@@ -115,14 +118,14 @@ UdpEchoClient::SetRemote (Ipv6Address ip, uint16_t port)
void
UdpEchoClient::DoDispose (void)
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
Application::DoDispose ();
}
void
UdpEchoClient::StartApplication (void)
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
if (m_socket == 0)
{
@@ -148,7 +151,7 @@ UdpEchoClient::StartApplication (void)
void
UdpEchoClient::StopApplication ()
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
if (m_socket != 0)
{
@@ -163,7 +166,7 @@ UdpEchoClient::StopApplication ()
void
UdpEchoClient::SetDataSize (uint32_t dataSize)
{
NS_LOG_FUNCTION (dataSize);
NS_LOG_FUNCTION (this << dataSize);
//
// If the client is setting the echo packet data size this way, we infer
@@ -179,14 +182,14 @@ UdpEchoClient::SetDataSize (uint32_t dataSize)
uint32_t
UdpEchoClient::GetDataSize (void) const
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
return m_size;
}
void
UdpEchoClient::SetFill (std::string fill)
{
NS_LOG_FUNCTION (fill);
NS_LOG_FUNCTION (this << fill);
uint32_t dataSize = fill.size () + 1;
@@ -208,6 +211,7 @@ UdpEchoClient::SetFill (std::string fill)
void
UdpEchoClient::SetFill (uint8_t fill, uint32_t dataSize)
{
NS_LOG_FUNCTION (this << fill << dataSize);
if (dataSize != m_dataSize)
{
delete [] m_data;
@@ -226,6 +230,7 @@ UdpEchoClient::SetFill (uint8_t fill, uint32_t dataSize)
void
UdpEchoClient::SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize)
{
NS_LOG_FUNCTION (this << fill << fillSize << dataSize);
if (dataSize != m_dataSize)
{
delete [] m_data;
@@ -264,14 +269,14 @@ UdpEchoClient::SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize)
void
UdpEchoClient::ScheduleTransmit (Time dt)
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this << dt);
m_sendEvent = Simulator::Schedule (dt, &UdpEchoClient::Send, this);
}
void
UdpEchoClient::Send (void)
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
NS_ASSERT (m_sendEvent.IsExpired ());

View File

@@ -53,12 +53,12 @@ UdpEchoServer::GetTypeId (void)
UdpEchoServer::UdpEchoServer ()
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
}
UdpEchoServer::~UdpEchoServer()
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
m_socket = 0;
m_socket6 = 0;
}
@@ -66,14 +66,14 @@ UdpEchoServer::~UdpEchoServer()
void
UdpEchoServer::DoDispose (void)
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
Application::DoDispose ();
}
void
UdpEchoServer::StartApplication (void)
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
if (m_socket == 0)
{
@@ -124,7 +124,7 @@ UdpEchoServer::StartApplication (void)
void
UdpEchoServer::StopApplication ()
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
if (m_socket != 0)
{
@@ -141,6 +141,8 @@ UdpEchoServer::StopApplication ()
void
UdpEchoServer::HandleRead (Ptr<Socket> socket)
{
NS_LOG_FUNCTION (this << socket);
Ptr<Packet> packet;
Address from;
while ((packet = socket->RecvFrom (from)))

View File

@@ -76,27 +76,29 @@ UdpServer::~UdpServer ()
uint16_t
UdpServer::GetPacketWindowSize () const
{
NS_LOG_FUNCTION (this);
return m_lossCounter.GetBitMapSize ();
}
void
UdpServer::SetPacketWindowSize (uint16_t size)
{
NS_LOG_FUNCTION (this << size);
m_lossCounter.SetBitMapSize (size);
}
uint32_t
UdpServer::GetLost (void) const
{
NS_LOG_FUNCTION (this);
return m_lossCounter.GetLost ();
}
uint32_t
UdpServer::GetReceived (void) const
{
NS_LOG_FUNCTION (this);
return m_received;
}
void

View File

@@ -119,6 +119,7 @@ UdpTraceClient::~UdpTraceClient ()
void
UdpTraceClient::SetRemote (Address ip, uint16_t port)
{
NS_LOG_FUNCTION (this << ip << port);
m_entries.clear ();
m_peerAddress = ip;
m_peerPort = port;
@@ -127,6 +128,7 @@ UdpTraceClient::SetRemote (Address ip, uint16_t port)
void
UdpTraceClient::SetRemote (Ipv4Address ip, uint16_t port)
{
NS_LOG_FUNCTION (this << ip << port);
m_entries.clear ();
m_peerAddress = Address (ip);
m_peerPort = port;
@@ -135,6 +137,7 @@ UdpTraceClient::SetRemote (Ipv4Address ip, uint16_t port)
void
UdpTraceClient::SetRemote (Ipv6Address ip, uint16_t port)
{
NS_LOG_FUNCTION (this << ip << port);
m_entries.clear ();
m_peerAddress = Address (ip);
m_peerPort = port;
@@ -143,6 +146,7 @@ UdpTraceClient::SetRemote (Ipv6Address ip, uint16_t port)
void
UdpTraceClient::SetTraceFile (std::string traceFile)
{
NS_LOG_FUNCTION (this << traceFile);
if (traceFile == "")
{
LoadDefaultTrace ();
@@ -156,12 +160,14 @@ UdpTraceClient::SetTraceFile (std::string traceFile)
void
UdpTraceClient::SetMaxPacketSize (uint16_t maxPacketSize)
{
NS_LOG_FUNCTION (this << maxPacketSize);
m_maxPacketSize = maxPacketSize;
}
uint16_t UdpTraceClient::GetMaxPacketSize (void)
{
NS_LOG_FUNCTION (this);
return m_maxPacketSize;
}
@@ -169,7 +175,7 @@ uint16_t UdpTraceClient::GetMaxPacketSize (void)
void
UdpTraceClient::DoDispose (void)
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
Application::DoDispose ();
}

View File

@@ -69,9 +69,11 @@ V4Ping::V4Ping ()
m_verbose (false),
m_recv (0)
{
NS_LOG_FUNCTION (this);
}
V4Ping::~V4Ping ()
{
NS_LOG_FUNCTION (this);
}
void
@@ -85,6 +87,7 @@ V4Ping::DoDispose (void)
uint32_t
V4Ping::GetApplicationId (void) const
{
NS_LOG_FUNCTION (this);
Ptr<Node> node = GetNode ();
for (uint32_t i = 0; i < node->GetNApplications (); ++i)
{
@@ -165,6 +168,7 @@ V4Ping::Receive (Ptr<Socket> socket)
void
V4Ping::Write32 (uint8_t *buffer, const uint32_t data)
{
NS_LOG_FUNCTION (this << buffer << data);
buffer[0] = (data >> 0) & 0xff;
buffer[1] = (data >> 8) & 0xff;
buffer[2] = (data >> 16) & 0xff;
@@ -175,13 +179,16 @@ V4Ping::Write32 (uint8_t *buffer, const uint32_t data)
void
V4Ping::Read32 (const uint8_t *buffer, uint32_t &data)
{
NS_LOG_FUNCTION (this << buffer << data);
data = (buffer[3] << 24) + (buffer[2] << 16) + (buffer[1] << 8) + buffer[0];
}
void
V4Ping::Send ()
{
NS_LOG_FUNCTION (m_seq);
NS_LOG_FUNCTION (this);
NS_LOG_INFO ("m_seq=" << m_seq);
Ptr<Packet> p = Create<Packet> ();
Icmpv4Echo echo;
echo.SetSequenceNumber (m_seq);