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