Re: Using SystemConfiguration to get BSD network device properties
Re: Using SystemConfiguration to get BSD network device properties
- Subject: Re: Using SystemConfiguration to get BSD network device properties
- From: Allan Nathanson <email@hidden>
- Date: Thu, 7 Aug 2008 02:12:19 -0400
If you are looking for information about the interface
"type" (Ethernet, FireWire, Bluetooth, ...) than I'll point you
towards the <SystemConfiguration/SCNetworkConfiguration.h> APIs.
Specifically :
SCNetworkInterfaceCopyAll()
will give you an array of available network interfaces
SCNetworkInterfaceGetInterfaceType()
will tell you what "type" of a given interface
SCNetworkInterfaceGetLocalizedDisplayName()
will return a string like "Built-in Ethernet"
Of course, there's many more questions to ask. For example, do you
want information about ALL of the available interfaces or just those
that have been configured? or just those that are active? or ...
- Allan
On Aug 6, 2008, at 10:32 PM, Andrew White wrote:
I'm trying to use Core Foundation's system configuration to get
information on the installed network devices.
The following gets me a dictionary containing a key 'Interfaces'
which has an array of BSD interface names:
CFStringRef intfKey =
SCDynamicStoreKeyCreateNetworkInterface (
NULL, kSCDynamicStoreDomainState
);
CFPropertyListRef intfRef = SCDynamicStoreCopyValue (_store, intfKey);
Given this info, I can iterate through the interfaces, but the info
I can get seems limited. What I really want to know is the
interface type, but using the Hardware key (for example) doesn't
seem to do anything. I can get the IPv4 addressing information (see
next snipppet), but that's not really what I want.
Getting addresses: for interface 'name', this gets an dictionary
containing "Addresses", "Broadcast Masks", and "Subnet Masks".
CFStringRef intfEntityKey =
SCDynamicStoreKeyCreateNetworkInterfaceEntity (
NULL, kSCDynamicStoreDomainState, name, kSCEntNetIPv4
);
CFPropertyListRef intf = SCDynamicStoreCopyValue (_store,
intfEntityKey);
Is there a way to get this stuff from the dynamic store
NetworkInterface info, or do I need to go digging elsewhere? Do I
need to use the POSIX API to get this info?
Platform is 10.4.x and up. Currently using 10.4.11 and XCode 2.4.1.
Thanks
--
Andrew White
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden