src/node/drop-tail-queue.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 11 Aug 2008 10:40:31 -0700
changeset 3525 4b8ef7da0ac3
parent 3183 fc3b2e03e61e
child 4198 7e0ff1be867a
permissions -rw-r--r--
bug 275: Queue::Peek should return Ptr<const Packet>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
264
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
     2
/*
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
     3
 * Copyright (c) 2007 University of Washington
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
     4
 *
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
     7
 * published by the Free Software Foundation;
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
     8
 *
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    12
 * GNU General Public License for more details.
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    13
 *
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    17
 */
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    18
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    19
#ifndef DROPTAIL_H
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    20
#define DROPTAIL_H
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    21
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    22
#include <queue>
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    23
#include "ns3/packet.h"
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    24
#include "ns3/queue.h"
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    25
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    26
namespace ns3 {
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    27
317
b5959aa4a02f fix queue tracing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 308
diff changeset
    28
class TraceContainer;
b5959aa4a02f fix queue tracing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 308
diff changeset
    29
625
12fa3d0c4f94 droptail and ipv4address dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 584
diff changeset
    30
/**
3183
fc3b2e03e61e more doxygen
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    31
 * \ingroup queue
fc3b2e03e61e more doxygen
Tom Henderson <tomh@tomh.org>
parents: 2834
diff changeset
    32
 *
625
12fa3d0c4f94 droptail and ipv4address dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 584
diff changeset
    33
 * \brief A FIFO packet queue that drops tail-end packets on overflow
12fa3d0c4f94 droptail and ipv4address dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 584
diff changeset
    34
 */
264
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    35
class DropTailQueue : public Queue {
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    36
public:
2251
04963d8cca51 iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2250
diff changeset
    37
  static TypeId GetTypeId (void);
625
12fa3d0c4f94 droptail and ipv4address dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 584
diff changeset
    38
  /**
12fa3d0c4f94 droptail and ipv4address dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 584
diff changeset
    39
   * \brief DropTailQueue Constructor
12fa3d0c4f94 droptail and ipv4address dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 584
diff changeset
    40
   *
12fa3d0c4f94 droptail and ipv4address dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 584
diff changeset
    41
   * Creates a droptail queue with a maximum size of 100 packets by default
12fa3d0c4f94 droptail and ipv4address dox
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 584
diff changeset
    42
   */
264
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    43
  DropTailQueue ();
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    44
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    45
  virtual ~DropTailQueue();
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    46
317
b5959aa4a02f fix queue tracing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 308
diff changeset
    47
private:
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1308
diff changeset
    48
  virtual bool DoEnqueue (Ptr<Packet> p);
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1308
diff changeset
    49
  virtual Ptr<Packet> DoDequeue (void);
3525
4b8ef7da0ac3 bug 275: Queue::Peek should return Ptr<const Packet>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3183
diff changeset
    50
  virtual Ptr<const Packet> DoPeek (void) const;
264
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    51
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    52
private:
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1308
diff changeset
    53
  std::queue<Ptr<Packet> > m_packets;
264
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    54
  uint32_t m_maxPackets;
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    55
};
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    56
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    57
}; // namespace ns3
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    58
128d8d1bfb51 queues, trace-writer, debug
craigdo@m354-pc01.ee.washington.edu
parents:
diff changeset
    59
#endif /* DROPTAIL_H */