fix bug 29
--HG-- rename : src/node/drop-tail.cc => src/node/drop-tail-queue.cc rename : src/node/drop-tail.h => src/node/drop-tail-queue.h
This commit is contained in:
1 parent
e6e6bdced7
commit
8cd61f2e40
4 files changed
+4
-8
No files matched your search
@@ -0,0 +1,111 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2007 University of Washington
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "ns3/debug.h"
|
||||
#include "drop-tail-queue.h"
|
||||
|
||||
NS_DEBUG_COMPONENT_DEFINE ("DropTailQueue");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
const ClassId DropTailQueue::cid =
|
||||
MakeClassId<DropTailQueue> ("DropTailQueue", Queue::iid);
|
||||
|
||||
|
||||
DropTailQueue::DropTailQueue () :
|
||||
Queue (),
|
||||
m_packets (),
|
||||
m_maxPackets(DTQ_NPACKETS_MAX_DEFAULT)
|
||||
{
|
||||
NS_DEBUG("DropTailQueue::DropTailQueue ()");
|
||||
}
|
||||
|
||||
DropTailQueue::~DropTailQueue ()
|
||||
{
|
||||
NS_DEBUG("DropTailQueue::~DropTailQueue ()");
|
||||
}
|
||||
|
||||
void
|
||||
DropTailQueue::SetMaxPackets (uint32_t npackets)
|
||||
{
|
||||
NS_DEBUG("DropTailQueue::SetMaxPackets (" << npackets << ")");
|
||||
|
||||
m_maxPackets = npackets;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
DropTailQueue::GetMaxPackets (void)
|
||||
{
|
||||
NS_DEBUG("DropTailQueue::GetMaxPackets () <= " << m_maxPackets);
|
||||
|
||||
return m_maxPackets;
|
||||
}
|
||||
|
||||
bool
|
||||
DropTailQueue::DoEnqueue (const Packet& p)
|
||||
{
|
||||
NS_DEBUG("DropTailQueue::DoEnqueue (" << &p << ")");
|
||||
|
||||
if (m_packets.size () >= m_maxPackets)
|
||||
{
|
||||
NS_DEBUG("DropTailQueue::DoEnqueue (): Queue full -- droppping pkt");
|
||||
Drop (p);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_packets.push(p);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DropTailQueue::DoDequeue (Packet& p)
|
||||
{
|
||||
NS_DEBUG("DropTailQueue::DoDequeue (" << &p << ")");
|
||||
|
||||
if (m_packets.empty())
|
||||
{
|
||||
NS_DEBUG("DropTailQueue::DoDequeue (): Queue empty");
|
||||
return false;
|
||||
}
|
||||
|
||||
p = m_packets.front ();
|
||||
m_packets.pop ();
|
||||
|
||||
NS_DEBUG("DropTailQueue::DoDequeue (): Popped " << &p << " <= true");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DropTailQueue::DoPeek (Packet& p)
|
||||
{
|
||||
NS_DEBUG("DropTailQueue::DoPeek (" << &p << ")");
|
||||
|
||||
if (m_packets.empty())
|
||||
{
|
||||
NS_DEBUG("DropTailQueue::DoPeek (): Queue empty");
|
||||
return false;
|
||||
}
|
||||
|
||||
p = m_packets.front ();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}; // namespace ns3
|
||||
Reference in new issue
Block a user