• 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: Question about VLANs in Mac OS X
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about VLANs in Mac OS X


  • Subject: Re: Question about VLANs in Mac OS X
  • From: Terry Simons <email@hidden>
  • Date: Mon, 17 Mar 2008 21:52:23 -0600

Hmmm...

I'm not used to jumping through the CF* hoops to get simple things working.

I'm attempting to iterating the list of interfaces that support VLANs, and simply print their BSD names out.

Here's the code I've written:

#include <CoreFoundation/CoreFoundation.h>
#include <SystemConfiguration/SCNetworkConfiguration.h>

int main (int argc, const char * argv[]) {

    

CFArrayRef networkInterfaceArrayRef = NULL; 
int interfaceIndex                  = 0;
int vlanCapableInts                 = 0;


networkInterfaceArrayRef = SCVLANInterfaceCopyAvailablePhysicalInterfaces();
vlanCapableInts          = CFArrayGetCount(networkInterfaceArrayRef);


printf("There are %d physical interfaces capable of supporting VLANs.\n", vlanCapableInts);


for(interfaceIndex = 0; interfaceIndex < vlanCapableInts; interfaceIndex++) {
printf("%s supports VLANs.\n", CFStringGetCStringPtr(SCNetworkInterfaceGetBSDName(CFArrayGetValueAtIndex(networkInterfaceArrayRef, interfaceIndex)), kCFStringEncodingUTF8));
}


CFRelease(networkInterfaceArrayRef);


    return 0;
}

When I run this, I get the following output:

There are 2 physical interfaces capable of supporting VLANs.
(null) supports VLANs.
(null) supports VLANs.

This seems a lot harder than it should be... are there easier ways to do this with the CF* routines?

- Terry
Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Question about VLANs in Mac OS X
      • From: Terry Simons <email@hidden>
References: 
 >Question about VLANs in Mac OS X (From: Terry Simons <email@hidden>)
 >Re: Question about VLANs in Mac OS X (From: Allan Nathanson <email@hidden>)

  • Prev by Date: Re: Question about VLANs in Mac OS X
  • Next by Date: Re: Question about VLANs in Mac OS X
  • Previous by thread: Re: Question about VLANs in Mac OS X
  • Next by thread: Re: Question about VLANs in Mac OS X
  • Index(es):
    • Date
    • Thread