How to access the interface table and find the node ip address

481 views
Skip to first unread message

Sandra Smith

unread,
Jul 7, 2011, 1:10:14 PM7/7/11
to omnetpp
Hello All,

I am using the example which is available at "inetmanet/examples/
adhoc/net80211_aodv"

I want to access the interface table to find the node ip address.
Can someone please let me know how to access those.

Please let me know if anyone has an idea about it.

Thanks
Sandra

Ariff

unread,
Jul 7, 2011, 9:34:25 PM7/7/11
to omnetpp
Hi sandra,

maybe you could refer to this link:
http://groups.google.com/group/omnetpp/browse_thread/thread/229e7944131ae8c/5c3b5d679af327fd#5c3b5d679af327fd

I wrote the question, but I found out the answer later.
I'm really new to OMNET and INETMANET, so, I'm not sure whether my
this might help or not.

I think you can subscribe to the NotificationBoard, using similar code
from the link that I gave you. But I'm not sure which one to subscribe
to obtain the node IP address.


good luck.
regards,
ariff

Alfonso Ariza Quintana

unread,
Jul 8, 2011, 4:11:11 AM7/8/11
to omn...@googlegroups.com
#include "InterfaceTableAccess.h"
IInterfaceTable *inet_ift;   
inet_ift
= InterfaceTableAccess ().get();
> Date: Thu, 7 Jul 2011 10:10:14 -0700
> Subject: [Omnetpp-l] How to access the interface table and find the node ip address
> From: sandras...@gmail.com
> To: omn...@googlegroups.com
> --
> You received this message because you are subscribed to the Google Groups "omnetpp" group.
> To post to this group, send email to omn...@googlegroups.com.
> To unsubscribe from this group, send email to omnetpp+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/omnetpp?hl=en.
>

Sandra Smith

unread,
Jul 8, 2011, 2:52:48 PM7/8/11
to omnetpp
Hello Alfonso,

Thanks for your reply. How to use the second and 3rd lines of the
code that you mentioned below??



Sandra

On Jul 8, 4:11 am, Alfonso Ariza Quintana <aariza...@hotmail.com>
wrote:
> #include "InterfaceTableAccess.h"
> IInterfaceTable *inet_ift;    
> inet_ift = InterfaceTableAccess ().get();> Date: Thu, 7 Jul 2011 10:10:14 -0700
>
>
>
>
>
>
>
> > Subject: [Omnetpp-l] How to access the interface table and find the node ip address
> > From: sandrasmith1...@gmail.com
Message has been deleted

Alfonso Ariza Quintana

unread,
Jul 10, 2011, 5:51:14 PM7/10/11
to omn...@googlegroups.com
you should consult the methods of the interface table
http://inet.omnetpp.org/doc/INET/doxy/class_interface_table.html
http://inet.omnetpp.org/doc/INET/doxy/class_interface_entry.html


if you execute in the shell the command
grep -r InterfaceTableAccess *

in the src directory, you can find the files where the InterfaceTable is used and you can see how to use the table

> Date: Fri, 8 Jul 2011 11:52:48 -0700
> Subject: [Omnetpp-l] Re: How to access the interface table and find the node ip address
> From: sandras...@gmail.com
> To: omn...@googlegroups.com

Ariff

unread,
Jul 24, 2011, 9:50:44 AM7/24/11
to omnetpp
Hello alfonso,

I tried the code that you gave. but I got some error. please help. the
codes that i used is as follows:

IInterfaceTable *inet_ift;
inet_ift = InterfaceTableAccess().get();

for (int32 i=0; i<inet_ift->getNumInterfaces(); ++i)
{
if (inet_ift->getInterface(i)->ipv4Data()!=NULL)
{
ev << "interface: "<<inet_ift->getInterface(i)->ipv4Data()-
>getIPAddress()<< endl;
}
}

but i got this error:

Description
Resource Path
Location Type

forward declaration of 'struct IPv4InterfaceData' InterfaceEntry.h /
inetmanet/src/networklayer/common line 34 C/C++ Problem

invalid use of incomplete type 'struct IPv4InterfaceData' SCTP.cc /
inetmanet/src/transport/sctp line 897 C/C++ Problem

make: *** [all] Error
2
inetmanet line 0 C/C++ Problem

make[1]: *** [../out/gcc-debug/src/transport/sctp/SCTP.o] Error 1
inetmanet line 0 C/C++ Problem



On Jul 11, 6:51 am, Alfonso Ariza Quintana <aariza...@hotmail.com>
wrote:
> you should consult the methods of the interface tablehttp://inet.omnetpp.org/doc/INET/doxy/class_interface_table.htmlhttp://inet.omnetpp.org/doc/INET/doxy/class_interface_entry.html
>
> if you execute in the shell the command
> grep -r InterfaceTableAccess *
>
> in the src directory, you can find the files where the InterfaceTable is used and you can see how to use the table
>
>
>
>
>
>
>
> > Date: Fri, 8 Jul 2011 11:52:48 -0700
> > Subject: [Omnetpp-l] Re: How to access the interface table and find the node ip address
> > From: sandrasmith1...@gmail.com

Alfonso Ariza Quintana

unread,
Jul 25, 2011, 4:33:15 AM7/25/11
to omn...@googlegroups.com
You have forget to include a header file

#include "IPv4InterfaceData.h"
#include "IInterfaceTable.h"
#include "InterfaceTableAccess.h"

-----Mensaje original-----
From: Ariff
Sent: Sunday, July 24, 2011 3:50 PM
To: omnetpp

Reply all
Reply to author
Forward
0 new messages