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 | |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 7 | #ifndef NFD_TABLE_CS_HPP |
| 8 | #define NFD_TABLE_CS_HPP |
| 9 | |
| 10 | #include "common.hpp" |
Junxiao Shi | 0fcb41e | 2014-01-24 10:29:43 -0700 | [diff] [blame] | 11 | #include "cs-entry.hpp" |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 12 | |
Junxiao Shi | 0fcb41e | 2014-01-24 10:29:43 -0700 | [diff] [blame] | 13 | namespace ndn { |
| 14 | |
| 15 | /** \class Cs |
| 16 | * \brief represents the ContentStore |
| 17 | */ |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 18 | class Cs : noncopyable |
Junxiao Shi | 0fcb41e | 2014-01-24 10:29:43 -0700 | [diff] [blame] | 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 |
Alexander Afanasyev | fd603ee | 2014-01-26 11:03:03 -0800 | [diff] [blame] | 33 | insert(const Data& data); |
Junxiao Shi | 0fcb41e | 2014-01-24 10:29:43 -0700 | [diff] [blame] | 34 | |
| 35 | /** \brief finds the best match Data for an Interest |
Alexander Afanasyev | c9765df | 2014-01-25 19:24:27 -0800 | [diff] [blame] | 36 | * \return{ the best match, if any; otherwise 0 } |
Junxiao Shi | 0fcb41e | 2014-01-24 10:29:43 -0700 | [diff] [blame] | 37 | */ |
Alexander Afanasyev | c9765df | 2014-01-25 19:24:27 -0800 | [diff] [blame] | 38 | const Data* |
Junxiao Shi | 0fcb41e | 2014-01-24 10:29:43 -0700 | [diff] [blame] | 39 | find(const Interest& interest); |
| 40 | }; |
| 41 | |
Alexander Afanasyev | b927a3a | 2014-01-24 10:41:47 -0800 | [diff] [blame] | 42 | } // namespace ndn |
| 43 | |
| 44 | #endif // NFD_TABLE_CS_HPP |