You received this message because you are subscribed to a topic in the Google Groups "omnetpp" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/omnetpp/uavPHeB-5P8/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to omnetpp+u...@googlegroups.com.
PosNode::PosNode()
{
// TODO Auto-generated constructor stub
// fill in routing tables with static routes
cTopology topo("topo");
topo.extractByProperty("node");
cModule *mod = dynamic_cast<cModule*> (getOwner());
for (mod = dynamic_cast<cModule*> (getOwner())->getParentModule(); mod != 0; mod = mod->getParentModule())
{
cProperties *properties = mod->getProperties();
if (properties && properties->getAsBool("node"))
break;
}
vectorList.clear();
for (int i = 0; i < topo.getNumNodes(); i++)
{
cTopology::Node *destNode = topo.getNode(i);
IMobility *mod;
mod = MobilityAccess().get(destNode->getModule());
if (mod == NULL)
opp_error("node or mobility module not found");
nodeInfo info;
info.mob = mod;
info.itable = IPvXAddressResolver().findInterfaceTableOf(destNode->getModule());
vectorList.push_back(info);
for (int j = 0 ; j < vectorList[i].itable->getNumInterfaces(); j++)
{
InterfaceEntry *e = vectorList[i].itable->getInterface(j);
if (e->getMacAddress().isUnspecified())
continue;
if (e->isLoopback())
continue;
related[e->getMacAddress()] = i;
IPv4Address adr = e->ipv4Data()->getIPAddress();
if (!adr.isUnspecified())
relatedIp [adr] = i;
}
}
}
int PosNode::getIdNode(const IPv4Address &add)
{
std::map<IPv4Address,int>::iterator it = relatedIp.find(add);
if (it != relatedIp.end())
return it->second;
opp_error("Node not found with IP Address %s", add.str().c_str());
return -1;
}
Coord PosNode::getIdNode(const IPv4Address &add)
{int modeId = getIdNode(add);
return vectorList[modeId].mob->getCurrentPosition();