blob: 9ba1af54fed88945a34aa00184843f8d646a391d [file] [log] [blame]
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -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#ifndef NDN_CONTENT_STORE_IMPL_H_
22#define NDN_CONTENT_STORE_IMPL_H_
23
24#include "ndn-content-store.h"
25#include "ns3/packet.h"
26#include "ns3/ndn-interest-header.h"
27#include "ns3/ndn-content-object-header.h"
28#include <boost/foreach.hpp>
29
30#include "../../utils/trie-with-policy.h"
31
32namespace ns3 {
33namespace ndn {
34namespace cs {
35
36
37template<class Policy>
38class ContentStoreImpl : public ContentStore,
39 protected ndnSIM::trie_with_policy< NameComponents,
40 ndnSIM::smart_pointer_payload_traits< Entry >,
41 Policy >
42{
43private:
44 typedef ndnSIM::trie_with_policy< NameComponents,
45 ndnSIM::smart_pointer_payload_traits< Entry >,
46 Policy > super;
47
48public:
49 static TypeId
50 GetTypeId ();
51
52 ContentStoreImpl () { };
53 virtual ~ContentStoreImpl () { };
54
55 // from ContentStore
56
57 virtual inline boost::tuple<Ptr<Packet>, Ptr<const ContentObjectHeader>, Ptr<const Packet> >
58 Lookup (Ptr<const InterestHeader> interest);
59
60 virtual inline bool
61 Add (Ptr<const ContentObjectHeader> header, Ptr<const Packet> packet);
62
63 // virtual bool
64 // Remove (Ptr<InterestHeader> header);
65
66 virtual inline void
67 Print (std::ostream &os) const;
68
69private:
70 void
71 SetMaxSize (uint32_t maxSize);
72
73 uint32_t
74 GetMaxSize () const;
75};
76
77} // namespace cs
78} // namespace ndn
79} // namespace ns3
80
81#endif // NDN_CONTENT_STORE_IMPL_H_