RINASim  October 2016
Documentation of framework for OMNeT++
PSTLatOrHopMEntries.cc
Go to the documentation of this file.
1 //
2 // This program is free software: you can redistribute it and/or modify
3 // it under the terms of the GNU Lesser General Public License as published by
4 // the Free Software Foundation, either version 3 of the License, or
5 // (at your option) any later version.
6 //
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public License
13 // along with this program. If not, see http://www.gnu.org/licenses/.
14 //
15 
16 #include <PSTLatOrHopMEntries.h>
17 #include "APN.h"
18 #include "IDPerNQoSxPLen.h"
19 
20 
21 
23 
25 
26 using namespace std;
27 using namespace common_GraphCL;
28 
29 //Routing has processes a routing update
31  map<string, map<string, nhLMetric<mType> > > changes = rt->getChanges();
32 
33  for(const auto & qosEntries : changes){
34  bool lat = qosEntries.first == "lat";
35  for(const auto & entry : qosEntries.second){
36  std::vector< RMTPort * > ps;
37  for(string nextHop : entry.second.nh){
38  if(nextHop != "") {
39  if(!neighbours[nextHop].empty()) {
40  ps.push_back(*neighbours[nextHop].begin());
41  }
42  }
43  }
44 
45  if(lat) {
46  for(auto & qos : latQoS) {
47  fwd->addReplace(entry.first, qos, ps);
48  if(ps.empty()) {
49  for(auto qId : qIds) {
50  qId->setDistance(entry.first, qos, INT_MAX);
51  }
52  } else {
53  for(auto qId : qIds) {
54  qId->setDistance(entry.first, qos, entry.second.metric);
55  }
56  }
57  }
58  } else {
59  for(auto & qos : hopQoS) {
60  fwd->addReplace(entry.first, qos, ps);
61  if(ps.empty()) {
62  for(auto qId : qIds) {
63  qId->setDistance(entry.first, qos, INT_MAX);
64  }
65  } else {
66  for(auto qId : qIds) {
67  qId->setDistance(entry.first, qos, entry.second.metric);
68  }
69  }
70  }
71  }
72  }
73  }
74 }
75 
76 }
Register_Class(PSTLatOrHopMEntries)