akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 1 | #ifndef NLSR_RT_HPP |
| 2 | #define NLSR_RT_HPP |
| 3 | |
| 4 | #include<iostream> |
akmhoque | f7c2c7c | 2014-02-06 11:32:43 -0600 | [diff] [blame] | 5 | #include<utility> |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 6 | #include<string> |
| 7 | |
| 8 | #include "nlsr_rte.hpp" |
| 9 | |
akmhoque | 79d355f | 2014-02-04 15:11:16 -0600 | [diff] [blame] | 10 | class nlsr; |
akmhoque | f7c2c7c | 2014-02-06 11:32:43 -0600 | [diff] [blame] | 11 | class NextHop; |
akmhoque | 79d355f | 2014-02-04 15:11:16 -0600 | [diff] [blame] | 12 | |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 13 | using namespace std; |
| 14 | |
| 15 | class RoutingTable |
| 16 | { |
| 17 | public: |
| 18 | RoutingTable() |
akmhoque | f7c2c7c | 2014-02-06 11:32:43 -0600 | [diff] [blame] | 19 | : NO_NEXT_HOP(-12345) |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 20 | { |
| 21 | } |
akmhoque | 79d355f | 2014-02-04 15:11:16 -0600 | [diff] [blame] | 22 | void calculate(nlsr& pnlsr); |
akmhoque | f7c2c7c | 2014-02-06 11:32:43 -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 | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 29 | |
| 30 | private: |
akmhoque | 79d355f | 2014-02-04 15:11:16 -0600 | [diff] [blame] | 31 | void calculateLsRoutingTable(nlsr& pnlsr); |
| 32 | void calculateHypRoutingTable(nlsr& pnlsr); |
| 33 | void calculateHypDryRoutingTable(nlsr&pnlsr); |
| 34 | |
| 35 | void clearRoutingTable(); |
| 36 | void clearDryRoutingTable(); |
akmhoque | f7c2c7c | 2014-02-06 11:32:43 -0600 | [diff] [blame] | 37 | |
| 38 | const int NO_NEXT_HOP; |
akmhoque | 79d355f | 2014-02-04 15:11:16 -0600 | [diff] [blame] | 39 | |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 40 | std::list< RoutingTableEntry > rTable; |
akmhoque | 79d355f | 2014-02-04 15:11:16 -0600 | [diff] [blame] | 41 | std::list< RoutingTableEntry > dryTable; |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | #endif |