akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 1 | #ifndef NLSR_NPTE_HPP |
2 | #define NLSR_NPTE_HPP | ||||
3 | |||||
4 | #include <list> | ||||
5 | #include <utility> | ||||
6 | #include "nlsr_rte.hpp" | ||||
7 | |||||
8 | namespace nlsr | ||||
9 | { | ||||
10 | |||||
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 11 | using namespace std; |
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 12 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 13 | class Npte |
14 | { | ||||
15 | public: | ||||
16 | Npte() | ||||
17 | : namePrefix() | ||||
18 | , nhl() | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 19 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 20 | } |
21 | Npte(string np) | ||||
22 | : nhl() | ||||
23 | { | ||||
24 | namePrefix=np; | ||||
25 | } | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 26 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 27 | 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 ) | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 43 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 44 | (*it).getNhl().resetNhl(); |
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 45 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 46 | } |
47 | } | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 48 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 49 | int getRteListSize() |
50 | { | ||||
51 | return rteList.size(); | ||||
52 | } | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 53 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 54 | Nhl& getNhl() |
55 | { | ||||
56 | return nhl; | ||||
57 | } | ||||
58 | void generateNhlfromRteList(); | ||||
59 | void removeRoutingTableEntry(RoutingTableEntry& rte); | ||||
60 | void addRoutingTableEntry(RoutingTableEntry &rte); | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 61 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 62 | private: |
63 | string namePrefix; | ||||
64 | std::list<RoutingTableEntry> rteList; | ||||
65 | Nhl nhl; | ||||
66 | }; | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 67 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 68 | ostream& |
69 | operator<<(ostream& os, Npte& npte); | ||||
akmhoque | ba09474 | 2014-02-28 11:47:21 -0600 | [diff] [blame] | 70 | |
71 | }//namespace nlsr | ||||
72 | |||||
73 | #endif |