NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Groups
Pages
ndn-content-store.cc
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011,2012 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
* Ilya Moiseenko <iliamo@cs.ucla.edu>
20
*
21
*/
22
23
#include "ndn-content-store.h"
24
#include "ns3/log.h"
25
#include "ns3/packet.h"
26
#include "ns3/ndn-name.h"
27
#include "ns3/ndn-interest.h"
28
#include "ns3/ndn-data.h"
29
30
NS_LOG_COMPONENT_DEFINE (
"ndn.cs.ContentStore"
);
31
32
namespace
ns3 {
33
namespace
ndn {
34
35
NS_OBJECT_ENSURE_REGISTERED (ContentStore);
36
37
TypeId
38
ContentStore::GetTypeId
(
void
)
39
{
40
static
TypeId tid = TypeId (
"ns3::ndn::ContentStore"
)
41
.SetGroupName (
"Ndn"
)
42
.SetParent<Object> ()
43
44
.AddTraceSource (
"CacheHits"
,
"Trace called every time there is a cache hit"
,
45
MakeTraceSourceAccessor (&
ContentStore::m_cacheHitsTrace
))
46
47
.AddTraceSource (
"CacheMisses"
,
"Trace called every time there is a cache miss"
,
48
MakeTraceSourceAccessor (&
ContentStore::m_cacheMissesTrace
))
49
;
50
51
return
tid;
52
}
53
54
55
ContentStore::~ContentStore
()
56
{
57
}
58
59
namespace
cs {
60
62
63
Entry::Entry
(Ptr<ContentStore> cs, Ptr<const Data> data)
64
: m_cs (cs)
65
, m_data (data)
66
{
67
}
68
69
const
Name
&
70
Entry::GetName
()
const
71
{
72
return
m_data->GetName ();
73
}
74
75
Ptr<const Data>
76
Entry::GetData
()
const
77
{
78
return
m_data;
79
}
80
81
Ptr<ContentStore>
82
Entry::GetContentStore
()
83
{
84
return
m_cs;
85
}
86
87
88
}
// namespace cs
89
}
// namespace ndn
90
}
// namespace ns3
ns3::ndn::cs::Entry::GetName
const Name & GetName() const
Get prefix of the stored entry.
Definition:
ndn-content-store.cc:70
ns3::ndn::Name
Class for NDN Name.
Definition:
name.h:29
ns3::ndn::ContentStore::m_cacheHitsTrace
TracedCallback< Ptr< const Interest >, Ptr< const Data > > m_cacheHitsTrace
trace of cache hits
Definition:
ndn-content-store.h:197
ns3::ndn::ContentStore::~ContentStore
virtual ~ContentStore()
Virtual destructor.
Definition:
ndn-content-store.cc:55
ns3::ndn::ContentStore::m_cacheMissesTrace
TracedCallback< Ptr< const Interest > > m_cacheMissesTrace
trace of cache misses
Definition:
ndn-content-store.h:199
ns3::ndn::ContentStore::GetTypeId
static TypeId GetTypeId()
Interface ID.
Definition:
ndn-content-store.cc:38
ns3::ndn::cs::Entry::GetData
Ptr< const Data > GetData() const
Get Data of the stored entry.
Definition:
ndn-content-store.cc:76
ns3::ndn::cs::Entry::GetContentStore
Ptr< ContentStore > GetContentStore()
Get pointer to access store, to which this entry is added.
Definition:
ndn-content-store.cc:82
ns3::ndn::cs::Entry::Entry
Entry(Ptr< ContentStore > cs, Ptr< const Data > data)
Construct content store entry.
Definition:
ndn-content-store.cc:63
ndnSIM
model
cs
ndn-content-store.cc
Generated on Mon Jan 19 2015 11:27:03 for ndnSIM by
1.8.7