convert use of <cassert> to "ns3/assert.h"
This commit is contained in:
1 parent
772bfdc614
commit
b23ee44ad8
37 files changed
+150
-149
No files matched your search
@@ -18,7 +18,7 @@
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
#include <cassert>
|
||||
#include "ns3/assert.h"
|
||||
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/simulator.h"
|
||||
@@ -153,14 +153,14 @@ void
|
||||
ArpCache::Entry::MarkDead (void)
|
||||
{
|
||||
m_state = DEAD;
|
||||
//assert (m_waiting != 0);
|
||||
//NS_ASSERT (m_waiting != 0);
|
||||
UpdateSeen ();
|
||||
}
|
||||
Packet
|
||||
ArpCache::Entry::MarkAlive (MacAddress macAddress)
|
||||
{
|
||||
assert (m_state == WAIT_REPLY);
|
||||
//assert (m_waiting != 0);
|
||||
NS_ASSERT (m_state == WAIT_REPLY);
|
||||
//NS_ASSERT (m_waiting != 0);
|
||||
m_macAddress = macAddress;
|
||||
m_state = ALIVE;
|
||||
UpdateSeen ();
|
||||
@@ -172,7 +172,7 @@ ArpCache::Entry::MarkAlive (MacAddress macAddress)
|
||||
Packet
|
||||
ArpCache::Entry::UpdateWaitReply (Packet waiting)
|
||||
{
|
||||
assert (m_state == WAIT_REPLY);
|
||||
NS_ASSERT (m_state == WAIT_REPLY);
|
||||
/* We are already waiting for an answer so
|
||||
* we dump the previously waiting packet and
|
||||
* replace it with this one.
|
||||
@@ -184,8 +184,8 @@ ArpCache::Entry::UpdateWaitReply (Packet waiting)
|
||||
void
|
||||
ArpCache::Entry::MarkWaitReply (Packet waiting)
|
||||
{
|
||||
assert (m_state == ALIVE || m_state == DEAD);
|
||||
//assert (m_waiting == 0);
|
||||
NS_ASSERT (m_state == ALIVE || m_state == DEAD);
|
||||
//NS_ASSERT (m_waiting == 0);
|
||||
m_state = WAIT_REPLY;
|
||||
m_waiting = waiting;
|
||||
UpdateSeen ();
|
||||
@@ -194,7 +194,7 @@ ArpCache::Entry::MarkWaitReply (Packet waiting)
|
||||
MacAddress
|
||||
ArpCache::Entry::GetMacAddress (void)
|
||||
{
|
||||
assert (m_state == ALIVE);
|
||||
NS_ASSERT (m_state == ALIVE);
|
||||
return m_macAddress;
|
||||
}
|
||||
bool
|
||||
@@ -212,7 +212,7 @@ ArpCache::Entry::IsExpired (void)
|
||||
timeout = m_arp->GetAliveTimeout ();
|
||||
break;
|
||||
default:
|
||||
assert (false);
|
||||
NS_ASSERT (false);
|
||||
timeout = Seconds (0);
|
||||
/* NOTREACHED */
|
||||
break;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include "ns3/assert.h"
|
||||
#include "arp-header.h"
|
||||
#include "header-utils.h"
|
||||
|
||||
@@ -96,7 +96,7 @@ ArpHeader::PrintTo (std::ostream &os) const
|
||||
}
|
||||
else
|
||||
{
|
||||
assert (IsReply ());
|
||||
NS_ASSERT (IsReply ());
|
||||
os << " source mac: " << m_macSource
|
||||
<< " source ipv4: " << m_ipv4Source
|
||||
<< " dest mac: " << m_macDest
|
||||
@@ -114,7 +114,7 @@ void
|
||||
ArpHeader::SerializeTo (Buffer::Iterator start) const
|
||||
{
|
||||
Buffer::Iterator i = start;
|
||||
assert (m_macSource.GetLength () == m_macDest.GetLength ());
|
||||
NS_ASSERT (m_macSource.GetLength () == m_macDest.GetLength ());
|
||||
|
||||
/* ethernet */
|
||||
i.WriteHtonU16 (0x0001);
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ Arp::FindCache (NetDevice *device)
|
||||
}
|
||||
Ipv4Interface *interface = m_node->GetIpv4 ()->FindInterfaceForDevice (device);
|
||||
ArpCache * cache = new ArpCache (device, interface);
|
||||
assert (device->IsBroadcast ());
|
||||
NS_ASSERT (device->IsBroadcast ());
|
||||
device->SetLinkChangeCallback (MakeCallback (&ArpCache::Flush, cache));
|
||||
m_cacheList.push_back (cache);
|
||||
return cache;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include "ns3/assert.h"
|
||||
#include "ns3/header.h"
|
||||
#include "ipv4-header.h"
|
||||
|
||||
@@ -137,13 +137,13 @@ Ipv4Header::IsDontFragment (void) const
|
||||
void
|
||||
Ipv4Header::SetFragmentOffset (uint16_t offset)
|
||||
{
|
||||
assert (!(offset & (~0x3fff)));
|
||||
NS_ASSERT (!(offset & (~0x3fff)));
|
||||
m_fragmentOffset = offset;
|
||||
}
|
||||
uint16_t
|
||||
Ipv4Header::GetFragmentOffset (void) const
|
||||
{
|
||||
assert (!(m_fragmentOffset & (~0x3fff)));
|
||||
NS_ASSERT (!(m_fragmentOffset & (~0x3fff)));
|
||||
return m_fragmentOffset;
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ Ipv4Header::DeserializeFrom (Buffer::Iterator start)
|
||||
uint8_t verIhl = i.ReadU8 ();
|
||||
uint8_t ihl = verIhl & 0x0f;
|
||||
uint16_t headerSize = ihl * 4;
|
||||
assert ((verIhl >> 4) == 4);
|
||||
NS_ASSERT ((verIhl >> 4) == 4);
|
||||
m_tos = i.ReadU8 ();
|
||||
uint16_t size = i.ReadNtohU16 ();
|
||||
m_payloadSize = size - headerSize;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "ipv4-route.h"
|
||||
#include <cassert>
|
||||
#include "ns3/assert.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -180,7 +180,7 @@ std::ostream& operator<< (std::ostream& os, Ipv4Route const& route)
|
||||
{
|
||||
if (route.IsDefault ())
|
||||
{
|
||||
assert (route.IsGateway ());
|
||||
NS_ASSERT (route.IsGateway ());
|
||||
os << "default out=" << route.GetInterface () << ", next hop=" << route.GetGateway ();
|
||||
}
|
||||
else if (route.IsHost ())
|
||||
@@ -215,7 +215,7 @@ std::ostream& operator<< (std::ostream& os, Ipv4Route const& route)
|
||||
}
|
||||
else
|
||||
{
|
||||
assert (false);
|
||||
NS_ASSERT (false);
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
+6
-6
@@ -129,7 +129,7 @@ Ipv4::Lookup (Ipv4Address dest)
|
||||
i != m_hostRoutes.end ();
|
||||
i++)
|
||||
{
|
||||
assert ((*i)->IsHost ());
|
||||
NS_ASSERT ((*i)->IsHost ());
|
||||
if ((*i)->GetDest ().IsEqual (dest))
|
||||
{
|
||||
return (*i);
|
||||
@@ -139,7 +139,7 @@ Ipv4::Lookup (Ipv4Address dest)
|
||||
j != m_networkRoutes.end ();
|
||||
j++)
|
||||
{
|
||||
assert ((*j)->IsNetwork ());
|
||||
NS_ASSERT ((*j)->IsNetwork ());
|
||||
Ipv4Mask mask = (*j)->GetDestNetworkMask ();
|
||||
Ipv4Address entry = (*j)->GetDestNetwork ();
|
||||
if (mask.IsMatch (dest, entry))
|
||||
@@ -149,7 +149,7 @@ Ipv4::Lookup (Ipv4Address dest)
|
||||
}
|
||||
if (m_defaultRoute != 0)
|
||||
{
|
||||
assert (m_defaultRoute->IsDefault ());
|
||||
NS_ASSERT (m_defaultRoute->IsDefault ());
|
||||
return m_defaultRoute;
|
||||
}
|
||||
return 0;
|
||||
@@ -204,7 +204,7 @@ Ipv4::GetRoute (uint32_t index)
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
assert (false);
|
||||
NS_ASSERT (false);
|
||||
// quiet compiler.
|
||||
return 0;
|
||||
}
|
||||
@@ -250,7 +250,7 @@ Ipv4::RemoveRoute (uint32_t index)
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
assert (false);
|
||||
NS_ASSERT (false);
|
||||
}
|
||||
|
||||
|
||||
@@ -365,7 +365,7 @@ Ipv4::SendRealOut (Packet const &p, Ipv4Header const &ip, Ipv4Route const &route
|
||||
Packet packet = p;
|
||||
packet.Add (ip);
|
||||
Ipv4Interface *outInterface = GetInterface (route.GetInterface ());
|
||||
assert (packet.GetSize () <= outInterface->GetMtu ());
|
||||
NS_ASSERT (packet.GetSize () <= outInterface->GetMtu ());
|
||||
// XXX log trace here.
|
||||
if (route.IsGateway ())
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include "ns3/assert.h"
|
||||
|
||||
#include "llc-snap-header.h"
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
#include "ns3/assert.h"
|
||||
#include "mac-address.h"
|
||||
|
||||
#define ASCII_a (0x41)
|
||||
@@ -56,7 +56,7 @@ MacAddress::MacAddress () : m_len(0)
|
||||
|
||||
MacAddress::MacAddress (uint8_t const *address, uint8_t len)
|
||||
{
|
||||
assert(len <= MacAddress::MAX_LEN);
|
||||
NS_ASSERT (len <= MacAddress::MAX_LEN);
|
||||
for (int i=0; i < len; i++)
|
||||
{
|
||||
m_address[i] = address[i];
|
||||
@@ -164,7 +164,7 @@ bool operator < (MacAddress const&a, MacAddress const&b)
|
||||
uint8_t b_p[MacAddress::MAX_LEN];
|
||||
a.Peek (a_p);
|
||||
b.Peek (b_p);
|
||||
assert(a.GetLength() == b.GetLength());
|
||||
NS_ASSERT (a.GetLength() == b.GetLength());
|
||||
for (uint8_t i = 0; i < a.GetLength(); i++)
|
||||
{
|
||||
if (a_p[i] < b_p[i])
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include "ns3/assert.h"
|
||||
|
||||
#include "net-device.h"
|
||||
#include "l3-demux.h"
|
||||
@@ -93,7 +93,7 @@ NetDevice::IsBroadcast (void) const
|
||||
MacAddress const &
|
||||
NetDevice::GetBroadcast (void) const
|
||||
{
|
||||
assert (m_isBroadcast);
|
||||
NS_ASSERT (m_isBroadcast);
|
||||
return m_broadcast;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -69,8 +69,8 @@ Queue::Deque (Packet &p)
|
||||
m_nBytes -= p.GetSize ();
|
||||
m_nPackets--;
|
||||
|
||||
assert(m_nBytes >= 0);
|
||||
assert(m_nPackets >= 0);
|
||||
NS_ASSERT (m_nBytes >= 0);
|
||||
NS_ASSERT (m_nPackets >= 0);
|
||||
|
||||
NS_DEBUG("Queue::Deque (): m_traceDeque (p)")
|
||||
m_traceDeque ("+ <timestamp> ", static_cast<const Packet &>(p));
|
||||
@@ -84,7 +84,7 @@ Queue::DequeAll (void)
|
||||
{
|
||||
NS_DEBUG("Queue::DequeAll ()")
|
||||
|
||||
assert (!"Don't know what to do with dequeued packets!");
|
||||
NS_ASSERT (!"Don't know what to do with dequeued packets!");
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
||||
@@ -30,7 +30,7 @@ UdpSocket::UdpSocket (Node *node)
|
||||
: m_endPoint (0),
|
||||
m_node (node)
|
||||
{
|
||||
assert (GetUdp () != 0);
|
||||
NS_ASSERT (GetUdp () != 0);
|
||||
}
|
||||
UdpSocket::~UdpSocket ()
|
||||
{
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include "ns3/assert.h"
|
||||
#include "ns3/packet.h"
|
||||
#include "udp.h"
|
||||
#include "udp-header.h"
|
||||
@@ -95,7 +95,7 @@ Udp::Receive(Packet& packet,
|
||||
}
|
||||
UdpSocket *socket = endPoint->GetSocket ();
|
||||
socket->ForwardUp (packet, source, udpHeader.GetSource ());
|
||||
assert (socket != 0);
|
||||
NS_ASSERT (socket != 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in new issue
Block a user