How to get the position from the mac address?

85 views
Skip to first unread message

Amira Bezzina

unread,
Jan 17, 2012, 5:52:22 AM1/17/12
to ns-3-users
Hi everybody,

Any idea about how to get the position of the node (x,y) from its mac
address knowing that the node has multiple interfaces in a mesh
network.

Thanks in advance.

Amira

Konstantinos

unread,
Jan 17, 2012, 8:35:16 AM1/17/12
to ns-3-...@googlegroups.com
Dear Amira,

What you are asking can be transformed into the question how to identify a node (node_id) from its MAC address. After having the node_id you can get a pointer to that node and get the mobility model attached to that. Thus being able to get the position.

To the best of my knowledge, there is no such function (input a MAC address, output a node id/pointer). You have to go round that, and get ALL nodes and then search through each NetDevice and the MAC address of each node until you get a match to the MAC address you want, thus finding your node.
I have used a similar approach to search and find a node from its IP address.

For efficiency, you could use a std::map to store the all the pairs <MACaddr, node_id> and then simple find the node_id from that std::map.



Hope that helped,

Konstantinos
Reply all
Reply to author
Forward
0 new messages