On Dec 20, 2007, at 10:28 AM, Allan Nathanson wrote:
"IPSec" is not a protocol type.
OK, so why, when I call SCNetworkServiceCopyProtocols on an Apple
created L2TP service, is there one named "IPSec" in the array that
is returned?
CFArrayRef services = SCNetworkServiceCopyAll(prefs);
int serviceCount = CFArrayGetCount(services);
while ( serviceCount-- )
{
SCNetworkServiceRef curService = CFArrayGetValueAtIndex(services,
serviceCount);
CFStringRef serviceName = SCNetworkServiceGetName(curService);
if ( CFEqual(serviceName, CFSTR("VPN (L2TP)")) )
{
SCNetworkInterfaceRef firstLayer =
SCNetworkServiceGetInterface(curService);
CFArrayRef supportedProtocols =
SCNetworkInterfaceGetSupportedProtocolTypes(firstLayer);
CFShow(supportedProtocols);
CFArrayRef protocols = SCNetworkServiceCopyProtocols(curService);
int protoCount = CFArrayGetCount(protocols);
while ( protoCount-- )
{
SCNetworkProtocolRef curProto = CFArrayGetValueAtIndex(protocols,
protoCount);
CFStringRef protoName =
SCNetworkProtocolGetProtocolType(curProto);
CFDictionaryRef protoConfig =
SCNetworkProtocolGetConfiguration(curProto);
CFShow(protoName); //Second element will be "IPSec"
CFShow(protoConfig);
}
}
}