blob: ef54742bfc4f9cd1df72613e1ebb2321d43529f9 [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);
akmhoquee77d8142014-02-11 11:59:57 -060029 void scheduleRoutingTableCalculation(nlsr& pnlsr);
akmhoquedfa4a5b2014-02-03 20:12:29 -060030
31private:
akmhoque79d355f2014-02-04 15:11:16 -060032 void calculateLsRoutingTable(nlsr& pnlsr);
33 void calculateHypRoutingTable(nlsr& pnlsr);
34 void calculateHypDryRoutingTable(nlsr&pnlsr);
35
36 void clearRoutingTable();
37 void clearDryRoutingTable();
akmhoquef7c2c7c2014-02-06 11:32:43 -060038
39 const int NO_NEXT_HOP;
akmhoque79d355f2014-02-04 15:11:16 -060040
akmhoquedfa4a5b2014-02-03 20:12:29 -060041 std::list< RoutingTableEntry > rTable;
akmhoque79d355f2014-02-04 15:11:16 -060042 std::list< RoutingTableEntry > dryTable;
akmhoquedfa4a5b2014-02-03 20:12:29 -060043};
44
45#endif