akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 1 | #ifndef NLSR_NPTE_HPP |
| 2 | #define NLSR_NPTE_HPP |
| 3 | |
| 4 | #include <list> |
| 5 | #include <utility> |
| 6 | #include "routing-table-entry.hpp" |
| 7 | |
| 8 | namespace nlsr { |
| 9 | |
| 10 | using namespace std; |
| 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 | : m_namePrefix() |
| 17 | , m_nhl() |
| 18 | { |
| 19 | } |
| 20 | |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 21 | NamePrefixTableEntry(string np) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 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 | |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 58 | NexthopList& |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 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 | |
| 73 | private: |
| 74 | std::string m_namePrefix; |
| 75 | std::list<RoutingTableEntry> m_rteList; |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 76 | NexthopList m_nhl; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | std::ostream& |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 80 | operator<<(std::ostream& os, NamePrefixTableEntry& npte); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 81 | |
| 82 | }//namespace nlsr |
| 83 | |
| 84 | #endif //NLSR_NPTE_HPP |