front_drop_queue.cpp
Go to the documentation of this file.
#include <itpp/protocol/front_drop_queue.h>
namespace itpp
{
void Front_Drop_Queue::push(Packet *packet)
{
if (debug) {
std::cout << "Front_Drop_Queue::push_packet"
// << " byte_size=" << packet->bit_size()/8
<< " ptr=" << packet
<< " time=" << Event_Queue::now() << std::endl;
}
Packet *hol_packet;
while ((!std::queue<Packet*>::empty()) &&
((8*bytes_in_queue + packet->bit_size()) > 8*max_bytes_in_queue)) {
hol_packet = std::queue<Packet*>::front();
Front_Drop_Queue::pop();
delete hol_packet;
// TTCPPacket *tcp_packet = (TTCPPacket *) hol_packet;
// delete tcp_packet;
if (debug) {
std::cout << "Link_With_Input_Q::received_packet, "
<< "Packet Dropped, buffer overflow."
<< std::endl;
}
}
bytes_in_queue += packet->bit_size() / 8;
std::queue<Packet*>::push(packet);
}
void Front_Drop_Queue::pop()
{
Packet *hol_packet;
hol_packet = std::queue<Packet*>::front();
bytes_in_queue -= (hol_packet->bit_size() / 8);
if (debug) {
std::cout << "Front_Drop_Queue::pop_packet"
<< " ptr=" << hol_packet
<< " time=" << Event_Queue::now() << std::endl;
}
std::queue<Packet*>::pop();
}
} // namespace itpp
itpp::Array
General array class.
Definition array.h:105
itpp::Event_Queue::now
static Ttype now()
Return current time.
Definition events.h:139
itpp::Front_Drop_Queue::pop
void pop()
ADD DOCUMENTATION HERE.
Definition front_drop_queue.cpp:66
itpp::Front_Drop_Queue::push
void push(Packet *packet)
ADD DOCUMENTATION HERE.
Definition front_drop_queue.cpp:35
itpp::Packet
Definition packet.h:56
front_drop_queue.h
Definitions of a Front Drop Queue class.
itpp
itpp namespace
Definition itmex.h:37

Generated on Mon Jun 10 2024 11:49:24 for IT++ by Doxygen 1.9.8