blob: 281a8d08919f4a993fd781694a19fceb97c8f368 [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"
Alexander Afanasyev6eba36f2013-08-07 17:42:54 -070024#include "ns3/ndn-data.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 Afanasyevfaa01f92013-07-10 18:34:31 -070030#include "ns3/packet.h"
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070031
Alexander Afanasyevf034cbd2012-06-29 14:28:31 -070032#include <boost/lambda/bind.hpp>
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -080033#include <boost/lambda/lambda.hpp>
34
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070035NS_LOG_COMPONENT_DEFINE ("ndn.Pit");
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070036
37namespace ns3 {
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070038namespace ndn {
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070039
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070040NS_OBJECT_ENSURE_REGISTERED (Pit);
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070041
Alexander Afanasyeva46844b2011-11-21 19:13:26 -080042TypeId
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070043Pit::GetTypeId ()
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070044{
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070045 static TypeId tid = TypeId ("ns3::ndn::Pit")
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070046 .SetGroupName ("Ndn")
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070047 .SetParent<Object> ()
Alexander Afanasyeveec66292013-02-06 16:23:21 -080048
Alexander Afanasyeva46844b2011-11-21 19:13:26 -080049 .AddAttribute ("PitEntryPruningTimout",
50 "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 -080051 TimeValue (), // by default, PIT entries are removed instantly
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070052 MakeTimeAccessor (&Pit::m_PitEntryPruningTimout),
Alexander Afanasyeva46844b2011-11-21 19:13:26 -080053 MakeTimeChecker ())
Alexander Afanasyevcdeefb42013-05-01 16:04:53 -070054
55 .AddAttribute ("MaxPitEntryLifetime",
56 "Maximum amount of time for which a router is willing to maintain a PIT entry. "
57 "Actual PIT lifetime should be minimum of MaxPitEntryLifetime and InterestLifetime specified in the Interest packet",
58 TimeValue (), // by default, PIT entries are kept for the time, specified by the InterestLifetime
59 MakeTimeAccessor (&Pit::GetMaxPitEntryLifetime, &Pit::SetMaxPitEntryLifetime),
60 MakeTimeChecker ())
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070061 ;
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070062
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070063 return tid;
64}
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070065
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070066Pit::Pit ()
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070067{
68}
69
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070070Pit::~Pit ()
Alexander Afanasyevd02a5d62011-11-21 11:01:51 -080071{
Alexander Afanasyevd02a5d62011-11-21 11:01:51 -080072}
73
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070074} // namespace ndn
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070075} // namespace ns3