32 neighbours[dst].insert(port);
33 int lat = dstLat[dst];
34 fwd->setPortDelay(port, dstDLat[dst]);
41 if(neighbours[dst].size() == 1){
42 rt->insertFlow(addr, dst,
"lat", lat);
43 rt->insertFlow(addr, dst,
"hops", 1);
50 neighbours[dst].erase(port);
51 if(neighbours[dst].size() <= 0){
52 rt->removeFlow(addr, dst,
"lat");
53 rt->removeFlow(addr, dst,
"hops");
54 neighbours.erase(dst);
61 map<string, map<string, nhLMetric<mType> > > changes = rt->getChanges();
63 for(
const auto & qosEntries : changes){
64 bool lat = qosEntries.first ==
"lat";
65 for(
const auto & entry : qosEntries.second){
66 std::vector< RMTPort * > ps;
67 for(
string nextHop : entry.second.nh){
69 if(!neighbours[nextHop].empty()) {
70 ps.push_back(*neighbours[nextHop].begin());
76 for(
auto & qos : latQoS) {
77 fwd->addReplace(entry.first, qos, ps);
80 for(
auto & qos : hopQoS) {
81 fwd->addReplace(entry.first, qos, ps);
92 (getModuleByPath(
"^.^.relayAndMux.pduForwardingPolicy"));
94 (getModuleByPath(
"^.^.routingPolicy"));
96 difA = check_and_cast<
DA *>(getModuleByPath(
"^.^.^.difAllocator.da"));
98 mType infMetric = par(
"infinite");
99 rt->setInfinite(infMetric);
101 maxLat = par(
"maxLat").longValue();
103 string myAddr = getModuleByPath(
"^.^")->par(
"ipcAddress").stringValue();
106 cXMLElement* Xml = NULL;
107 if (par(
"data").xmlValue() != NULL && par(
"data").xmlValue()->hasChildren()){
108 Xml = par(
"data").xmlValue();
112 cXMLElementList QoSs = Xml->getChildrenByTagName(
"Qos");
113 for(
auto qos : QoSs){
114 if (!qos->getAttribute(
"id")) { error(
"Error. ID is missing!"); }
115 std::string
id = qos->getAttribute(
"id");
116 if (
id==
"") { error(
"Error. ID cannot be empty!"); }
118 if (!qos->getAttribute(
"urgent")) {
125 double latMultip = par(
"latMultip").doubleValue();
127 cXMLElementList Links = Xml->getChildrenByTagName(
"Link");
128 for(
auto link : Links){
129 if (!link->getAttribute(
"src")) { error(
"Error. Addr is missing!"); }
130 std::string src = link->getAttribute(
"src");
131 if (src==
"") { error(
"Error. Addr cannot be empty!"); }
133 if (!link->getAttribute(
"dst")) { error(
"Error. Addr is missing!"); }
134 std::string dst = link->getAttribute(
"dst");
135 if (dst==
"") { error(
"Error. Addr cannot be empty!"); }
138 if (!link->getAttribute(
"l")) { error(
"Error. Latency is missing!"); }
139 double l = atof(link->getAttribute(
"l"));
140 if (l < 0.0) { error(
"Error. Latency cannot be < 0"); }
141 int lat = l*latMultip;
142 if (lat > maxLat) { lat = maxLat; }
144 if(src == myAddr) { dstLat[dst] = lat; dstDLat[dst] = l/1000.0; }
145 else if(dst == myAddr) { dstLat[src] = lat; dstDLat[src] = l/1000.0; }
const APN & getIpcAddress() const
Getter of IPC Process address which should be unambiguous within DIF.
virtual void onPolicyInit()
virtual void insertedFlow(const Address &addr, const QoSCube &qos, RMTPort *port)
virtual void routingUpdated()
Class representing QoSCube with all its properties that is primarily used by FA, RMT and RA Specifica...
virtual void removedFlow(const Address &addr, const QoSCube &qos, RMTPort *port)
const std::string & getName() const
Gets APN string name representation.
Address class holds IPC Process identification.
Register_Class(SimpleLatOrHopMEntries)