blob: 63c6378ea4844453c728ff4f29d0bfa2b1a09fc7 [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_OUTGOING_FACE_H_
22#define _NDN_PIT_ENTRY_OUTGOING_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 outgoing interest
36 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070037struct OutgoingFace
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070038{
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070039 Ptr<Face> m_face; ///< \brief face of the outgoing Interest
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070040 Time m_sendTime; ///< \brief time when the first outgoing interest is sent (for RTT measurements)
41 ///< \todo handle problem of retransmitted interests... Probably, we should include something similar
42 ///< to TimeStamp TCP option for retransmitted (i.e., only lost interests will suffer)
Alexander Afanasyev0a61c342011-12-06 12:48:55 -080043 uint32_t m_retxCount; ///< \brief number of retransmission
Alexander Afanasyev5a595072011-11-25 14:49:07 -080044 bool m_waitingInVain; ///< \brief when flag is set, we do not expect data for this interest, only a small hope that it will happen
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070045
46public:
Alexander Afanasyevb4fee8b2012-06-06 12:54:26 -070047 /**
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070048 * @brief Constructor to create PitEntryOutgoingFace
Alexander Afanasyevb4fee8b2012-06-06 12:54:26 -070049 * \param face face of the outgoing interest
50 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070051 OutgoingFace (Ptr<Face> face);
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070052
Alexander Afanasyev0a61c342011-12-06 12:48:55 -080053 /**
Alexander Afanasyevc202fd92012-09-03 21:46:00 -070054 * @brief Default constructor, necessary for Python bindings, but should not be used anywhere else.
55 */
56 OutgoingFace ();
57
58 /**
59 * @brie Copy operator
60 */
61 OutgoingFace &
62 operator = (const OutgoingFace &other);
63
64 /**
Alexander Afanasyev0a61c342011-12-06 12:48:55 -080065 * @brief Update outgoing entry upon retransmission
66 */
67 void
68 UpdateOnRetransmit ();
69
Alexander Afanasyevb4fee8b2012-06-06 12:54:26 -070070 /**
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070071 * @brief Compare to PitEntryOutgoingFace
Alexander Afanasyevb4fee8b2012-06-06 12:54:26 -070072 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070073 bool operator== (const OutgoingFace &dst) { return *m_face==*dst.m_face; }
Alexander Afanasyevb4fee8b2012-06-06 12:54:26 -070074
75 /**
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070076 * @brief Compare PitEntryOutgoingFace with Face
Alexander Afanasyevb4fee8b2012-06-06 12:54:26 -070077 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070078 bool operator== (Ptr<Face> face) { return *m_face==*face; }
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070079
80 /**
81 * \brief Comparison operator used by boost::multi_index::identity<>
82 */
83 bool
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070084 operator< (const OutgoingFace &m) const { return *m_face < *(m.m_face); } // return identity of the face
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070085};
86
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070087} // namespace pit
88} // namespace ndn
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070089} // namespace ns3
90
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070091#endif /* NDN_PIT_ENTRY_OUTGOING_FACE_H */