IT++ Logo
front_drop_queue.cpp
Go to the documentation of this file.
1 
30 
31 
32 namespace itpp
33 {
34 
36 {
37  if (debug) {
38  std::cout << "Front_Drop_Queue::push_packet"
39  // << " byte_size=" << packet->bit_size()/8
40  << " ptr=" << packet
41  << " time=" << Event_Queue::now() << std::endl;
42  }
43 
44  Packet *hol_packet;
45  while ((!std::queue<Packet*>::empty()) &&
46  ((8*bytes_in_queue + packet->bit_size()) > 8*max_bytes_in_queue)) {
47  hol_packet = std::queue<Packet*>::front();
49  delete hol_packet;
50 
51  // TTCPPacket *tcp_packet = (TTCPPacket *) hol_packet;
52  // delete tcp_packet;
53 
54  if (debug) {
55  std::cout << "Link_With_Input_Q::received_packet, "
56  << "Packet Dropped, buffer overflow."
57  << std::endl;
58  }
59  }
60 
61  bytes_in_queue += packet->bit_size() / 8;
62  std::queue<Packet*>::push(packet);
63 
64 }
65 
67 {
68  Packet *hol_packet;
69  hol_packet = std::queue<Packet*>::front();
70  bytes_in_queue -= (hol_packet->bit_size() / 8);
71  if (debug) {
72  std::cout << "Front_Drop_Queue::pop_packet"
73  << " ptr=" << hol_packet
74  << " time=" << Event_Queue::now() << std::endl;
75  }
76  std::queue<Packet*>::pop();
77 
78 }
79 
80 } // namespace itpp
SourceForge Logo

Generated on Sat Jul 6 2013 10:54:24 for IT++ by Doxygen 1.8.2