How to get the octets of a Mac Address in ns-3?

62 views
Skip to first unread message

Shey Janota

unread,
May 9, 2023, 4:09:06 PM5/9/23
to ns-3-users
Hello guys,

How are  you?

I want to obtain the Mac Address octets. 
Since it is an hexadecimal address I thought about parsing the address to an integer and then get the octet. 

I tried to follow something similar to  what is done to the IP Address octets (which is working fine)
Fig1.JPG

When I try to convert the hexadecimal Mac address to integer, occurs an error saying the Mac Address can not be converted to integer.
fig2.JPG

or do I have to string split?

Thanks in advance.

Best Regards.

Sheila Janota

Tommaso Pecorella

unread,
May 10, 2023, 1:00:33 PM5/10/23
to ns-3-users
I don't see any "ToInteger" function in Mac48Address (see https://www.nsnam.org/docs/doxygen/d0/db6/classns3_1_1_mac48_address.html).

I'd strongly suggest to check the documentation, and possibly to install an IDE that suggest you the functions you can use on a given instance. VScode, CLion, Eclipse... all of them do that.
It's usually better than trying to guess the functions names from what you think the devs might have thought.

Reply all
Reply to author
Forward
0 new messages