I'm building an application that works directly on top of the IEEE
802.11 MAC. The application needs to know the MAC address of the NIC.
What is the best way to get that info from the application? Thanks in
advance.
Kind regards,
Antonio Grilo
_______________________________________________
OMNeT++ Mailing List
options: http://lists.omnetpp.org/mailman/listinfo/omnetpp-l
archive: http://www.omnetpp.org/listarchive/index.php
InterfaceTable *inet_ift;
inet_ift = InterfaceTableAccess ().get();
MACAddress mac;
for (int i = 0; i < inet_ift->numInterfaces(); i++)
{
mac = inet_ift->interfaceAt(i)->macAddress();
if (mac.equals(MACAddress ("00-00-00-00-00-01"))
break;
}
--------------------------------------------------
From: <antoni...@inov.pt>
Sent: Wednesday, April 23, 2008 1:48 AM
To: "OMNeT++ Discussion List" <omne...@omnetpp.org>
Subject: [omnetpp] How to know the MAC address in INET Fw
What if I don't have an interface table? I mean, I'm not using any
module related with IP Routing. Just the application on top of the MAC.
Regards,
Antonio
for example
module RadioHost
parameters:
gates:
in: radioIn;
submodules:
notificationBoard: NotificationBoard;
display: "p=60,70;i=block/control";
interfaceTable: InterfaceTable;
display: "p=60,150;i=block/table";
App: AppType;
display: "p=163,67;i=block/app";
wlan: Ieee80211;
display: "p=248,349;q=queue;i=block/ifcard";
mobility: mobilityType like BasicMobility;
display: "p=149,307;i=block/cogwheel";
connections nocheck:
App.tcpOut --> wlan.uppergateIn
App.In <-- wlan.uppergateOut;
wlan.uppergateOut --> networkLayer.ifIn[0];
wlan.uppergateIn <-- networkLayer.ifOut[0];
// connections to network outside
radioIn --> wlan.radioIn;
endmodule
If you see the Ieee80211Mac::initialize this method call to the
Ieee80211Mac::registerInterface method, and this method register the
interface inside for the InterfaceTable module
--------------------------------------------------
From: <antoni...@inov.pt>
Sent: Thursday, April 24, 2008 1:50 PM
To: <omne...@omnetpp.org>
Subject: Re: [omnetpp] How to know the MAC address in INET Fw
It gives an error in my application:
"Error in module (Ieee802Mac) throughput.cliHost[0].wlan.mac: User
error: addInterface(): interface must be connected to network layer's
ifIn[]/ifOut[] gates of the same index."
Antonio
> Sorry I forget to eliminate. :)
>
> This is only an example where the application layer sends the packets to the
> mac layer. It doesn't use the Arp or ip. The app must send the destination
> mac address to the mac layer. The routing must be in the app layer. But the
> question that is interest to you is where it's defined the InterfaceTable
> module.
>
>
> module RadioHost
> parameters:
> gates:
> in: radioIn;
> submodules:
> notificationBoard: NotificationBoard;
> display: "p=60,70;i=block/control";
> interfaceTable: InterfaceTable;
> display: "p=60,150;i=block/table";
> App: AppType;
> display: "p=163,67;i=block/app";
> wlan: Ieee80211;
> display: "p=248,349;q=queue;i=block/ifcard";
> mobility: mobilityType like BasicMobility;
> display: "p=149,307;i=block/cogwheel";
> connections nocheck:
> App.tcpOut --> wlan.uppergateIn
> App.In <-- wlan.uppergateOut;
> // connections to network outside
> radioIn --> wlan.radioIn;
> endmodule
>
to avoid this check edit the InterfaceTable.cc file
void InterfaceTable::addInterface(InterfaceEntry *entry, cModule *ifmod)
{
// check name is unique
if (interfaceByName(entry->name())!=NULL)
opp_error("addInterface(): interface '%s' already registered",
entry->name());
// insert
entry->_interfaceId = interfaces.size();
interfaces.push_back(entry);
// fill in networkLayerGateIndex, nodeOutputGateId, nodeInputGateId
if (ifmod)
discoverConnectingGates(entry, ifmod);
}
void InterfaceTable::addInterface(InterfaceEntry *entry, cModule *ifmod)
{
// check name is unique
if (interfaceByName(entry->name())!=NULL)
opp_error("addInterface(): interface '%s' already registered",
entry->name());
// insert
entry->_interfaceId = interfaces.size();
interfaces.push_back(entry);
// fill in networkLayerGateIndex, nodeOutputGateId, nodeInputGateId
// if (ifmod)
// discoverConnectingGates(entry, ifmod);
entry->setNetworkLayerGateIndex(0);
}
--------------------------------------------------
From: <antoni...@inov.pt>
Sent: Thursday, April 24, 2008 5:55 PM
To: "OMNeT++ Discussion List" <omne...@omnetpp.org>
Subject: Re: [omnetpp] How to know the MAC address in INET Fw
> Dear Alfonso,
This is only an example where the application layer sends the packets to the
mac layer. It doesn't use the Arp or ip. The app must send the destination
mac address to the mac layer. The routing must be in the app layer. But the
question that is interest to you is where it's defined the InterfaceTable
module.
module RadioHost
parameters:
gates:
in: radioIn;
submodules:
notificationBoard: NotificationBoard;
display: "p=60,70;i=block/control";
interfaceTable: InterfaceTable;
display: "p=60,150;i=block/table";
App: AppType;
display: "p=163,67;i=block/app";
wlan: Ieee80211;
display: "p=248,349;q=queue;i=block/ifcard";
mobility: mobilityType like BasicMobility;
display: "p=149,307;i=block/cogwheel";
connections nocheck:
App.tcpOut --> wlan.uppergateIn
App.In <-- wlan.uppergateOut;
// connections to network outside
radioIn --> wlan.radioIn;
endmodule
>>
--------------------------------------------------
From: <antoni...@inov.pt>
Sent: Thursday, April 24, 2008 4:47 PM
--------------------------------------------------
From: <antoni...@inov.pt>
Sent: Thursday, April 24, 2008 5:55 PM
To: "OMNeT++ Discussion List" <omne...@omnetpp.org>
Subject: Re: [omnetpp] How to know the MAC address in INET Fw
> Dear Alfonso,