blob: e382b8b4d87476b1043342ab76cab9b33a0bbd0d [file] [log] [blame]
akmhoqueba094742014-02-28 11:47:21 -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
10namespace nlsr
11{
12
akmhoque5a44dd42014-03-12 18:11:32 -050013 class Nlsr;
14 class NextHop;
akmhoqueba094742014-02-28 11:47:21 -060015
akmhoque5a44dd42014-03-12 18:11:32 -050016 using namespace std;
akmhoqueba094742014-02-28 11:47:21 -060017
akmhoque5a44dd42014-03-12 18:11:32 -050018 class RoutingTable
19 {
20 public:
21 RoutingTable()
22 : NO_NEXT_HOP(-12345)
akmhoqueba094742014-02-28 11:47:21 -060023 {
akmhoque5a44dd42014-03-12 18:11:32 -050024 }
25 void calculate(Nlsr& pnlsr);
26 void addNextHop(string destRouter, NextHop& nh);
27 void printRoutingTable();
akmhoqueba094742014-02-28 11:47:21 -060028
akmhoque5a44dd42014-03-12 18:11:32 -050029 void addNextHopToDryTable(string destRouter, NextHop& nh);
30 void printDryRoutingTable();
31 std::pair<RoutingTableEntry&, bool> findRoutingTableEntry(string destRouter);
32 void scheduleRoutingTableCalculation(Nlsr& pnlsr);
akmhoqueba094742014-02-28 11:47:21 -060033
akmhoque5a44dd42014-03-12 18:11:32 -050034 private:
35 void calculateLsRoutingTable(Nlsr& pnlsr);
36 void calculateHypRoutingTable(Nlsr& pnlsr);
akmhoque05d5fcf2014-04-15 14:58:45 -050037 void calculateHypDryRoutingTable(Nlsr& pnlsr);
akmhoqueba094742014-02-28 11:47:21 -060038
akmhoque5a44dd42014-03-12 18:11:32 -050039 void clearRoutingTable();
40 void clearDryRoutingTable();
akmhoqueba094742014-02-28 11:47:21 -060041
akmhoque5a44dd42014-03-12 18:11:32 -050042 const int NO_NEXT_HOP;
akmhoqueba094742014-02-28 11:47:21 -060043
akmhoque05d5fcf2014-04-15 14:58:45 -050044 std::list< RoutingTableEntry > m_rTable;
45 std::list< RoutingTableEntry > m_dryTable;
akmhoque5a44dd42014-03-12 18:11:32 -050046 };
akmhoqueba094742014-02-28 11:47:21 -060047
48}//namespace nlsr
49
50#endif