• 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 22:13:13 -0600

Ok, a slightly modified (hopefully more read-able) example.

I figured out a workaround, but I'm not sure I understand why.

Here's the new code:

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

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

    

CFArrayRef networkInterfaceArrayRef       = NULL; 
SCNetworkInterfaceRef networkInterfaceRef = NULL;
CFStringRef           bsdInterfaceName    = NULL;
const char            *intName            = 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++) {
networkInterfaceRef = CFArrayGetValueAtIndex(networkInterfaceArrayRef, interfaceIndex);


bsdInterfaceName = SCNetworkInterfaceGetBSDName(networkInterfaceRef);


intName = CFStringGetCStringPtr(bsdInterfaceName, kCFStringEncodingUTF8);


printf("%s supports VLANs.\n", intName);
}


CFRelease(networkInterfaceArrayRef);


    return 0;
}

I still get the following when running the above code:

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

 If I step through the code, bsdInterfaceName contains "en0" and "en1" respectively, but attempting to call CFStringGetCStringRef on it always returns NULL, but it works fine if I use kCFStringEncodingMacRoman.  Why can't I use kCFStringEncodingUTF8 (Or ASCII) in this example?

- 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: Allan Nathanson <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>)
 >Re: Question about VLANs in Mac OS X (From: Terry Simons <email@hidden>)

  • Prev by Date: Re: Question about VLANs in Mac OS X
  • Next by Date: Question about obtaining SCPreferencesRef for accessing SCVLANInterfaceRef data.
  • 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