33 portQoS[port] = qosId;
34 neighbours[qosId][dst].insert(port);
35 int lat = dstLat[dst];
37 fwd->setPortDelay(port, dstDLat[dst]);
44 if(neighbours[qosId][dst].size() == 1){
45 if(urgentQoS.find(qosId) != urgentQoS.end()) {
46 rt->insertFlow(addr, dst, qosId, lat);
48 rt->insertFlow(addr, dst, qosId, 1);
54 neighbours[qosId][dst].insert(port);
55 if(neighbours[qosId][dst].size() == 1){
56 if(urgentQoS.find(qosId) != urgentQoS.end()) {
57 rt->insertFlow(addr, dst, qosId, lat);
59 rt->insertFlow(addr, dst, qosId, 1);
66 string qosId = portQoS[port];
67 neighbours[qosId][dst].erase(port);
68 if(neighbours[qosId][dst].size() <= 0){
69 rt->removeFlow(addr, dst, qosId);
70 neighbours[qosId].erase(dst);
71 if(neighbours[qosId].size()<=0) {
72 neighbours.erase(qosId);
78 neighbours[qosId][dst].erase(port);
79 if(neighbours[qosId][dst].size() <= 0){
80 rt->removeFlow(addr, dst, qosId);
81 neighbours[qosId].erase(dst);
82 if(neighbours[qosId].size()<=0) {
83 neighbours.erase(qosId);
93 map<string, map<string, nhLMetric<mType> > > changes = rt->getChanges();
95 for(
const auto & qosEntries : changes){
96 string qosId = qosEntries.first;
97 for(
const auto & entry : qosEntries.second){
98 std::vector< RMTPort * > ps;
99 for(
string nextHop : entry.second.nh){
102 auto n = neighbours[qosId].find(nextHop);
103 if(n != neighbours[qosId].end()){
104 if(!n->second.empty()) {
105 p = *(n->second.begin());
113 fwd->addReplace(entry.first, qosId, ps);
115 for(
auto qId : qIds) {
116 qId->setDistance(entry.first, qosId, INT_MAX);
119 for(
auto qId : qIds) {
120 qId->setDistance(entry.first, qosId, entry.second.metric);
131 (getModuleByPath(
"^.^.relayAndMux.pduForwardingPolicy"));
133 (getModuleByPath(
"^.^.routingPolicy"));
135 difA = check_and_cast<
DA *>(getModuleByPath(
"^.^.^.difAllocator.da"));
137 mType infMetric = par(
"infinite");
138 rt->setInfinite(infMetric);
140 maxLat = par(
"maxLat").longValue();
142 string myAddr = getModuleByPath(
"^.^")->par(
"ipcAddress").stringValue();
145 cXMLElement* Xml = NULL;
146 if (par(
"data").xmlValue() != NULL && par(
"data").xmlValue()->hasChildren()){
147 Xml = par(
"data").xmlValue();
151 cXMLElementList QoSs = Xml->getChildrenByTagName(
"Qos");
152 for(
auto qos : QoSs){
153 if (!qos->getAttribute(
"id")) { error(
"Error. ID is missing!"); }
154 std::string
id = qos->getAttribute(
"id");
155 if (
id==
"") { error(
"Error. ID cannot be empty!"); }
157 if (!qos->getAttribute(
"urgent")) {
continue; }
158 urgentQoS.insert(
id);
161 double latMultip = par(
"latMultip").doubleValue();
163 cXMLElementList Links = Xml->getChildrenByTagName(
"Link");
164 for(
auto link : Links){
165 if (!link->getAttribute(
"src")) { error(
"Error. Addr is missing!"); }
166 std::string src = link->getAttribute(
"src");
167 if (src==
"") { error(
"Error. Addr cannot be empty!"); }
169 if (!link->getAttribute(
"dst")) { error(
"Error. Addr is missing!"); }
170 std::string dst = link->getAttribute(
"dst");
171 if (dst==
"") { error(
"Error. Addr cannot be empty!"); }
174 if (!link->getAttribute(
"l")) { error(
"Error. Latency is missing!"); }
175 double l = atof(link->getAttribute(
"l"));
176 if (l < 0.0) { error(
"Error. Latency cannot be < 0"); }
177 int lat = l*latMultip;
178 if (lat > maxLat) { lat = maxLat; }
180 if(src == myAddr) { dstLat[dst] = lat; dstDLat[dst] = l/1000.0; }
181 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 routingUpdated()
void unregisterQidsGen(IDPerNQoSxPLen *qId)
virtual void removedFlow(const Address &addr, const QoSCube &qos, RMTPort *port)
void registerQidsGen(IDPerNQoSxPLen *qId)
virtual void insertedFlow(const Address &addr, const QoSCube &qos, RMTPort *port)
Register_Class(PLQoSAwareMEntries)
Class representing QoSCube with all its properties that is primarily used by FA, RMT and RA Specifica...
std::string getQosId() const
Gets QoSCube identifier.
const std::string & getName() const
Gets APN string name representation.
Address class holds IPC Process identification.
virtual void onPolicyInit()