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
pending-interests-container.h
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2
/*
3
* Copyright (c) 2013, Regents of the University of California
4
* Alexander Afanasyev
5
*
6
* GNU v3.0 license, See the LICENSE file for more information
7
*
8
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
9
*/
10
11
#ifndef NDN_NDNCXX_DETAIL_PENDING_INTEREST_CONTAINER_H
12
#define NDN_NDNCXX_DETAIL_PENDING_INTEREST_CONTAINER_H
13
14
#include <ns3/ndnSIM/utils/trie/trie-with-policy.h>
15
#include "timeouts-policy.h"
16
17
namespace
ns3 {
18
namespace
ndn {
19
namespace
detail {
20
21
struct
PendingInterestEntry
:
public
SimpleRefCount< PendingInterestEntry >
22
{
23
public
:
24
PendingInterestEntry
(Ptr<const Interest> interest)
25
: m_interest (interest)
26
{
27
}
28
29
virtual
~
PendingInterestEntry
()
30
{
31
}
32
33
void
34
AddCallbacks (ApiFace::DataCallback onData, ApiFace::TimeoutCallback onTimeout)
35
{
36
if
(! onData.IsNull ())
37
{
38
m_dataCallbacks.push_back (onData);
39
}
40
if
(! onTimeout.IsNull ())
41
{
42
m_timeoutCallbacks.push_back (onTimeout);
43
}
44
}
45
46
void
47
ClearCallbacks ()
48
{
49
m_dataCallbacks.clear ();
50
m_timeoutCallbacks.clear ();
51
}
52
53
Ptr<const Interest>
54
GetInterest ()
const
55
{
56
return
m_interest;
57
}
58
59
void
60
ProcessOnData (Ptr<const Interest> interest, Ptr<const Data> data)
61
{
62
for
(std::list<ApiFace::DataCallback>::iterator i = m_dataCallbacks.begin ();
63
i != m_dataCallbacks.end ();
64
i++)
65
{
66
(*i) (interest, data);
67
}
68
}
69
70
void
71
ProcessOnTimeout (Ptr<const Interest> interest)
72
{
73
for
(std::list<ApiFace::TimeoutCallback>::iterator i = m_timeoutCallbacks.begin ();
74
i != m_timeoutCallbacks.end ();
75
i++)
76
{
77
(*i) (interest);
78
}
79
}
80
81
private
:
82
std::list<ApiFace::DataCallback> m_dataCallbacks;
83
std::list<ApiFace::TimeoutCallback> m_timeoutCallbacks;
84
Ptr<const Interest> m_interest;
85
};
86
87
88
struct
PendingInterestContainer
:
89
public
ndnSIM::trie_with_policy
<Name,
90
ndnSIM::smart_pointer_payload_traits< PendingInterestEntry >,
91
timeouts_policy_traits>
92
{
93
};
94
95
}
// detail
96
}
// ndn
97
}
// ns3
98
99
#endif // NDN_NDNCXX_DETAIL_PENDING_INTEREST_CONTAINER_H
ns3::ndn::detail::PendingInterestEntry
Definition:
pending-interests-container.h:21
ns3::ndn::ndnSIM::trie_with_policy
Definition:
trie-with-policy.h:34
ns3::ndn::detail::PendingInterestContainer
Definition:
pending-interests-container.h:88
ndnSIM
ndn.cxx
detail
pending-interests-container.h
Generated on Mon Jan 19 2015 11:27:04 for ndnSIM by
1.8.7