blob: 00b892d022f21b82cfbf0b4ef68076c90891161d [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"
22#include "ns3/log.h"
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -080023#include "ns3/string.h"
Alexander Afanasyev3a4a0b32012-06-28 14:14:22 -070024#include "ns3/uinteger.h"
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070025#include "ns3/simulator.h"
26#include "ccnx-interest-header.h"
27#include "ccnx-content-object-header.h"
28
Alexander Afanasyevf034cbd2012-06-29 14:28:31 -070029#include <boost/lambda/bind.hpp>
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -080030#include <boost/lambda/lambda.hpp>
31
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070032NS_LOG_COMPONENT_DEFINE ("CcnxPit");
33
34namespace ns3 {
35
Alexander Afanasyevd02a5d62011-11-21 11:01:51 -080036NS_OBJECT_ENSURE_REGISTERED (CcnxPit);
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070037
38using namespace __ccnx_private;
39
Alexander Afanasyeva46844b2011-11-21 19:13:26 -080040TypeId
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070041CcnxPit::GetTypeId ()
42{
Alexander Afanasyev11f7bb42012-07-09 17:06:30 -070043 static TypeId tid = TypeId ("ns3::private::CcnxPit")
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070044 .SetGroupName ("Ccnx")
45 .SetParent<Object> ()
Alexander Afanasyev413c7f12012-07-10 17:35:16 -070046 // .AddAttribute ("CleanupTimeout",
47 // "Timeout defining how frequent RIT should be cleaned up",
48 // StringValue ("1s"),
49 // MakeTimeAccessor (&CcnxPit::GetCleanupTimeout, &CcnxPit::SetCleanupTimeout),
50 // MakeTimeChecker ())
Alexander Afanasyevf9f4eb02011-12-16 01:51:14 -080051
Alexander Afanasyeva46844b2011-11-21 19:13:26 -080052 .AddAttribute ("PitEntryPruningTimout",
53 "Timeout for PIT entry to live after being satisfied. To make sure recently satisfied interest will not be satisfied again",
54 StringValue ("100ms"),
55 MakeTimeAccessor (&CcnxPit::m_PitEntryPruningTimout),
56 MakeTimeChecker ())
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070057 ;
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070058
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070059 return tid;
60}
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070061
62CcnxPit::CcnxPit ()
63{
64}
65
Alexander Afanasyevd02a5d62011-11-21 11:01:51 -080066CcnxPit::~CcnxPit ()
67{
Alexander Afanasyevd02a5d62011-11-21 11:01:51 -080068}
69
Alexander Afanasyev413c7f12012-07-10 17:35:16 -070070// void CcnxPit::CleanExpired ()
71// {
72// DoCleanExpired ();
Alexander Afanasyev11f7bb42012-07-09 17:06:30 -070073
Alexander Afanasyev413c7f12012-07-10 17:35:16 -070074// // schedule next event
75// m_cleanupEvent = Simulator::Schedule (m_cleanupTimeout,
76// &CcnxPit::CleanExpired, this);
77// }
Alexander Afanasyev18252852011-11-21 13:35:31 -080078
Alexander Afanasyev413c7f12012-07-10 17:35:16 -070079// void
80// CcnxPit::SetCleanupTimeout (const Time &timeout)
81// {
82// m_cleanupTimeout = timeout;
83// if (m_cleanupEvent.IsRunning ())
84// m_cleanupEvent.Cancel (); // cancel any scheduled cleanup events
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070085
Alexander Afanasyev413c7f12012-07-10 17:35:16 -070086// // schedule even with new timeout
87// m_cleanupEvent = Simulator::Schedule (m_cleanupTimeout,
88// &CcnxPit::CleanExpired, this);
89// }
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070090
Alexander Afanasyev413c7f12012-07-10 17:35:16 -070091// Time
92// CcnxPit::GetCleanupTimeout () const
93// {
94// return m_cleanupTimeout;
95// }
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070096
Alexander Afanasyeva95b7392012-03-09 10:54:10 -080097
Alexander Afanasyeva98cdd22011-08-29 17:32:37 -070098} // namespace ns3