akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame^] | 1 | #ifndef NLSR_RT_HPP |
| 2 | #define NLSR_RT_HPP |
| 3 | |
| 4 | #include <iostream> |
| 5 | #include <utility> |
| 6 | #include <string> |
| 7 | |
| 8 | #include "routing-table-entry.hpp" |
| 9 | |
| 10 | namespace nlsr { |
| 11 | |
| 12 | class Nlsr; |
| 13 | class NextHop; |
| 14 | |
| 15 | class RoutingTable |
| 16 | { |
| 17 | public: |
| 18 | RoutingTable() |
| 19 | : m_NO_NEXT_HOP(-12345) |
| 20 | { |
| 21 | } |
| 22 | void |
| 23 | calculate(Nlsr& pnlsr); |
| 24 | |
| 25 | void |
| 26 | addNextHop(std::string destRouter, NextHop& nh); |
| 27 | |
| 28 | void |
| 29 | printRoutingTable(); |
| 30 | |
| 31 | void |
| 32 | addNextHopToDryTable(std::string destRouter, NextHop& nh); |
| 33 | |
| 34 | void |
| 35 | printDryRoutingTable(); |
| 36 | |
| 37 | std::pair<RoutingTableEntry&, bool> |
| 38 | findRoutingTableEntry(std::string destRouter); |
| 39 | |
| 40 | void |
| 41 | scheduleRoutingTableCalculation(Nlsr& pnlsr); |
| 42 | |
| 43 | int |
| 44 | getNoNextHop() |
| 45 | { |
| 46 | return m_NO_NEXT_HOP; |
| 47 | } |
| 48 | |
| 49 | private: |
| 50 | void |
| 51 | calculateLsRoutingTable(Nlsr& pnlsr); |
| 52 | |
| 53 | void |
| 54 | calculateHypRoutingTable(Nlsr& pnlsr); |
| 55 | |
| 56 | void |
| 57 | calculateHypDryRoutingTable(Nlsr& pnlsr); |
| 58 | |
| 59 | void |
| 60 | clearRoutingTable(); |
| 61 | |
| 62 | void |
| 63 | clearDryRoutingTable(); |
| 64 | |
| 65 | const int m_NO_NEXT_HOP; |
| 66 | |
| 67 | std::list<RoutingTableEntry> m_rTable; |
| 68 | std::list<RoutingTableEntry> m_dryTable; |
| 69 | }; |
| 70 | |
| 71 | }//namespace nlsr |
| 72 | |
| 73 | #endif //NLSR_RT_HPP |