akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 1 | #ifndef NLSR_NAME_PREFIX_TABLE_ENTRY_HPP |
2 | #define NLSR_NAME_PREFIX_TABLE_ENTRY_HPP | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 3 | |
4 | #include <list> | ||||
5 | #include <utility> | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 6 | #include <boost/cstdint.hpp> |
7 | |||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 8 | #include "routing-table-entry.hpp" |
9 | |||||
10 | namespace nlsr { | ||||
11 | |||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 12 | class NamePrefixTableEntry |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 13 | { |
14 | public: | ||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 15 | NamePrefixTableEntry() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 16 | { |
17 | } | ||||
18 | |||||
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 19 | NamePrefixTableEntry(const ndn::Name& namePrefix) |
20 | : m_namePrefix(namePrefix) | ||||
21 | , m_nexthopList() | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 22 | { |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 23 | } |
24 | |||||
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 25 | const ndn::Name& |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 26 | getNamePrefix() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 27 | { |
28 | return m_namePrefix; | ||||
29 | } | ||||
30 | |||||
31 | std::list<RoutingTableEntry>& | ||||
32 | getRteList() | ||||
33 | { | ||||
34 | return m_rteList; | ||||
35 | } | ||||
36 | |||||
37 | void | ||||
38 | resetRteListNextHop() | ||||
39 | { | ||||
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame^] | 40 | if (m_rteList.size() > 0) { |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 41 | for (std::list<RoutingTableEntry>::iterator it = m_rteList.begin(); |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame^] | 42 | it != m_rteList.end(); ++it) { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 43 | (*it).getNexthopList().reset(); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 44 | } |
45 | } | ||||
46 | } | ||||
47 | |||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 48 | size_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 49 | getRteListSize() |
50 | { | ||||
51 | return m_rteList.size(); | ||||
52 | } | ||||
53 | |||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 54 | NexthopList& |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 55 | getNexthopList() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 56 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 57 | return m_nexthopList; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 58 | } |
59 | |||||
60 | void | ||||
61 | generateNhlfromRteList(); | ||||
62 | |||||
63 | void | ||||
64 | removeRoutingTableEntry(RoutingTableEntry& rte); | ||||
65 | |||||
66 | void | ||||
67 | addRoutingTableEntry(RoutingTableEntry& rte); | ||||
68 | |||||
69 | private: | ||||
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 70 | ndn::Name m_namePrefix; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 71 | std::list<RoutingTableEntry> m_rteList; |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 72 | NexthopList m_nexthopList; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 73 | }; |
74 | |||||
75 | std::ostream& | ||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 76 | operator<<(std::ostream& os, NamePrefixTableEntry& npte); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 77 | |
78 | }//namespace nlsr | ||||
79 | |||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 80 | #endif //NLSR_NAME_PREFIX_TABLE_ENTRY_HPP |