blob: 44dc25227cffdf709950491e7fd0b6bb5394f572 [file] [log] [blame]
Junxiao Shicbba04c2014-01-26 14:21:22 -07001/* -*- 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_PIT_HPP
8#define NFD_TABLE_PIT_HPP
9
10#include "pit-entry.hpp"
11namespace ndn {
12namespace pit {
13
14/** \class DataMatchResult
15 * \brief an unordered iterable of all PIT entries matching Data
16 * This type shall support:
17 * iterator<shared_ptr<pit::Entry>> begin()
18 * iterator<shared_ptr<pit::Entry>> end()
19 */
20typedef std::vector<shared_ptr<pit::Entry> > DataMatchResult;
21
22} // namespace pit
23
24/** \class Pit
25 * \brief represents the PIT
26 */
27class Pit : noncopyable
28{
29public:
30 Pit();
31
32 ~Pit();
33
34 /** \brief inserts a FIB entry for prefix
35 * If an entry for exact same prefix exists, that entry is returned.
36 * \return{ the entry, and true for new entry, false for existing entry }
37 */
38 std::pair<shared_ptr<pit::Entry>, bool>
39 insert(const Interest& interest);
40
41 /** \brief performs a Data match
42 * \return{ an iterable of all PIT entries matching data }
43 */
44 shared_ptr<pit::DataMatchResult>
45 findAllDataMatches(const Data& data) const;
46
47 /// removes a PIT entry
48 void
49 remove(shared_ptr<pit::Entry> pitEntry);
50
51private:
52 std::list<shared_ptr<pit::Entry> > m_table;
53};
54
55} // namespace ndn
56
57#endif // NFD_TABLE_PIT_HPP