blob: 4d96ed4279eee3b51113cc420b26823015339c14 [file] [log] [blame]
Alexander Afanasyeva4e74282013-07-11 15:23:20 -07001/* -*- 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
17namespace ns3 {
18namespace ndn {
19namespace detail {
20
21struct PendingInterestEntry : public SimpleRefCount< PendingInterestEntry >
22{
23public:
24 PendingInterestEntry (Ptr<const Interest> interest)
25 : m_interest (interest)
26 { }
27
28 void
29 AddCallbacks (ApiFace::DataCallback onData, ApiFace::TimeoutCallback onTimeout)
30 {
31 m_dataCallback = onData;
32 m_timeoutCallback = onTimeout;
33 }
34
35 void
36 ClearCallbacks ()
37 {
38 m_dataCallback = ApiFace::DataCallback ();
39 m_timeoutCallback = ApiFace::TimeoutCallback ();
40 }
41
42 Ptr<const Interest>
43 GetInterest () const
44 {
45 return m_interest;
46 }
47
48public:
49 ApiFace::DataCallback m_dataCallback;
50 ApiFace::TimeoutCallback m_timeoutCallback;
51 Ptr<const Interest> m_interest;
52};
53
54
55struct PendingInterestContainer :
56 public ndnSIM::trie_with_policy<Name,
57 ndnSIM::smart_pointer_payload_traits< PendingInterestEntry >,
58 timeouts_policy_traits>
59{
60};
61
62} // detail
63} // ndn
64} // ns3
65
66#endif // NDN_NDNCXX_DETAIL_PENDING_INTEREST_CONTAINER_H