Alexander Afanasyev | 048ae42 | 2012-08-17 17:33:02 -0700 | [diff] [blame] | 1 | /* -*- 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 Afanasyev | ec1e395 | 2012-08-20 13:48:15 -0700 | [diff] [blame^] | 25 | #include <list> |
Alexander Afanasyev | 048ae42 | 2012-08-17 17:33:02 -0700 | [diff] [blame] | 26 | |
| 27 | #include "ns3/ptr.h" |
| 28 | |
| 29 | namespace ns3 { |
| 30 | namespace ndn { |
| 31 | |
| 32 | class Face; |
| 33 | namespace pit { class Entry; } |
| 34 | |
| 35 | class PitQueue |
| 36 | { |
| 37 | public: |
Alexander Afanasyev | ec1e395 | 2012-08-20 13:48:15 -0700 | [diff] [blame^] | 38 | PitQueue (); |
| 39 | |
| 40 | void |
| 41 | SetMaxQueueSize (uint32_t size); |
| 42 | |
| 43 | uint32_t |
| 44 | GetMaxQueueSize () const; |
| 45 | |
Alexander Afanasyev | 048ae42 | 2012-08-17 17:33:02 -0700 | [diff] [blame] | 46 | 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 Afanasyev | 048ae42 | 2012-08-17 17:33:02 -0700 | [diff] [blame] | 60 | |
| 61 | private: |
Alexander Afanasyev | ec1e395 | 2012-08-20 13:48:15 -0700 | [diff] [blame^] | 62 | 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 Afanasyev | 048ae42 | 2012-08-17 17:33:02 -0700 | [diff] [blame] | 68 | |
Alexander Afanasyev | ec1e395 | 2012-08-20 13:48:15 -0700 | [diff] [blame^] | 69 | PerInFaceQueue m_queues; |
Alexander Afanasyev | 048ae42 | 2012-08-17 17:33:02 -0700 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | } // namespace ndn |
| 73 | } // namespace ns3 |
| 74 | |
| 75 | #endif // NDN_PIT_QUEUE_H |