Junxiao Shi | 0fcb41e | 2014-01-24 10:29:43 -0700 | [diff] [blame^] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2014 Named Data Networking Project |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #ifndef NFD_TABLE_CS_H |
| 8 | #define NFD_TABLE_CS_H |
| 9 | #include <boost/shared_ptr.hpp> |
| 10 | #include <ndn-cpp-dev/interest.hpp> |
| 11 | #include <ndn-cpp-dev/data.hpp> |
| 12 | #include "cs-entry.hpp" |
| 13 | namespace ndn { |
| 14 | |
| 15 | /** \class Cs |
| 16 | * \brief represents the ContentStore |
| 17 | */ |
| 18 | class Cs : boost::noncopyable |
| 19 | { |
| 20 | public: |
| 21 | Cs(); |
| 22 | |
| 23 | ~Cs(); |
| 24 | |
| 25 | /** \brief inserts a Data packet |
| 26 | * The caller should ensure that this Data packet is admittable, |
| 27 | * ie. not unsolicited from a untrusted source. |
| 28 | * This does not guarantee the Data is added to the cache; |
| 29 | * even if the Data is added, it may be removed anytime in the future. |
| 30 | * \return{ whether the Data is added } |
| 31 | */ |
| 32 | bool |
| 33 | insert(boost::shared_ptr<Data> data); |
| 34 | |
| 35 | /** \brief finds the best match Data for an Interest |
| 36 | * \return{ the best match, if any; otherwise null } |
| 37 | */ |
| 38 | boost::shared_ptr<cs::Entry> |
| 39 | find(const Interest& interest); |
| 40 | }; |
| 41 | |
| 42 | };//namespace ndn |
| 43 | #endif//NFD_TABLE_CS_H |