blob: 3dfa04a586b4a3c049daa20992278c5beadbf2d2 [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()
17 : namePrefix()
18 , nhl()
akmhoqueba094742014-02-28 11:47:21 -060019 {
akmhoque5a44dd42014-03-12 18:11:32 -050020 }
21 Npte(string np)
22 : nhl()
23 {
24 namePrefix=np;
25 }
akmhoqueba094742014-02-28 11:47:21 -060026
akmhoque5a44dd42014-03-12 18:11:32 -050027 string getNamePrefix()
28 {
29 return namePrefix;
30 }
31
32 std::list<RoutingTableEntry>& getRteList()
33 {
34 return rteList;
35 }
36
37 void resetRteListNextHop()
38 {
39 if (rteList.size() > 0 )
40 {
41 for( std::list<RoutingTableEntry>::iterator it=rteList.begin();
42 it != rteList.end(); ++it )
akmhoqueba094742014-02-28 11:47:21 -060043 {
akmhoque5a44dd42014-03-12 18:11:32 -050044 (*it).getNhl().resetNhl();
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 {
51 return rteList.size();
52 }
akmhoqueba094742014-02-28 11:47:21 -060053
akmhoque5a44dd42014-03-12 18:11:32 -050054 Nhl& getNhl()
55 {
56 return nhl;
57 }
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:
63 string namePrefix;
64 std::list<RoutingTableEntry> rteList;
65 Nhl nhl;
66 };
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