blob: 53a34c713a0ac90882824a9112a980db4d7e181b [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"
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080011namespace nfd {
Junxiao Shic1e12362014-01-24 20:03:26 -070012
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
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080046} // namespace nfd
Junxiao Shic1e12362014-01-24 20:03:26 -070047
48#endif // NFD_TABLE_FIB_HPP