Re: Getting the primary interface name ?
Re: Getting the primary interface name ?
- Subject: Re: Getting the primary interface name ?
- From: Allan Nathanson <email@hidden>
- Date: Wed, 7 Aug 2002 12:13:39 -0400
On Wednesday, August 7, 2002, at 09:36 AM, Jirome Foucher wrote:
How on X, using the System Configuration Framework, and more
particularily the SCDynamicStore, can I get the primary interface name
(ie en0, ppp0...) ?
I try to use SCDynamicStoreCopyValue, but I don't really see which key
to use.....
SCDynamicStoreRef store;
CFStringRef key;
CFDictionaryRef globalDict;
CFStringRef primaryInterface = NULL;
store = SCDynamicStoreCreate(NULL, CFSTR("getPrimary"), NULL, NULL);
if (!store) {
// shouldn't happen but...
}
key = SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
kSCDynamicStoreDomainState,
kSCEntNetIPv4);
globalDict = SCDynamicStoreCopyValue(store, key);
CFRelease(key);
if (globalDict) {
primaryInterface = CFDictionaryGetValue(globalDict,
kSCDynamicStorePropNetPrimaryInterface);
if (primaryInterface) {
CFRetain(primaryInterface);
}
CFRelease(globalDict);
}
CFRelease(store);
// primaryInterface will either be NULL or a (retained) CFStringRef
...
- Allan
p.s. what do you need the primary interface for?
_______________________________________________
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.