blob: de307133854ddfff6587be1129c34110882e3bac [file] [log] [blame]
Alexander Afanasyev048ae422012-08-17 17:33:02 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2012 University of California, Los Angeles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 */
20
21#ifndef NDN_PIT_QUEUE_H
22#define NDN_PIT_QUEUE_H
23
24#include <map>
Alexander Afanasyevec1e3952012-08-20 13:48:15 -070025#include <list>
Alexander Afanasyev048ae422012-08-17 17:33:02 -070026
27#include "ns3/ptr.h"
28
29namespace ns3 {
30namespace ndn {
31
32class Face;
33namespace pit { class Entry; }
34
35class PitQueue
36{
37public:
Alexander Afanasyevec1e3952012-08-20 13:48:15 -070038 PitQueue ();
39
40 void
41 SetMaxQueueSize (uint32_t size);
42
43 uint32_t
44 GetMaxQueueSize () const;
45
Alexander Afanasyev048ae422012-08-17 17:33:02 -070046 bool
47 Enqueue (Ptr<Face> inFace,
48 Ptr<pit::Entry> pitEntry);
49
50 Ptr<pit::Entry>
51 Pop ();
52
53 // cleanup procedures
54 void
55 Remove (Ptr<Face> face);
56
57 void
58 Remove (Ptr<pit::Entry> entry);
59
Alexander Afanasyev048ae422012-08-17 17:33:02 -070060
61private:
Alexander Afanasyevec1e3952012-08-20 13:48:15 -070062 typedef std::list< Ptr<pit::Entry> > Queue;
63 typedef std::map< Ptr<Face>, Queue > PerInFaceQueue;
64
65 uint32_t m_maxQueueSize;
66
67 PerInFaceQueue::iterator m_lastQueue; // last queue from which interest was taken
Alexander Afanasyev048ae422012-08-17 17:33:02 -070068
Alexander Afanasyevec1e3952012-08-20 13:48:15 -070069 PerInFaceQueue m_queues;
Alexander Afanasyev048ae422012-08-17 17:33:02 -070070};
71
72} // namespace ndn
73} // namespace ns3
74
75#endif // NDN_PIT_QUEUE_H