NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn-content-store.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #include "ndn-content-store.hpp"
21 
22 #include "ns3/log.h"
23 #include "ns3/packet.h"
24 
25 NS_LOG_COMPONENT_DEFINE("ndn.cs.ContentStore");
26 
27 namespace ns3 {
28 namespace ndn {
29 
31 
32 TypeId
34 {
35  static TypeId tid =
36  TypeId("ns3::ndn::ContentStore")
37  .SetGroupName("Ndn")
38  .SetParent<Object>()
39 
40  .AddTraceSource("CacheHits", "Trace called every time there is a cache hit",
41  MakeTraceSourceAccessor(&ContentStore::m_cacheHitsTrace),
42  "ns3::ndn::ContentStore::CacheHitsCallback")
43 
44  .AddTraceSource("CacheMisses", "Trace called every time there is a cache miss",
45  MakeTraceSourceAccessor(&ContentStore::m_cacheMissesTrace),
46  "ns3::ndn::ContentStrore::CacheMissesCallback");
47 
48  return tid;
49 }
50 
52 {
53 }
54 
55 namespace cs {
56 
58 
59 Entry::Entry(Ptr<ContentStore> cs, shared_ptr<const Data> data)
60  : m_cs(cs)
61  , m_data(data)
62 {
63 }
64 
65 const Name&
67 {
68  return m_data->getName();
69 }
70 
71 shared_ptr<const Data>
73 {
74  return m_data;
75 }
76 
77 Ptr<ContentStore>
79 {
80  return m_cs;
81 }
82 
83 } // namespace cs
84 } // namespace ndn
85 } // namespace ns3
Copyright (c) 2011-2015 Regents of the University of California.
const Name & GetName() const
Get prefix of the stored entry.
Entry(Ptr< ContentStore > cs, shared_ptr< const Data > data)
Construct content store entry.
NS_OBJECT_ENSURE_REGISTERED(ContentStore)
TracedCallback< shared_ptr< const Interest > > m_cacheMissesTrace
trace of cache misses
shared_ptr< const Data > GetData() const
Get Data of the stored entry.
Copyright (c) 2011-2015 Regents of the University of California.
TracedCallback< shared_ptr< const Interest >, shared_ptr< const Data > > m_cacheHitsTrace
trace of cache hits
virtual ~ContentStore()
Virtual destructor.
ndn cs ContentStore
Copyright (c) 2011-2015 Regents of the University of California.
Ptr< ContentStore > GetContentStore()
Get pointer to access store, to which this entry is added.
static TypeId GetTypeId()
Interface ID.