Skip to content
This repository has been archived by the owner on Oct 20, 2018. It is now read-only.

Commit

Permalink
Fix broadcast transmitter (IP layer drop pkg)
Browse files Browse the repository at this point in the history
Specify out interface for IP layer
  • Loading branch information
ZiroKyl committed May 17, 2017
1 parent 0fef1f5 commit dbd654f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion inet/src/inet/applications/lltrapp/LLTRSuperApp.cc
Expand Up @@ -2,6 +2,7 @@
//

#include "inet/common/INETDefs.h"
#include "inet/common/ModuleAccess.h"
#include "inet/transportlayer/contract/udp/UDPSocket.h"

namespace inet {
Expand All @@ -10,6 +11,7 @@ class INET_API LLTRSuperApp: public cSimpleModule
{
int port = -1;

UDPSocket::SendOptions udpSendOpt;
UDPSocket socket;

/*=================================================================================*/
Expand All @@ -32,9 +34,18 @@ class INET_API LLTRSuperApp: public cSimpleModule
socket.setOutputGate(gate("udpOut"));
socket.setTimeToLive(1);

{
//IInterfaceTable *inet_ift = L3AddressResolver().findInterfaceTableOf(getParentModule());
//IInterfaceTable *inet_ift = check_and_cast<IInterfaceTable*>(getParentModule()->getModuleByPath(".interfaceTable"));
IInterfaceTable *inet_ift = getModuleFromPar<IInterfaceTable>(par("interfaceTableModule"), this);

udpSendOpt.outInterfaceId = inet_ift->getBiggestInterfaceId();
udpSendOpt.srcAddr = inet_ift->getInterfaceById(udpSendOpt.outInterfaceId)->getNetworkAddress();
}

break;
case INITSTAGE_LAST:
socket.sendTo(new cPacket("=Broadcast Packet="), IPv4Address(10,0,1,7), port);
socket.sendTo(new cPacket("=Broadcast Packet="), IPv4Address::ALLONES_ADDRESS, port, &udpSendOpt);

break;
}
Expand Down
1 change: 1 addition & 0 deletions inet/src/inet/applications/lltrapp/LLTRSuperApp.ned
Expand Up @@ -6,6 +6,7 @@ import inet.applications.contract.IUDPApp;
simple LLTRSuperApp like IUDPApp
{
parameters:
string interfaceTableModule; // The path to the InterfaceTable module
int port;

@display("i=block/app");
Expand Down

0 comments on commit dbd654f

Please sign in to comment.