Junxiao Shi | c1e1236 | 2014-01-24 20:03:26 -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_FIB_HPP |
| 8 | #define NFD_TABLE_FIB_HPP |
| 9 | |
| 10 | #include "fib-entry.hpp" |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame^] | 11 | namespace nfd { |
Junxiao Shi | c1e1236 | 2014-01-24 20:03:26 -0700 | [diff] [blame] | 12 | |
| 13 | /** \class Fib |
| 14 | * \brief represents the FIB |
| 15 | */ |
| 16 | class Fib : noncopyable |
| 17 | { |
| 18 | public: |
| 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 | |
| 41 | private: |
| 42 | shared_ptr<fib::Entry> m_rootEntry; |
| 43 | std::list<shared_ptr<fib::Entry> > m_table; |
| 44 | }; |
| 45 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame^] | 46 | } // namespace nfd |
Junxiao Shi | c1e1236 | 2014-01-24 20:03:26 -0700 | [diff] [blame] | 47 | |
| 48 | #endif // NFD_TABLE_FIB_HPP |