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