blob: bb4b1c859ab06cbccf07b10271578ce03fa921a0 [file] [log] [blame]
akmhoqueba094742014-02-28 11:47:21 -06001#ifndef NLSR_NPTE_HPP
2#define NLSR_NPTE_HPP
3
4#include <list>
5#include <utility>
6#include "nlsr_rte.hpp"
7
8namespace nlsr
9{
10
akmhoque5a44dd42014-03-12 18:11:32 -050011 using namespace std;
akmhoqueba094742014-02-28 11:47:21 -060012
akmhoque5a44dd42014-03-12 18:11:32 -050013 class Npte
14 {
15 public:
16 Npte()
akmhoque05d5fcf2014-04-15 14:58:45 -050017 : m_namePrefix()
18 , m_nhl()
akmhoqueba094742014-02-28 11:47:21 -060019 {
akmhoque5a44dd42014-03-12 18:11:32 -050020 }
21 Npte(string np)
akmhoque05d5fcf2014-04-15 14:58:45 -050022 : m_nhl()
akmhoque5a44dd42014-03-12 18:11:32 -050023 {
akmhoque05d5fcf2014-04-15 14:58:45 -050024 m_namePrefix=np;
akmhoque5a44dd42014-03-12 18:11:32 -050025 }
akmhoqueba094742014-02-28 11:47:21 -060026
akmhoque5a44dd42014-03-12 18:11:32 -050027 string getNamePrefix()
28 {
akmhoque05d5fcf2014-04-15 14:58:45 -050029 return m_namePrefix;
akmhoque5a44dd42014-03-12 18:11:32 -050030 }
31
32 std::list<RoutingTableEntry>& getRteList()
33 {
akmhoque05d5fcf2014-04-15 14:58:45 -050034 return m_rteList;
akmhoque5a44dd42014-03-12 18:11:32 -050035 }
36
37 void resetRteListNextHop()
38 {
akmhoque05d5fcf2014-04-15 14:58:45 -050039 if (m_rteList.size() > 0 )
akmhoque5a44dd42014-03-12 18:11:32 -050040 {
akmhoque05d5fcf2014-04-15 14:58:45 -050041 for( std::list<RoutingTableEntry>::iterator it=m_rteList.begin();
42 it != m_rteList.end(); ++it )
akmhoqueba094742014-02-28 11:47:21 -060043 {
akmhoque05d5fcf2014-04-15 14:58:45 -050044 (*it).getNhl().reset();
akmhoqueba094742014-02-28 11:47:21 -060045 }
akmhoque5a44dd42014-03-12 18:11:32 -050046 }
47 }
akmhoqueba094742014-02-28 11:47:21 -060048
akmhoque5a44dd42014-03-12 18:11:32 -050049 int getRteListSize()
50 {
akmhoque05d5fcf2014-04-15 14:58:45 -050051 return m_rteList.size();
akmhoque5a44dd42014-03-12 18:11:32 -050052 }
akmhoqueba094742014-02-28 11:47:21 -060053
akmhoque5a44dd42014-03-12 18:11:32 -050054 Nhl& getNhl()
55 {
akmhoque05d5fcf2014-04-15 14:58:45 -050056 return m_nhl;
akmhoque5a44dd42014-03-12 18:11:32 -050057 }
58 void generateNhlfromRteList();
59 void removeRoutingTableEntry(RoutingTableEntry& rte);
60 void addRoutingTableEntry(RoutingTableEntry &rte);
akmhoqueba094742014-02-28 11:47:21 -060061
akmhoque5a44dd42014-03-12 18:11:32 -050062 private:
akmhoque05d5fcf2014-04-15 14:58:45 -050063 string m_namePrefix;
64 std::list<RoutingTableEntry> m_rteList;
65 Nhl m_nhl;
akmhoque5a44dd42014-03-12 18:11:32 -050066 };
akmhoqueba094742014-02-28 11:47:21 -060067
akmhoque5a44dd42014-03-12 18:11:32 -050068 ostream&
69 operator<<(ostream& os, Npte& npte);
akmhoqueba094742014-02-28 11:47:21 -060070
71}//namespace nlsr
72
73#endif