Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2011 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 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 21 | #ifndef _NDN_PIT_ENTRY_INCOMING_FACE_H_ |
| 22 | #define _NDN_PIT_ENTRY_INCOMING_FACE_H_ |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 23 | |
| 24 | #include "ns3/nstime.h" |
| 25 | #include "ns3/ptr.h" |
| 26 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 27 | #include "ns3/ndn-face.h" |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 28 | |
| 29 | namespace ns3 { |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 30 | namespace ndn { |
| 31 | namespace pit { |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 32 | |
| 33 | /** |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 34 | * \ingroup ndn |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 35 | * \brief PIT state component for each incoming interest (not including duplicates) |
| 36 | */ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 37 | struct IncomingFace |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 38 | { |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 39 | Ptr< Face > m_face; ///< \brief face of the incoming Interest |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 40 | Time m_arrivalTime; ///< \brief arrival time of the incoming Interest |
| 41 | |
| 42 | public: |
| 43 | /** |
| 44 | * \brief Constructor |
| 45 | * \param face face of the incoming interest |
| 46 | * \param lifetime lifetime of the incoming interest |
| 47 | */ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 48 | IncomingFace (Ptr<Face> face); |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 49 | |
Alexander Afanasyev | b4fee8b | 2012-06-06 12:54:26 -0700 | [diff] [blame] | 50 | /** |
Alexander Afanasyev | 95a4fa3 | 2012-07-09 15:23:59 -0700 | [diff] [blame] | 51 | * @brief Default constructor, necessary for Python bindings, but should not be used anywhere else. |
| 52 | */ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 53 | IncomingFace (); |
Alexander Afanasyev | 95a4fa3 | 2012-07-09 15:23:59 -0700 | [diff] [blame] | 54 | /** |
Alexander Afanasyev | 042b4a7 | 2012-11-09 17:47:48 -0800 | [diff] [blame] | 55 | * @brief Copy operator |
Alexander Afanasyev | 95a4fa3 | 2012-07-09 15:23:59 -0700 | [diff] [blame] | 56 | */ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 57 | IncomingFace & |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 58 | operator = (const IncomingFace &other); |
Alexander Afanasyev | 95a4fa3 | 2012-07-09 15:23:59 -0700 | [diff] [blame] | 59 | |
| 60 | /** |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 61 | * @brief Compare two PitEntryIncomingFace |
Alexander Afanasyev | b4fee8b | 2012-06-06 12:54:26 -0700 | [diff] [blame] | 62 | */ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 63 | bool operator== (const IncomingFace &dst) { return *m_face==*(dst.m_face); } |
Alexander Afanasyev | b4fee8b | 2012-06-06 12:54:26 -0700 | [diff] [blame] | 64 | |
| 65 | /** |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 66 | * @brief Compare PitEntryIncomingFace with Face |
Alexander Afanasyev | b4fee8b | 2012-06-06 12:54:26 -0700 | [diff] [blame] | 67 | */ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 68 | bool operator== (Ptr<Face> face) { return *m_face==*face; } |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 69 | |
| 70 | /** |
| 71 | * \brief Comparison operator used by boost::multi_index::identity<> |
| 72 | */ |
| 73 | bool |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 74 | operator< (const IncomingFace &m) const { return *m_face < *(m.m_face); } // return identity of the face |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 75 | }; |
| 76 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 77 | } // namespace pit |
| 78 | } // namespace ndn |
Alexander Afanasyev | a98cdd2 | 2011-08-29 17:32:37 -0700 | [diff] [blame] | 79 | } // namespace ns3 |
| 80 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 81 | #endif /* NDN_PIT_ENTRY_INCOMING_FACE_H */ |