blob: 13a31eaa40896299d0b4e73d897e8c8a09d8c84b [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
akmhoque31d1d4b2014-05-05 22:08:14 -050019 NamePrefixTableEntry(const ndn::Name& namePrefix)
20 : m_namePrefix(namePrefix)
21 , m_nexthopList()
akmhoque53353462014-04-22 08:43:45 -050022 {
akmhoque53353462014-04-22 08:43:45 -050023 }
24
akmhoque31d1d4b2014-05-05 22:08:14 -050025 const ndn::Name&
akmhoquefdbddb12014-05-02 18:35:19 -050026 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 {
akmhoque157b0a42014-05-13 00:26:37 -050040 if (m_rteList.size() > 0) {
akmhoque53353462014-04-22 08:43:45 -050041 for (std::list<RoutingTableEntry>::iterator it = m_rteList.begin();
akmhoque157b0a42014-05-13 00:26:37 -050042 it != m_rteList.end(); ++it) {
akmhoquefdbddb12014-05-02 18:35:19 -050043 (*it).getNexthopList().reset();
akmhoque53353462014-04-22 08:43:45 -050044 }
45 }
46 }
47
akmhoquefdbddb12014-05-02 18:35:19 -050048 size_t
akmhoque53353462014-04-22 08:43:45 -050049 getRteListSize()
50 {
51 return m_rteList.size();
52 }
53
akmhoquec8a10f72014-04-25 18:42:55 -050054 NexthopList&
akmhoquefdbddb12014-05-02 18:35:19 -050055 getNexthopList()
akmhoque53353462014-04-22 08:43:45 -050056 {
akmhoquefdbddb12014-05-02 18:35:19 -050057 return m_nexthopList;
akmhoque53353462014-04-22 08:43:45 -050058 }
59
60 void
61 generateNhlfromRteList();
62
63 void
64 removeRoutingTableEntry(RoutingTableEntry& rte);
65
66 void
67 addRoutingTableEntry(RoutingTableEntry& rte);
68
69private:
akmhoque31d1d4b2014-05-05 22:08:14 -050070 ndn::Name m_namePrefix;
akmhoque53353462014-04-22 08:43:45 -050071 std::list<RoutingTableEntry> m_rteList;
akmhoquefdbddb12014-05-02 18:35:19 -050072 NexthopList m_nexthopList;
akmhoque53353462014-04-22 08:43:45 -050073};
74
75std::ostream&
akmhoquec8a10f72014-04-25 18:42:55 -050076operator<<(std::ostream& os, NamePrefixTableEntry& npte);
akmhoque53353462014-04-22 08:43:45 -050077
78}//namespace nlsr
79
akmhoquefdbddb12014-05-02 18:35:19 -050080#endif //NLSR_NAME_PREFIX_TABLE_ENTRY_HPP