akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 1 | #ifndef NLSR_ROUTING_TABLE_ENTRY_HPP |
2 | #define NLSR_ROUTING_TABLE_ENTRY_HPP | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 3 | |
4 | #include <iostream> | ||||
5 | |||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 6 | #include "nexthop-list.hpp" |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 7 | |
8 | namespace nlsr { | ||||
9 | |||||
10 | class RoutingTableEntry | ||||
11 | { | ||||
12 | public: | ||||
13 | RoutingTableEntry() | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 14 | { |
15 | } | ||||
16 | |||||
17 | ~RoutingTableEntry() | ||||
18 | { | ||||
19 | } | ||||
20 | |||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 21 | RoutingTableEntry(const std::string& dest) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 22 | { |
23 | m_destination = dest; | ||||
24 | } | ||||
25 | |||||
26 | std::string | ||||
27 | getDestination() | ||||
28 | { | ||||
29 | return m_destination; | ||||
30 | } | ||||
31 | |||||
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 32 | NexthopList& |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 33 | getNexthopList() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 34 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 35 | return m_nexthopList; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 36 | } |
37 | |||||
38 | private: | ||||
39 | std::string m_destination; | ||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 40 | NexthopList m_nexthopList; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 41 | }; |
42 | |||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 43 | inline std::ostream& |
44 | operator<<(std::ostream& os, RoutingTableEntry& rte) | ||||
45 | { | ||||
46 | os << "Destination: " << rte.getDestination() << std::endl; | ||||
47 | os << "Nexthops: " << std::endl; | ||||
48 | int32_t i = 1; | ||||
49 | std::list<NextHop> nhl = rte.getNexthopList().getNextHops(); | ||||
50 | for (std::list<NextHop>::iterator it = nhl.begin(); | ||||
51 | it != nhl.end() ; it++, i++) | ||||
52 | { | ||||
53 | os << " Nexthop " << i << ": " << (*it) << std::endl; | ||||
54 | } | ||||
55 | return os; | ||||
56 | } | ||||
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 57 | |
58 | } //namespace nlsr | ||||
59 | |||||
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame^] | 60 | #endif //NLSR_ROUTING_TABLE_ENTRY_HPP |