blob: 8585184079c01db348e595ee09049642aca89e6f [file] [log] [blame]
akmhoquedfa4a5b2014-02-03 20:12:29 -06001#ifndef NLSR_RT_HPP
2#define NLSR_RT_HPP
3
4#include<iostream>
akmhoquef7c2c7c2014-02-06 11:32:43 -06005#include<utility>
akmhoquedfa4a5b2014-02-03 20:12:29 -06006#include<string>
7
8#include "nlsr_rte.hpp"
9
akmhoque79d355f2014-02-04 15:11:16 -060010class nlsr;
akmhoquef7c2c7c2014-02-06 11:32:43 -060011class NextHop;
akmhoque79d355f2014-02-04 15:11:16 -060012
akmhoquedfa4a5b2014-02-03 20:12:29 -060013using namespace std;
14
15class RoutingTable
16{
17public:
18 RoutingTable()
akmhoquef7c2c7c2014-02-06 11:32:43 -060019 : NO_NEXT_HOP(-12345)
akmhoquedfa4a5b2014-02-03 20:12:29 -060020 {
21 }
akmhoque79d355f2014-02-04 15:11:16 -060022 void calculate(nlsr& pnlsr);
akmhoquef7c2c7c2014-02-06 11:32:43 -060023 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);
akmhoquedfa4a5b2014-02-03 20:12:29 -060029
30private:
akmhoque79d355f2014-02-04 15:11:16 -060031 void calculateLsRoutingTable(nlsr& pnlsr);
32 void calculateHypRoutingTable(nlsr& pnlsr);
33 void calculateHypDryRoutingTable(nlsr&pnlsr);
34
35 void clearRoutingTable();
36 void clearDryRoutingTable();
akmhoquef7c2c7c2014-02-06 11:32:43 -060037
38 const int NO_NEXT_HOP;
akmhoque79d355f2014-02-04 15:11:16 -060039
akmhoquedfa4a5b2014-02-03 20:12:29 -060040 std::list< RoutingTableEntry > rTable;
akmhoque79d355f2014-02-04 15:11:16 -060041 std::list< RoutingTableEntry > dryTable;
akmhoquedfa4a5b2014-02-03 20:12:29 -060042};
43
44#endif