logic checked

This commit is contained in:
Borovkova Elena
2009-08-18 16:40:55 +04:00
parent 8f9572aaf9
commit 0ace44eaeb
3 changed files with 7 additions and 4 deletions

View File

@@ -702,7 +702,7 @@ bool
RerrHeader::AddUnDestination (Ipv4Address dst, uint32_t seqNo )
{
if (m_unreachableDstSeqNo.find (dst) != m_unreachableDstSeqNo.end ())
return false;
return true;
NS_ASSERT (GetDestCount() < 255); // can't support more than 255 destinations in single RERR
m_unreachableDstSeqNo.insert (std::make_pair (dst, seqNo));
@@ -776,7 +776,7 @@ bool RerrHeaderTest::RunTests ()
Ipv4Address dst = Ipv4Address("1.2.3.4");
NS_TEST_ASSERT(h.AddUnDestination(dst, 12));
NS_TEST_ASSERT_EQUAL(h.GetDestCount(),1);
NS_TEST_ASSERT(!h.AddUnDestination(dst, 13));
NS_TEST_ASSERT(h.AddUnDestination(dst, 13));
Ipv4Address dst2 = Ipv4Address("4.3.2.1");
NS_TEST_ASSERT(h.AddUnDestination(dst2, 12));
NS_TEST_ASSERT_EQUAL(h.GetDestCount(), 2);

View File

@@ -292,7 +292,10 @@ public:
bool GetNoDelete() const;
//\}
/// Add unreachable node address and its sequence number in RERR header
/**
* Add unreachable node address and its sequence number in RERR header
*\return false if we already added maximum possible number of unreachable destinations
*/
bool AddUnDestination(Ipv4Address dst, uint32_t seqNo);
/** Delete pair (address + sequence number) from REER header, if the number of unreachable destinations > 0
* \return true on success

View File

@@ -313,7 +313,7 @@ RoutingTable::GetListOfDestinationWithNextHop (Ipv4Address nextHop, std::map<Ipv
Purge ();
unreachable.clear ();
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = m_ipv4AddressEntry.begin (); i != m_ipv4AddressEntry.end (); ++i)
if ((i->second.GetNextHop () == nextHop) && (i->second.GetFlag () == VALID) && (!i->second.IsPrecursorListEmpty ()))
if ((i->second.GetNextHop () == nextHop) && (i->second.GetFlag () == VALID))
{
unreachable.insert (std::make_pair (i->first, i->second.GetSeqNo ()));
}