在有线模拟中使用AODV

时间:2017-03-02 17:46:17

标签: omnet++ inet

我正在尝试在有线模拟中使用AODV,但我无法使其工作,是否可以通过线路连接2个AODVRouters并使用AODV协议?或者我应该使用2个标准主机并修改AODVrouting.cc ??

编辑: 我只使用标准主机而不是AODVrouter来模拟AODV simpleRREQ示例,并使用调试模式在这段代码中崩溃:

void AODVRouting::sendAODVPacket(AODVControlPacket *packet, const L3Address& destAddr, unsigned int timeToLive, double delay)
{INetworkProtocolControlInfo *networkProtocolControlInfo = addressType->createNetworkProtocolControlInfo();

networkProtocolControlInfo->setHopLimit(timeToLive);

networkProtocolControlInfo->setTransportProtocol(IP_PROT_MANET);
networkProtocolControlInfo->setDestinationAddress(destAddr);
networkProtocolControlInfo->setSourceAddress(getSelfIPAddress());

// TODO: Implement: support for multiple interfaces

InterfaceEntry *ifEntry = interfaceTable->getInterfaceByName("AODV");
networkProtocolControlInfo->setInterfaceId(ifEntry->getInterfaceId());

UDPPacket *udpPacket = new UDPPacket(packet->getName());
udpPacket->encapsulate(packet);
udpPacket->setSourcePort(aodvUDPPort);
udpPacket->setDestinationPort(aodvUDPPort);
udpPacket->setControlInfo(dynamic_cast<cObject *>(networkProtocolControlInfo));

if (destAddr.isBroadcast())
    lastBroadcastTime = simTime();

if (delay == 0)
    send(udpPacket, "ipOut");
else
    sendDelayed(udpPacket, delay, "ipOut");
}

如何发送AODV数据包抛出路由器的所有以太网端口?

0 个答案:

没有答案