協議處于網絡層:
macAddr = arp->getMacAddr(netwAddr);
pkt->setControlInfo(new MacControlInfo(macAddr));

協議處于應用層
方法一:手動收集從網絡層送達的數據包,并用map記錄之
std::map<int, int> nbrNetwAddrs;
?NetwControlInfo* cInfo;
?cInfo = dynamic_cast<NetwControlInfo*> (msg->removeControlInfo());
?nbrNetwAddrs[src] = cInfo->getNetwAddr(); // 記錄鄰居的網絡層地址

發送時使用nbrNetwAddrs中的網絡層地址信息即可

方法二:使用omnet的層次模型直接可以獲得網絡層地址,但這樣就假定了應用層可以通過某種方法獲得網絡層地址,而協議并不關心
?int netwAddr = simulation.getModule(contact)->getParentModule()->getSubmodule("net")->getId();
?pkt->setControlInfo(new NetwControlInfo(netwAddr));