• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting HW built-in ethernet address
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting HW built-in ethernet address


  • Subject: Re: Getting HW built-in ethernet address
  • From: Peter Sichel <email@hidden>
  • Date: Fri, 2 Aug 2002 12:38:33 -0400

At 7:58 AM +0200 8/2/02, Tomas Zahradnicky wrote:
Hello,

what is the proper way to get hardware address of built-in ethernet card? I looked though Apple's website and I found there lots of examples and I got confused of them. If I needed that in CFM fragment, do I need to use call mach-o framework and import IOKit routines to access an ethernet device? How do I tell that a given ethernet device is built-in?

Thanks,

-Tomas

I think the easiest way to do this on Mac OS X is to use
the System Configuration Framework. Information on each
network interface and device is available in a fairly simple
set of dictionaries.

Look at XML file /var/db/SystemConfiguration/preferences.xml
on your system to get a feel for the structure of the dictionaries.
You'll quickly recognize entries like "Ethernet Built-in"
for key "UserDefinedName" and find the corresponding hardware
address.

Of course you could use IOKit directly, but this is more complex
and intended for configuring drivers. Finally, there are a bunch
of techniques for different Ethernet hardware and software for
Mac OS 9 and below, but I would try to avoid these unless you really
need them.

Accessing the System Configuration Framework is much simpler if
you can use Cocoa. CFDictionary and CFPropertyList are just
NSDictionary with a clumsier interface. A couple things to
watch out for are:

- Each time you call into the System Configuration Framework,
previously returned dictionaries may be autoreleased.
Make sure you retain anything you want to keep around.

- Check for non-existent (null) entries at each step as you
walk through the dictionaries. Some 3rd party devices don't
provide a "UserDefinedName" for example.

Once you get it, the System Configuration Framework is a vast
improvement over the previous collection of diverse APIs.

Kind Regards,

- Peter
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Getting HW built-in ethernet address
      • From: Tomas Zahradnicky <email@hidden>
References: 
 >Getting HW built-in ethernet address (From: Tomas Zahradnicky <email@hidden>)

  • Prev by Date: Cancelling socket operations
  • Next by Date: Re: Getting HW built-in ethernet address
  • Previous by thread: Getting HW built-in ethernet address
  • Next by thread: Re: Getting HW built-in ethernet address
  • Index(es):
    • Date
    • Thread