blob: 57fdfec20cf56df54345cb3641012cbb05e13e0c [file] [log] [blame]
akmhoque53353462014-04-22 08:43:45 -05001#ifndef NLSR_NPTE_HPP
2#define NLSR_NPTE_HPP
3
4#include <list>
5#include <utility>
6#include "routing-table-entry.hpp"
7
8namespace nlsr {
9
10using namespace std;
11
12class Npte
13{
14public:
15 Npte()
16 : m_namePrefix()
17 , m_nhl()
18 {
19 }
20
21 Npte(string np)
22 : m_nhl()
23 {
24 m_namePrefix = np;
25 }
26
27 std::string
28 getNamePrefix()
29 {
30 return m_namePrefix;
31 }
32
33 std::list<RoutingTableEntry>&
34 getRteList()
35 {
36 return m_rteList;
37 }
38
39 void
40 resetRteListNextHop()
41 {
42 if (m_rteList.size() > 0)
43 {
44 for (std::list<RoutingTableEntry>::iterator it = m_rteList.begin();
45 it != m_rteList.end(); ++it)
46 {
47 (*it).getNhl().reset();
48 }
49 }
50 }
51
52 int
53 getRteListSize()
54 {
55 return m_rteList.size();
56 }
57
58 Nhl&
59 getNhl()
60 {
61 return m_nhl;
62 }
63
64 void
65 generateNhlfromRteList();
66
67 void
68 removeRoutingTableEntry(RoutingTableEntry& rte);
69
70 void
71 addRoutingTableEntry(RoutingTableEntry& rte);
72
73private:
74 std::string m_namePrefix;
75 std::list<RoutingTableEntry> m_rteList;
76 Nhl m_nhl;
77};
78
79std::ostream&
80operator<<(std::ostream& os, Npte& npte);
81
82}//namespace nlsr
83
84#endif //NLSR_NPTE_HPP