blob: 7f4f83a1adff998b1196e6030e9de5587d40b160 [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
akmhoquec8a10f72014-04-25 18:42:55 -050012class NamePrefixTableEntry
akmhoque53353462014-04-22 08:43:45 -050013{
14public:
akmhoquec8a10f72014-04-25 18:42:55 -050015 NamePrefixTableEntry()
akmhoque53353462014-04-22 08:43:45 -050016 : m_namePrefix()
17 , m_nhl()
18 {
19 }
20
akmhoquec8a10f72014-04-25 18:42:55 -050021 NamePrefixTableEntry(string np)
akmhoque53353462014-04-22 08:43:45 -050022 : 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
akmhoquec8a10f72014-04-25 18:42:55 -050058 NexthopList&
akmhoque53353462014-04-22 08:43:45 -050059 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;
akmhoquec8a10f72014-04-25 18:42:55 -050076 NexthopList m_nhl;
akmhoque53353462014-04-22 08:43:45 -050077};
78
79std::ostream&
akmhoquec8a10f72014-04-25 18:42:55 -050080operator<<(std::ostream& os, NamePrefixTableEntry& npte);
akmhoque53353462014-04-22 08:43:45 -050081
82}//namespace nlsr
83
84#endif //NLSR_NPTE_HPP