blob: 0ee28fa3f27233d1b43b0ca921606fa20a5ec3b4 [file] [log] [blame]
akmhoquefdbddb12014-05-02 18:35:19 -05001#ifndef NLSR_NAME_PREFIX_TABLE_ENTRY_HPP
2#define NLSR_NAME_PREFIX_TABLE_ENTRY_HPP
akmhoque53353462014-04-22 08:43:45 -05003
4#include <list>
5#include <utility>
akmhoquefdbddb12014-05-02 18:35:19 -05006#include <boost/cstdint.hpp>
7
akmhoque53353462014-04-22 08:43:45 -05008#include "routing-table-entry.hpp"
9
10namespace nlsr {
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 {
17 }
18
akmhoquefdbddb12014-05-02 18:35:19 -050019 NamePrefixTableEntry(const std::string& namePrefix)
20 : m_nexthopList()
akmhoque53353462014-04-22 08:43:45 -050021 {
akmhoquefdbddb12014-05-02 18:35:19 -050022 m_namePrefix = namePrefix;
akmhoque53353462014-04-22 08:43:45 -050023 }
24
akmhoquefdbddb12014-05-02 18:35:19 -050025 const std::string&
26 getNamePrefix() const
akmhoque53353462014-04-22 08:43:45 -050027 {
28 return m_namePrefix;
29 }
30
31 std::list<RoutingTableEntry>&
32 getRteList()
33 {
34 return m_rteList;
35 }
36
37 void
38 resetRteListNextHop()
39 {
40 if (m_rteList.size() > 0)
41 {
42 for (std::list<RoutingTableEntry>::iterator it = m_rteList.begin();
43 it != m_rteList.end(); ++it)
44 {
akmhoquefdbddb12014-05-02 18:35:19 -050045 (*it).getNexthopList().reset();
akmhoque53353462014-04-22 08:43:45 -050046 }
47 }
48 }
49
akmhoquefdbddb12014-05-02 18:35:19 -050050 size_t
akmhoque53353462014-04-22 08:43:45 -050051 getRteListSize()
52 {
53 return m_rteList.size();
54 }
55
akmhoquec8a10f72014-04-25 18:42:55 -050056 NexthopList&
akmhoquefdbddb12014-05-02 18:35:19 -050057 getNexthopList()
akmhoque53353462014-04-22 08:43:45 -050058 {
akmhoquefdbddb12014-05-02 18:35:19 -050059 return m_nexthopList;
akmhoque53353462014-04-22 08:43:45 -050060 }
61
62 void
63 generateNhlfromRteList();
64
65 void
66 removeRoutingTableEntry(RoutingTableEntry& rte);
67
68 void
69 addRoutingTableEntry(RoutingTableEntry& rte);
70
71private:
72 std::string m_namePrefix;
73 std::list<RoutingTableEntry> m_rteList;
akmhoquefdbddb12014-05-02 18:35:19 -050074 NexthopList m_nexthopList;
akmhoque53353462014-04-22 08:43:45 -050075};
76
77std::ostream&
akmhoquec8a10f72014-04-25 18:42:55 -050078operator<<(std::ostream& os, NamePrefixTableEntry& npte);
akmhoque53353462014-04-22 08:43:45 -050079
80}//namespace nlsr
81
akmhoquefdbddb12014-05-02 18:35:19 -050082#endif //NLSR_NAME_PREFIX_TABLE_ENTRY_HPP