akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [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 "nlsr_rte.hpp" |
| 9 | |
akmhoque | 1a48109 | 2014-02-19 16:34:22 -0600 | [diff] [blame^] | 10 | class Nlsr; |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 11 | class NextHop; |
| 12 | |
| 13 | using namespace std; |
| 14 | |
| 15 | class RoutingTable |
| 16 | { |
| 17 | public: |
| 18 | RoutingTable() |
| 19 | : NO_NEXT_HOP(-12345) |
| 20 | { |
| 21 | } |
akmhoque | 1a48109 | 2014-02-19 16:34:22 -0600 | [diff] [blame^] | 22 | void calculate(Nlsr& pnlsr); |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 23 | void addNextHop(string destRouter, NextHop& nh); |
| 24 | void printRoutingTable(); |
| 25 | |
| 26 | void addNextHopToDryTable(string destRouter, NextHop& nh); |
| 27 | void printDryRoutingTable(); |
| 28 | std::pair<RoutingTableEntry&, bool> findRoutingTableEntry(string destRouter); |
akmhoque | 1a48109 | 2014-02-19 16:34:22 -0600 | [diff] [blame^] | 29 | void scheduleRoutingTableCalculation(Nlsr& pnlsr); |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 30 | |
| 31 | private: |
akmhoque | 1a48109 | 2014-02-19 16:34:22 -0600 | [diff] [blame^] | 32 | void calculateLsRoutingTable(Nlsr& pnlsr); |
| 33 | void calculateHypRoutingTable(Nlsr& pnlsr); |
| 34 | void calculateHypDryRoutingTable(Nlsr&pnlsr); |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 35 | |
| 36 | void clearRoutingTable(); |
| 37 | void clearDryRoutingTable(); |
| 38 | |
| 39 | const int NO_NEXT_HOP; |
| 40 | |
| 41 | std::list< RoutingTableEntry > rTable; |
| 42 | std::list< RoutingTableEntry > dryTable; |
| 43 | }; |
| 44 | |
| 45 | #endif |