i want to find MAC address. which library/C API will return the same.
|
|
0
|
|
|
|
Reply
|
ameyaagnihotri22 (9)
|
6/6/2006 5:42:04 AM |
|
"ameya_agnihotri" <ameyaagnihotri22@gmail.com> writes:
> i want to find MAC address. which library/C API will return the same.
There isn't one, exactly.
First of all, MAC address isn't really a system property (though it
_may_ be represented that way on some platforms). Instead, it's a
property of a given kind of network interface. You may have zero,
one, or many such interfaces on your system.
Secondly, depending on what you're trying to do, there may be more
than one MAC address per interface -- the one that's burned in at the
factory (not present on some very old platforms), and the one that's
currently set by software (can be changed by the administrator).
Finally, there are at least two ways to get at the MAC address that
are subtly different. One way is to open up the DLPI provider (e.g.,
"/dev/hme") and use DLPI commands (<sys/dlpi.h>) to attach and read
back the MAC address desired. This may involve a fair amount of code,
but examples exist on the net. The other way to do it is with the
standard IP ioctls (SIOCGIFCONF and SIOCGARP). Doing that gives you
only IP's (and ARP's) understanding of the MAC address(es), and may
not map exactly into the hardware.
So, first, you need to describe what it is you're trying to do with
the MAC address.
--
James Carlson, KISS Network <james.d.carlson@sun.com>
Sun Microsystems / 1 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
|
|
0
|
|
|
|
Reply
|
James
|
6/6/2006 4:06:13 PM
|
|