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.
#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