blob: 0117a6a1c185b79912e0848bcef7f9ec38c9c25d [file] [log] [blame]
akmhoquefdbddb12014-05-02 18:35:19 -05001#ifndef NLSR_ROUTING_TABLE_HPP
2#define NLSR_ROUTING_TABLE_HPP
akmhoque53353462014-04-22 08:43:45 -05003
4#include <iostream>
5#include <utility>
6#include <string>
akmhoquefdbddb12014-05-02 18:35:19 -05007#include <boost/cstdint.hpp>
akmhoque53353462014-04-22 08:43:45 -05008
9#include "routing-table-entry.hpp"
10
11namespace nlsr {
12
13class Nlsr;
14class NextHop;
15
16class RoutingTable
17{
18public:
19 RoutingTable()
20 : m_NO_NEXT_HOP(-12345)
21 {
22 }
23 void
24 calculate(Nlsr& pnlsr);
25
26 void
akmhoque31d1d4b2014-05-05 22:08:14 -050027 addNextHop(const ndn::Name& destRouter, NextHop& nh);
akmhoque53353462014-04-22 08:43:45 -050028
29 void
30 printRoutingTable();
31
32 void
akmhoque31d1d4b2014-05-05 22:08:14 -050033 addNextHopToDryTable(const ndn::Name& destRouter, NextHop& nh);
akmhoque53353462014-04-22 08:43:45 -050034
35 void
36 printDryRoutingTable();
37
akmhoqueb6450b12014-04-24 00:01:03 -050038 RoutingTableEntry*
akmhoque31d1d4b2014-05-05 22:08:14 -050039 findRoutingTableEntry(const ndn::Name& destRouter);
akmhoque53353462014-04-22 08:43:45 -050040
41 void
42 scheduleRoutingTableCalculation(Nlsr& pnlsr);
43
44 int
45 getNoNextHop()
46 {
47 return m_NO_NEXT_HOP;
48 }
49
50private:
51 void
52 calculateLsRoutingTable(Nlsr& pnlsr);
53
54 void
55 calculateHypRoutingTable(Nlsr& pnlsr);
56
57 void
58 calculateHypDryRoutingTable(Nlsr& pnlsr);
59
60 void
61 clearRoutingTable();
62
63 void
64 clearDryRoutingTable();
65
akmhoque674b0b12014-05-20 14:33:28 -050066 void
67 writeLog();
68
akmhoque53353462014-04-22 08:43:45 -050069 const int m_NO_NEXT_HOP;
70
71 std::list<RoutingTableEntry> m_rTable;
72 std::list<RoutingTableEntry> m_dryTable;
73};
74
75}//namespace nlsr
76
akmhoquefdbddb12014-05-02 18:35:19 -050077#endif //NLSR_ROUTING_TABLE_HPP