blob: 00e58c702c4fbb88fd402af289e859b782b0d08a [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
21#include "ccnx-pit.h"
Alexander Afanasyeve3d126f2012-07-16 17:07:31 -070022
23#include "ns3/ccnx-interest-header.h"
24#include "ns3/ccnx-content-object-header.h"
25
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070026#include "ns3/log.h"
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -080027#include "ns3/string.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 Afanasyeva98cdd22011-08-29 17:32:37 -070034NS_LOG_COMPONENT_DEFINE ("CcnxPit");
35
36namespace ns3 {
37
Alexander Afanasyevd02a5d62011-11-21 11:01:51 -080038NS_OBJECT_ENSURE_REGISTERED (CcnxPit);
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070039
40using namespace __ccnx_private;
41
Alexander Afanasyeva46844b2011-11-21 19:13:26 -080042TypeId
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070043CcnxPit::GetTypeId ()
44{
Alexander Afanasyev11f7bb42012-07-09 17:06:30 -070045 static TypeId tid = TypeId ("ns3::private::CcnxPit")
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070046 .SetGroupName ("Ccnx")
47 .SetParent<Object> ()
Alexander Afanasyev413c7f12012-07-10 17:35:16 -070048 // .AddAttribute ("CleanupTimeout",
49 // "Timeout defining how frequent RIT should be cleaned up",
50 // StringValue ("1s"),
51 // MakeTimeAccessor (&CcnxPit::GetCleanupTimeout, &CcnxPit::SetCleanupTimeout),
52 // MakeTimeChecker ())
Alexander Afanasyevf9f4eb02011-12-16 01:51:14 -080053
Alexander Afanasyeva46844b2011-11-21 19:13:26 -080054 .AddAttribute ("PitEntryPruningTimout",
55 "Timeout for PIT entry to live after being satisfied. To make sure recently satisfied interest will not be satisfied again",
56 StringValue ("100ms"),
57 MakeTimeAccessor (&CcnxPit::m_PitEntryPruningTimout),
58 MakeTimeChecker ())
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070059 ;
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070060
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070061 return tid;
62}
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070063
64CcnxPit::CcnxPit ()
65{
66}
67
Alexander Afanasyevd02a5d62011-11-21 11:01:51 -080068CcnxPit::~CcnxPit ()
69{
Alexander Afanasyevd02a5d62011-11-21 11:01:51 -080070}
71
Alexander Afanasyev413c7f12012-07-10 17:35:16 -070072// void CcnxPit::CleanExpired ()
73// {
74// DoCleanExpired ();
Alexander Afanasyev11f7bb42012-07-09 17:06:30 -070075
Alexander Afanasyev413c7f12012-07-10 17:35:16 -070076// // schedule next event
77// m_cleanupEvent = Simulator::Schedule (m_cleanupTimeout,
78// &CcnxPit::CleanExpired, this);
79// }
Alexander Afanasyev18252852011-11-21 13:35:31 -080080
Alexander Afanasyev413c7f12012-07-10 17:35:16 -070081// void
82// CcnxPit::SetCleanupTimeout (const Time &timeout)
83// {
84// m_cleanupTimeout = timeout;
85// if (m_cleanupEvent.IsRunning ())
86// m_cleanupEvent.Cancel (); // cancel any scheduled cleanup events
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070087
Alexander Afanasyev413c7f12012-07-10 17:35:16 -070088// // schedule even with new timeout
89// m_cleanupEvent = Simulator::Schedule (m_cleanupTimeout,
90// &CcnxPit::CleanExpired, this);
91// }
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070092
Alexander Afanasyev413c7f12012-07-10 17:35:16 -070093// Time
94// CcnxPit::GetCleanupTimeout () const
95// {
96// return m_cleanupTimeout;
97// }
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070098
Alexander Afanasyeva95b7392012-03-09 10:54:10 -080099
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -0700100} // namespace ns3