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