merge with HEAD

This commit is contained in:
Mathieu Lacage
2007-11-15 10:18:17 +01:00
84 changed files with 1681 additions and 658 deletions

View File

@@ -37,7 +37,7 @@ Channel::Channel (std::string name)
: m_name(name)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << name << ")");
NS_LOG_PARAMS (this << name);
SetInterfaceId (Channel::iid);
}
@@ -50,7 +50,7 @@ Channel::~Channel ()
Channel::SetName(std::string name)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << name << ")");
NS_LOG_PARAMS (this << name);
m_name = name;
}

View File

@@ -45,7 +45,7 @@ void
DropTailQueue::SetMaxPackets (uint32_t npackets)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << npackets << ")");
NS_LOG_PARAMS (this << npackets);
m_maxPackets = npackets;
}
@@ -61,7 +61,7 @@ bool
DropTailQueue::DoEnqueue (const Packet& p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
if (m_packets.size () >= m_maxPackets)
{
@@ -78,7 +78,7 @@ bool
DropTailQueue::DoDequeue (Packet& p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
if (m_packets.empty())
{
@@ -98,7 +98,7 @@ bool
DropTailQueue::DoPeek (Packet& p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
if (m_packets.empty())
{

View File

@@ -36,13 +36,11 @@ Ipv4::~Ipv4 ()
{}
uint32_t
Ipv4::GetIfIndexByAddress (Ptr<Node> node, Ipv4Address a, Ipv4Mask amask)
Ipv4::GetIfIndexByAddress (Ipv4Address addr, Ipv4Mask mask)
{
Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> (Ipv4::iid);
NS_ASSERT_MSG (ipv4, "Ipv4::GetIfIndexByAddress: No Ipv4 interface");
for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++)
for (uint32_t i = 0; i < GetNInterfaces (); i++)
{
if (ipv4->GetAddress (i).CombineMask(amask) == a.CombineMask(amask) )
if (GetAddress (i).CombineMask(mask) == addr.CombineMask(mask) )
{
return i;
}
@@ -52,44 +50,4 @@ Ipv4::GetIfIndexByAddress (Ptr<Node> node, Ipv4Address a, Ipv4Mask amask)
return 0;
}
//
// XXX BUGBUG I don't think this is really the right approach here. The call
// to GetRoute () filters down into Ipv4L3Protocol where it translates into
// a call into the Ipv4 static routing package. This bypasses any other
// routing packages. At a minimum, the name is misleading.
//
bool
Ipv4::GetRouteToDestination (
Ptr<Node> node,
Ipv4Route& route,
Ipv4Address a,
Ipv4Mask amask)
{
Ipv4Route tempRoute;
Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> (Ipv4::iid);
NS_ASSERT_MSG (ipv4, "Ipv4::GetRouteToDestination: No Ipv4 interface");
for (uint32_t i = 0; i < ipv4->GetNRoutes (); i++)
{
tempRoute = ipv4->GetRoute (i);
// Host route found
if ( tempRoute.IsNetwork () == false && tempRoute.GetDest () == a )
{
route = tempRoute;
return true;
}
else if ( tempRoute.IsNetwork () &&
tempRoute.GetDestNetwork () == a.CombineMask(amask) )
{
route = tempRoute;
return true;
}
else if ( tempRoute.IsDefault () )
{
route = tempRoute;
return true;
}
}
return false;
}
} // namespace ns3

View File

@@ -449,16 +449,16 @@ public:
*/
virtual void SetDown (uint32_t i) = 0;
/**
* Convenience functions (Doxygen still needed)
*
* Return the ifIndex corresponding to the Ipv4Address provided.
*/
static uint32_t GetIfIndexByAddress (Ptr<Node> node, Ipv4Address a,
Ipv4Mask amask = Ipv4Mask("255.255.255.255"));
static bool GetRouteToDestination (Ptr<Node> node, Ipv4Route& route,
Ipv4Address a, Ipv4Mask amask = Ipv4Mask("255.255.255.255"));
/**
* \brief Convenience function to return the ifIndex corresponding
* to the Ipv4Address provided
*
* \param addr Ipv4Address
* \param mask corresponding Ipv4Mask
* \returns ifIndex corresponding to a/amask
*/
virtual uint32_t GetIfIndexByAddress (Ipv4Address addr,
Ipv4Mask mask = Ipv4Mask("255.255.255.255"));
};
} // namespace ns3

View File

@@ -139,7 +139,7 @@ bool
Queue::Enqueue (const Packet& p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
NS_LOG_LOGIC ("m_traceEnqueue (p)");
m_traceEnqueue (p);
@@ -157,7 +157,7 @@ bool
Queue::Dequeue (Packet &p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
bool retval = DoDequeue (p);
@@ -189,7 +189,7 @@ bool
Queue::Peek (Packet &p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
return DoPeek (p);
}
@@ -264,7 +264,7 @@ void
Queue::Drop (const Packet& p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
m_nTotalDroppedPackets++;
m_nTotalDroppedBytes += p.GetSize ();