blob: ce26f59a9945826dce3bc2bdc798c5b0b51ec2d1 [file] [log] [blame]
akmhoquefdbddb12014-05-02 18:35:19 -05001#ifndef NLSR_ROUTING_TABLE_ENTRY_HPP
2#define NLSR_ROUTING_TABLE_ENTRY_HPP
akmhoque53353462014-04-22 08:43:45 -05003
4#include <iostream>
akmhoque31d1d4b2014-05-05 22:08:14 -05005#include <ndn-cxx/name.hpp>
akmhoquec8a10f72014-04-25 18:42:55 -05006#include "nexthop-list.hpp"
akmhoque53353462014-04-22 08:43:45 -05007
8namespace nlsr {
9
10class RoutingTableEntry
11{
12public:
13 RoutingTableEntry()
akmhoque53353462014-04-22 08:43:45 -050014 {
15 }
16
17 ~RoutingTableEntry()
18 {
19 }
20
akmhoque31d1d4b2014-05-05 22:08:14 -050021 RoutingTableEntry(const ndn::Name& dest)
akmhoque53353462014-04-22 08:43:45 -050022 {
23 m_destination = dest;
24 }
25
akmhoque31d1d4b2014-05-05 22:08:14 -050026 const ndn::Name&
27 getDestination() const
akmhoque53353462014-04-22 08:43:45 -050028 {
29 return m_destination;
30 }
31
akmhoquec8a10f72014-04-25 18:42:55 -050032 NexthopList&
akmhoquefdbddb12014-05-02 18:35:19 -050033 getNexthopList()
akmhoque53353462014-04-22 08:43:45 -050034 {
akmhoquefdbddb12014-05-02 18:35:19 -050035 return m_nexthopList;
akmhoque53353462014-04-22 08:43:45 -050036 }
37
38private:
akmhoque31d1d4b2014-05-05 22:08:14 -050039 ndn::Name m_destination;
akmhoquefdbddb12014-05-02 18:35:19 -050040 NexthopList m_nexthopList;
akmhoque53353462014-04-22 08:43:45 -050041};
42
akmhoquefdbddb12014-05-02 18:35:19 -050043inline std::ostream&
44operator<<(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();
akmhoque157b0a42014-05-13 00:26:37 -050051 it != nhl.end() ; it++, i++) {
akmhoquefdbddb12014-05-02 18:35:19 -050052 os << " Nexthop " << i << ": " << (*it) << std::endl;
53 }
54 return os;
55}
akmhoque53353462014-04-22 08:43:45 -050056
57} //namespace nlsr
58
akmhoquefdbddb12014-05-02 18:35:19 -050059#endif //NLSR_ROUTING_TABLE_ENTRY_HPP