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 | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 19 | NamePrefixTableEntry(const std::string& namePrefix) |
20 | : m_nexthopList() | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 21 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 22 | m_namePrefix = namePrefix; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 23 | } |
24 | |||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 25 | const std::string& |
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 | { | ||||
40 | if (m_rteList.size() > 0) | ||||
41 | { | ||||
42 | for (std::list<RoutingTableEntry>::iterator it = m_rteList.begin(); | ||||
43 | it != m_rteList.end(); ++it) | ||||
44 | { | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 45 | (*it).getNexthopList().reset(); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 46 | } |
47 | } | ||||
48 | } | ||||
49 | |||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 50 | size_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 51 | getRteListSize() |
52 | { | ||||
53 | return m_rteList.size(); | ||||
54 | } | ||||
55 | |||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 56 | NexthopList& |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 57 | getNexthopList() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 58 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 59 | return m_nexthopList; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 60 | } |
61 | |||||
62 | void | ||||
63 | generateNhlfromRteList(); | ||||
64 | |||||
65 | void | ||||
66 | removeRoutingTableEntry(RoutingTableEntry& rte); | ||||
67 | |||||
68 | void | ||||
69 | addRoutingTableEntry(RoutingTableEntry& rte); | ||||
70 | |||||
71 | private: | ||||
72 | std::string m_namePrefix; | ||||
73 | std::list<RoutingTableEntry> m_rteList; | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 74 | NexthopList m_nexthopList; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 75 | }; |
76 | |||||
77 | std::ostream& | ||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 78 | operator<<(std::ostream& os, NamePrefixTableEntry& npte); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 79 | |
80 | }//namespace nlsr | ||||
81 | |||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 82 | #endif //NLSR_NAME_PREFIX_TABLE_ENTRY_HPP |