blob: 0c88eaafe73513e5c6b257d688c11faf649132cc [file] [log] [blame]
Junxiao Shic1e12362014-01-24 20:03:26 -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_FIB_HPP
8#define NFD_TABLE_FIB_HPP
9
10#include "fib-entry.hpp"
11namespace ndn {
12
13/** \class Fib
14 * \brief represents the FIB
15 */
16class Fib : noncopyable
17{
18public:
19 Fib();
20
21 ~Fib();
22
23 /** \brief inserts a FIB entry for prefix
24 * If an entry for exact same prefix exists, that entry is returned.
25 * \return{ the entry, and true for new entry, false for existing entry }
26 */
27 std::pair<shared_ptr<fib::Entry>, bool>
28 insert(const Name& prefix);
29
30 /// performs a longest prefix match
31 shared_ptr<fib::Entry>
32 findLongestPrefixMatch(const Name& prefix) const;
33
34 /** \brief removes the NextHop record for face in all entrites
35 * This is usually invoked when face goes away.
36 * Removing all NextHops in a FIB entry will not remove the FIB entry.
37 */
38 void
39 removeNextHopFromAllEntries(shared_ptr<Face> face);
40
41private:
42 shared_ptr<fib::Entry> m_rootEntry;
43 std::list<shared_ptr<fib::Entry> > m_table;
44};
45
46} // namespace ndn
47
48#endif // NFD_TABLE_FIB_HPP