blob: cd756433b653358e736ea9ce209bb1ecc1208fc7 [file] [log] [blame]
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -07001/* -*- 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 Afanasyev4aac5572012-08-09 10:49:55 -070021#ifndef _NDN_PIT_ENTRY_INCOMING_FACE_H_
22#define _NDN_PIT_ENTRY_INCOMING_FACE_H_
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070023
24#include "ns3/nstime.h"
25#include "ns3/ptr.h"
26
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070027#include "ns3/ndn-face.h"
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070028
29namespace ns3 {
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070030namespace ndn {
31namespace pit {
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070032
33/**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070034 * \ingroup ndn
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070035 * \brief PIT state component for each incoming interest (not including duplicates)
36 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070037struct IncomingFace
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070038{
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070039 Ptr< Face > m_face; ///< \brief face of the incoming Interest
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070040 Time m_arrivalTime; ///< \brief arrival time of the incoming Interest
41
42public:
43 /**
44 * \brief Constructor
45 * \param face face of the incoming interest
46 * \param lifetime lifetime of the incoming interest
47 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070048 IncomingFace (Ptr<Face> face);
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070049
Alexander Afanasyevb4fee8b2012-06-06 12:54:26 -070050 /**
Alexander Afanasyev95a4fa32012-07-09 15:23:59 -070051 * @brief Default constructor, necessary for Python bindings, but should not be used anywhere else.
52 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070053 IncomingFace ();
Alexander Afanasyev95a4fa32012-07-09 15:23:59 -070054 /**
55 * @brie Copy operator
56 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070057 IncomingFace &
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070058 operator = (const IncomingFace &other);
Alexander Afanasyev95a4fa32012-07-09 15:23:59 -070059
60 /**
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070061 * @brief Compare two PitEntryIncomingFace
Alexander Afanasyevb4fee8b2012-06-06 12:54:26 -070062 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070063 bool operator== (const IncomingFace &dst) { return *m_face==*(dst.m_face); }
Alexander Afanasyevb4fee8b2012-06-06 12:54:26 -070064
65 /**
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070066 * @brief Compare PitEntryIncomingFace with Face
Alexander Afanasyevb4fee8b2012-06-06 12:54:26 -070067 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070068 bool operator== (Ptr<Face> face) { return *m_face==*face; }
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070069
70 /**
71 * \brief Comparison operator used by boost::multi_index::identity<>
72 */
73 bool
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070074 operator< (const IncomingFace &m) const { return *m_face < *(m.m_face); } // return identity of the face
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070075};
76
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070077} // namespace pit
78} // namespace ndn
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070079} // namespace ns3
80
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070081#endif /* NDN_PIT_ENTRY_INCOMING_FACE_H */