blob: ea8449655eb95b63ad0f0e8614121dd9b492da04 [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#include "ndn-pit.h"
Alexander Afanasyeve3d126f2012-07-16 17:07:31 -070022
Alexander Afanasyevbd9c18e2012-11-19 15:23:41 -080023#include "ns3/ndn-interest.h"
24#include "ns3/ndn-content-object.h"
Alexander Afanasyeve3d126f2012-07-16 17:07:31 -070025
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070026#include "ns3/log.h"
Alexander Afanasyeveec66292013-02-06 16:23:21 -080027#include "ns3/nstime.h"
Alexander Afanasyev3a4a0b32012-06-28 14:14:22 -070028#include "ns3/uinteger.h"
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070029#include "ns3/simulator.h"
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070030
Alexander Afanasyevf034cbd2012-06-29 14:28:31 -070031#include <boost/lambda/bind.hpp>
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -080032#include <boost/lambda/lambda.hpp>
33
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070034NS_LOG_COMPONENT_DEFINE ("ndn.Pit");
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070035
36namespace ns3 {
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070037namespace ndn {
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070038
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070039NS_OBJECT_ENSURE_REGISTERED (Pit);
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070040
Alexander Afanasyeva46844b2011-11-21 19:13:26 -080041TypeId
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070042Pit::GetTypeId ()
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070043{
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070044 static TypeId tid = TypeId ("ns3::ndn::Pit")
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070045 .SetGroupName ("Ndn")
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070046 .SetParent<Object> ()
Alexander Afanasyeveec66292013-02-06 16:23:21 -080047
Alexander Afanasyeva46844b2011-11-21 19:13:26 -080048 .AddAttribute ("PitEntryPruningTimout",
49 "Timeout for PIT entry to live after being satisfied. To make sure recently satisfied interest will not be satisfied again",
Alexander Afanasyeveec66292013-02-06 16:23:21 -080050 TimeValue (), // by default, PIT entries are removed instantly
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070051 MakeTimeAccessor (&Pit::m_PitEntryPruningTimout),
Alexander Afanasyeva46844b2011-11-21 19:13:26 -080052 MakeTimeChecker ())
Alexander Afanasyevcdeefb42013-05-01 16:04:53 -070053
54 .AddAttribute ("MaxPitEntryLifetime",
55 "Maximum amount of time for which a router is willing to maintain a PIT entry. "
56 "Actual PIT lifetime should be minimum of MaxPitEntryLifetime and InterestLifetime specified in the Interest packet",
57 TimeValue (), // by default, PIT entries are kept for the time, specified by the InterestLifetime
58 MakeTimeAccessor (&Pit::GetMaxPitEntryLifetime, &Pit::SetMaxPitEntryLifetime),
59 MakeTimeChecker ())
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070060 ;
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070061
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070062 return tid;
63}
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070064
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070065Pit::Pit ()
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070066{
67}
68
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070069Pit::~Pit ()
Alexander Afanasyevd02a5d62011-11-21 11:01:51 -080070{
Alexander Afanasyevd02a5d62011-11-21 11:01:51 -080071}
72
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070073} // namespace ndn
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070074} // namespace ns3