• 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 the primary interface name ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Getting the primary interface name ?
      • From: Jérome Foucher <email@hidden>
References: 
 >Getting the primary interface name ? (From: Jérome Foucher <email@hidden>)

  • Prev by Date: Getting the primary interface name ?
  • Next by Date: No data from endpoint until it's closed?
  • Previous by thread: Getting the primary interface name ?
  • Next by thread: Re: Getting the primary interface name ?
  • Index(es):
    • Date
    • Thread