blob: fb9a060a783b121daf7dc6da96cd3fab8bfe41d6 [file] [log] [blame]
akmhoque298385a2014-02-13 14:13:09 -06001#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
akmhoque1fd8c1e2014-02-19 19:41:49 -060010namespace nlsr
akmhoque298385a2014-02-13 14:13:09 -060011{
akmhoque298385a2014-02-13 14:13:09 -060012
akmhoque1fd8c1e2014-02-19 19:41:49 -060013 class Nlsr;
14 class NextHop;
akmhoque298385a2014-02-13 14:13:09 -060015
akmhoque1fd8c1e2014-02-19 19:41:49 -060016 using namespace std;
akmhoque298385a2014-02-13 14:13:09 -060017
akmhoque1fd8c1e2014-02-19 19:41:49 -060018 class RoutingTable
19 {
20 public:
21 RoutingTable()
22 : NO_NEXT_HOP(-12345)
23 {
24 }
25 void calculate(Nlsr& pnlsr);
26 void addNextHop(string destRouter, NextHop& nh);
27 void printRoutingTable();
28
29 void addNextHopToDryTable(string destRouter, NextHop& nh);
30 void printDryRoutingTable();
31 std::pair<RoutingTableEntry&, bool> findRoutingTableEntry(string destRouter);
32 void scheduleRoutingTableCalculation(Nlsr& pnlsr);
33
34 private:
35 void calculateLsRoutingTable(Nlsr& pnlsr);
36 void calculateHypRoutingTable(Nlsr& pnlsr);
37 void calculateHypDryRoutingTable(Nlsr&pnlsr);
38
39 void clearRoutingTable();
40 void clearDryRoutingTable();
41
42 const int NO_NEXT_HOP;
43
44 std::list< RoutingTableEntry > rTable;
45 std::list< RoutingTableEntry > dryTable;
46 };
akmhoque298385a2014-02-13 14:13:09 -060047
akmhoqueb1710aa2014-02-19 17:13:36 -060048}//namespace nlsr
49
akmhoque298385a2014-02-13 14:13:09 -060050#endif