akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 1 | #ifndef NLSR_FIB_HPP |
| 2 | #define NLSR_FIB_HPP |
| 3 | |
| 4 | #include <list> |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 5 | #include <boost/cstdint.hpp> |
| 6 | |
| 7 | #include <ndn-cxx/management/nfd-controller.hpp> |
| 8 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 9 | #include "fib-entry.hpp" |
| 10 | |
| 11 | namespace nlsr { |
| 12 | |
| 13 | class Nlsr; |
| 14 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 15 | |
| 16 | class Fib |
| 17 | { |
| 18 | public: |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 19 | Fib(ndn::Face& face) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 20 | : m_table() |
| 21 | , m_refreshTime(0) |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 22 | , m_controller(face) |
| 23 | { |
| 24 | } |
| 25 | ~Fib() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 26 | { |
| 27 | } |
| 28 | |
| 29 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 30 | remove(Nlsr& pnlsr, const std::string& name); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 31 | |
| 32 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 33 | update(Nlsr& pnlsr, const std::string& name, NexthopList& nextHopList); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 34 | |
| 35 | void |
| 36 | clean(Nlsr& pnlsr); |
| 37 | |
| 38 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 39 | setEntryRefreshTime(int32_t fert) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 40 | { |
| 41 | m_refreshTime = fert; |
| 42 | } |
| 43 | |
| 44 | void |
| 45 | print(); |
| 46 | |
| 47 | private: |
| 48 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 49 | removeHop(Nlsr& pnlsr, NexthopList& nl, uint32_t doNotRemoveHopFaceId, |
| 50 | const std::string& name); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 51 | |
| 52 | int |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 53 | getNumberOfFacesForName(NexthopList& nextHopList, uint32_t maxFacesPerPrefix); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 54 | |
| 55 | ndn::EventId |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 56 | scheduleEntryRefreshing(Nlsr& pnlsr, const std::string& name, int32_t feSeqNum, |
| 57 | int32_t refreshTime); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 58 | |
| 59 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 60 | cancelScheduledExpiringEvent(Nlsr& pnlsr, ndn::EventId eid); |
| 61 | |
| 62 | void |
| 63 | refreshEntry(Nlsr& nlsr, const std::string& name, int32_t feSeqNum); |
| 64 | |
| 65 | void |
| 66 | registerPrefixInNfd(const std::string& namePrefix, uint64_t faceId, uint64_t faceCost); |
| 67 | |
| 68 | void |
| 69 | unregisterPrefixFromNfd(const std::string& namePrefix, uint64_t faceId); |
| 70 | |
| 71 | void |
| 72 | onSuccess(const ndn::nfd::ControlParameters& commandSuccessResult, const std::string& message); |
| 73 | |
| 74 | void |
| 75 | onFailure(uint32_t code, const std::string& error, const std::string& message); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 76 | |
| 77 | private: |
| 78 | std::list<FibEntry> m_table; |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 79 | int32_t m_refreshTime; |
| 80 | ndn::nfd::Controller m_controller; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 81 | }; |
| 82 | |
| 83 | }//namespace nlsr |
| 84 | #endif //NLSR_FIB_HPP |