Passing a list of addresses to an Application

46 views
Skip to first unread message

Ivan Antoniv

unread,
Mar 20, 2014, 11:56:15 PM3/20/14
to ns-3-...@googlegroups.com
Hello,

I am relatively new to working with ns-3 so please bear with me if there is an obvious solution that I am not aware of.

I would like to pass a list of addresses (as opposed to simply one address as in most example I have found) to an application. If it is more convenient I can also pass an Ipv4InterfaceContainer.

note: I have looked around this board, but I could not find an answer :(
The closest discussion to this that I found was https://groups.google.com/forum/#!msg/ns-3-users/wvbUlng9Fo0/ehhnnweHORwJ but this thread did not end in a resolution :(

Thank You!

Tommaso Pecorella

unread,
Mar 21, 2014, 2:37:05 AM3/21/14
to ns-3-...@googlegroups.com
Hi,

it depends on if you need to have an Attribute holding these addresses, or you want to use a "normal" function to Set/Get them.

Normal Set/Get functions can safely use a container like a list, vector, map or whatever.

If you need attributes, then the link you found is the right starting place. Normally ObjectVectorValues are used to retrieve attributes, tho. I should study a but about how to use them to set values.

T.

Konstantinos

unread,
Mar 21, 2014, 7:25:54 AM3/21/14
to ns-3-...@googlegroups.com
Hi,

Just one comment on this. It has been discussed previously (https://groups.google.com/d/msg/ns-3-users/rvdfvLVDowE/jLVHshUutaEJ); you can not SET vector variables with the attribute system.
You need to use a Set method after the object you want to set it to is initialized.

Ivan Antoniv

unread,
Mar 21, 2014, 12:29:14 PM3/21/14
to ns-3-...@googlegroups.com
That sounds reasonable. Thank You! I actually tried doing something like this, but I was unsure of how to access the "Application object" (presumably from the helper I use to install the application) on which I wanted to call the Set function.

Konstantinos

unread,
Mar 21, 2014, 12:44:23 PM3/21/14
to ns-3-...@googlegroups.com
From the Node smart pointer you can get the applications that are installed on it.

Ivan Antoniv

unread,
Mar 22, 2014, 1:33:07 PM3/22/14
to ns-3-...@googlegroups.com
(dynamic_cast<PkiMeshNode&> (*(m_hubNodes.Get(hubNum)->GetApplication(0))) ).setMeshAddresses(mesh_addresses)

Does this look like the right approach (PkiMeshNode is the name of the application I am building)?


--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/Wn2e7tulr94/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages