--- a/src/internet-stack/arp-cache.cc Wed Jul 16 16:17:21 2008 +0100
+++ b/src/internet-stack/arp-cache.cc Fri Jul 18 11:12:31 2008 +0100
@@ -85,6 +85,7 @@
void
ArpCache::SetDevice (Ptr<NetDevice> device, Ptr<Ipv4Interface> interface)
{
+ NS_LOG_FUNCTION_NOARGS ();
m_device = device;
m_interface = interface;
}
@@ -92,50 +93,59 @@
Ptr<NetDevice>
ArpCache::GetDevice (void) const
{
+ NS_LOG_FUNCTION_NOARGS ();
return m_device;
}
Ptr<Ipv4Interface>
ArpCache::GetInterface (void) const
{
+ NS_LOG_FUNCTION_NOARGS ();
return m_interface;
}
void
ArpCache::SetAliveTimeout (Time aliveTimeout)
{
+ NS_LOG_FUNCTION_NOARGS ();
m_aliveTimeout = aliveTimeout;
}
void
ArpCache::SetDeadTimeout (Time deadTimeout)
{
+ NS_LOG_FUNCTION_NOARGS ();
m_deadTimeout = deadTimeout;
}
void
ArpCache::SetWaitReplyTimeout (Time waitReplyTimeout)
{
+ NS_LOG_FUNCTION_NOARGS ();
m_waitReplyTimeout = waitReplyTimeout;
}
Time
ArpCache::GetAliveTimeout (void) const
{
+ NS_LOG_FUNCTION_NOARGS ();
return m_aliveTimeout;
}
Time
ArpCache::GetDeadTimeout (void) const
{
+ NS_LOG_FUNCTION_NOARGS ();
return m_deadTimeout;
}
Time
ArpCache::GetWaitReplyTimeout (void) const
{
+ NS_LOG_FUNCTION_NOARGS ();
return m_waitReplyTimeout;
}
void
ArpCache::Flush (void)
{
+ NS_LOG_FUNCTION_NOARGS ();
for (CacheI i = m_arpCache.begin (); i != m_arpCache.end (); i++)
{
delete (*i).second;
@@ -146,6 +156,7 @@
ArpCache::Entry *
ArpCache::Lookup (Ipv4Address to)
{
+ NS_LOG_FUNCTION_NOARGS ();
if (m_arpCache.find (to) != m_arpCache.end ())
{
ArpCache::Entry *entry = m_arpCache[to];
@@ -157,6 +168,7 @@
ArpCache::Entry *
ArpCache::Add (Ipv4Address to)
{
+ NS_LOG_FUNCTION_NOARGS ();
NS_ASSERT (m_arpCache.find (to) == m_arpCache.end ());
ArpCache::Entry *entry = new ArpCache::Entry (this);
@@ -167,22 +179,27 @@
ArpCache::Entry::Entry (ArpCache *arp)
: m_arp (arp),
m_state (ALIVE)
-{}
+{
+ NS_LOG_FUNCTION_NOARGS ();
+}
bool
ArpCache::Entry::IsDead (void)
{
+ NS_LOG_FUNCTION_NOARGS ();
return (m_state == DEAD)?true:false;
}
bool
ArpCache::Entry::IsAlive (void)
{
+ NS_LOG_FUNCTION_NOARGS ();
return (m_state == ALIVE)?true:false;
}
bool
ArpCache::Entry::IsWaitReply (void)
{
+ NS_LOG_FUNCTION_NOARGS ();
return (m_state == WAIT_REPLY)?true:false;
}
@@ -190,12 +207,14 @@
void
ArpCache::Entry::MarkDead (void)
{
+ NS_LOG_FUNCTION_NOARGS ();
m_state = DEAD;
UpdateSeen ();
}
void
ArpCache::Entry::MarkAlive (Address macAddress)
{
+ NS_LOG_FUNCTION_NOARGS ();
NS_ASSERT (m_state == WAIT_REPLY);
m_macAddress = macAddress;
m_state = ALIVE;
@@ -205,6 +224,7 @@
bool
ArpCache::Entry::UpdateWaitReply (Ptr<Packet> waiting)
{
+ NS_LOG_FUNCTION_NOARGS ();
NS_ASSERT (m_state == WAIT_REPLY);
/* We are already waiting for an answer so
* we dump the previously waiting packet and
@@ -220,6 +240,7 @@
void
ArpCache::Entry::MarkWaitReply (Ptr<Packet> waiting)
{
+ NS_LOG_FUNCTION_NOARGS ();
NS_ASSERT (m_state == ALIVE || m_state == DEAD);
NS_ASSERT (m_pending.empty ());
m_state = WAIT_REPLY;
@@ -230,12 +251,14 @@
Address
ArpCache::Entry::GetMacAddress (void)
{
+ NS_LOG_FUNCTION_NOARGS ();
NS_ASSERT (m_state == ALIVE);
return m_macAddress;
}
bool
ArpCache::Entry::IsExpired (void)
{
+ NS_LOG_FUNCTION_NOARGS ();
Time timeout;
switch (m_state) {
case ArpCache::Entry::WAIT_REPLY:
@@ -266,6 +289,7 @@
Ptr<Packet>
ArpCache::Entry::DequeuePending (void)
{
+ NS_LOG_FUNCTION_NOARGS ();
if (m_pending.empty ())
{
return 0;
@@ -280,6 +304,7 @@
void
ArpCache::Entry::UpdateSeen (void)
{
+ NS_LOG_FUNCTION_NOARGS ();
m_lastSeen = Simulator::Now ();
}
--- a/src/internet-stack/arp-l3-protocol.cc Wed Jul 16 16:17:21 2008 +0100
+++ b/src/internet-stack/arp-l3-protocol.cc Fri Jul 18 11:12:31 2008 +0100
@@ -68,6 +68,7 @@
void
ArpL3Protocol::SetNode (Ptr<Node> node)
{
+ NS_LOG_FUNCTION (this);
m_node = node;
}
@@ -88,6 +89,7 @@
Ptr<ArpCache>
ArpL3Protocol::CreateCache (Ptr<NetDevice> device, Ptr<Ipv4Interface> interface)
{
+ NS_LOG_FUNCTION_NOARGS ();
Ptr<Ipv4L3Protocol> ipv4 = m_node->GetObject<Ipv4L3Protocol> ();
Ptr<ArpCache> cache = CreateObject<ArpCache> ();
cache->SetDevice (device, interface);
--- a/utils/python-unit-tests.py Wed Jul 16 16:17:21 2008 +0100
+++ b/utils/python-unit-tests.py Fri Jul 18 11:12:31 2008 +0100
@@ -78,7 +78,35 @@
ns3.Simulator.Run()
self.assert_(self._received_packet is not None)
self.assertEqual(self._received_packet.GetSize(), 19)
+
+
+ def testAttributes(self):
+ ##
+ ## Yes, I know, the GetAttribute interface for Python is
+ ## horrible, we should fix this soon, I hope.
+ ##
+ queue = ns3.DropTailQueue()
+
+ queue.SetAttribute("MaxPackets", ns3.UintegerValue(123456))
+
+ limit = ns3.UintegerValue()
+ queue.GetAttribute("MaxPackets", limit)
+ self.assertEqual(limit.Get(), 123456)
+
+ ## -- object pointer values
+ mobility = ns3.RandomWaypointMobilityModel()
+ ptr = ns3.PointerValue()
+ mobility.GetAttribute("Position", ptr)
+ self.assertEqual(ptr.GetObject(), None)
+ pos = ns3.ListPositionAllocator()
+ mobility.SetAttribute("Position", ns3.PointerValue(pos))
+
+ ptr = ns3.PointerValue()
+ mobility.GetAttribute("Position", ptr)
+ self.assert_(ptr.GetObject() is not None)
+
+
if __name__ == '__main__':
unittest.main()
--- a/wscript Wed Jul 16 16:17:21 2008 +0100
+++ b/wscript Fri Jul 18 11:12:31 2008 +0100
@@ -456,8 +456,11 @@
print "-- Running NS-3 C++ core unit tests..."
run_program('run-tests', get_command_template())
- print "-- Running NS-3 Python bindings unit tests..."
- _run_argv([env['PYTHON'], os.path.join("utils", "python-unit-tests.py")], proc_env)
+ if env['ENABLE_PYTHON_BINDINGS']:
+ print "-- Running NS-3 Python bindings unit tests..."
+ _run_argv([env['PYTHON'], os.path.join("utils", "python-unit-tests.py")], proc_env)
+ else:
+ print "-- Skipping NS-3 Python bindings unit tests: Python bindings not enabled."
def _find_program(program_name, env):